|
48 | 48 | },
|
49 | 49 | {
|
50 | 50 | "cell_type": "code",
|
51 |
| - "execution_count": 11, |
52 |
| - "metadata": {}, |
| 51 | + "execution_count": 2, |
| 52 | + "metadata": { |
| 53 | + "scrolled": false |
| 54 | + }, |
53 | 55 | "outputs": [
|
54 | 56 | {
|
55 | 57 | "data": {
|
56 | 58 | "text/html": [
|
57 |
| - "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~jordanpeterson/529.embed\" height=\"525px\" width=\"100%\"></iframe>" |
| 59 | + "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~jordanpeterson/1160.embed\" height=\"525px\" width=\"100%\"></iframe>" |
58 | 60 | ],
|
59 | 61 | "text/plain": [
|
60 | 62 | "<plotly.tools.PlotlyDisplay object>"
|
61 | 63 | ]
|
62 | 64 | },
|
63 |
| - "execution_count": 11, |
| 65 | + "execution_count": 2, |
64 | 66 | "metadata": {},
|
65 | 67 | "output_type": "execute_result"
|
66 | 68 | }
|
|
73 | 75 | "\n",
|
74 | 76 | "df = pd.read_csv(\"https://raw.githubusercontent.com/plotly/datasets/master/violin_data.csv\")\n",
|
75 | 77 | "\n",
|
76 |
| - "fig = {\n", |
77 |
| - " \"data\": [{\n", |
78 |
| - " \"type\": 'violin',\n", |
79 |
| - " \"y\": df['total_bill'],\n", |
80 |
| - " \"box\": {\n", |
81 |
| - " \"visible\": False\n", |
82 |
| - " },\n", |
83 |
| - " \"line\": {\n", |
84 |
| - " \"color\": 'black'\n", |
85 |
| - " },\n", |
86 |
| - " \"meanline\": {\n", |
87 |
| - " \"visible\": False\n", |
88 |
| - " },\n", |
89 |
| - " \"fillcolor\": '#8dd3c7',\n", |
90 |
| - " \"opacity\": 1,\n", |
91 |
| - " \"x0\": 'Total Bill'\n", |
92 |
| - " }],\n", |
93 |
| - " \"layout\" : {\n", |
94 |
| - " \"title\": \"\",\n", |
95 |
| - " \"yaxis\": {\n", |
96 |
| - " \"zeroline\": False,\n", |
97 |
| - " }\n", |
98 |
| - " }\n", |
99 |
| - "}\n", |
| 78 | + "trace1 = dict(\n", |
| 79 | + " orientation='h',\n", |
| 80 | + " type='violin',\n", |
| 81 | + " x=list(df['total_bill'] + 4),\n", |
| 82 | + " y0=1,\n", |
| 83 | + " box=dict(visible=False),\n", |
| 84 | + " line=dict(width=0),\n", |
| 85 | + " meanline=dict(visible=False),\n", |
| 86 | + " fillcolor='#c78dd3',\n", |
| 87 | + " opacity=0.8,\n", |
| 88 | + " points=False,\n", |
| 89 | + " side='positive',\n", |
| 90 | + ")\n", |
| 91 | + "\n", |
| 92 | + "trace2 = dict(\n", |
| 93 | + " orientation='h',\n", |
| 94 | + " type='violin',\n", |
| 95 | + " x=list(df['total_bill'] + 4),\n", |
| 96 | + " y0=0.1,\n", |
| 97 | + " box=dict(visible=False),\n", |
| 98 | + " line=dict(width=0),\n", |
| 99 | + " meanline=dict(visible=False),\n", |
| 100 | + " fillcolor='#8dd3c7',\n", |
| 101 | + " opacity=0.8,\n", |
| 102 | + " points=False,\n", |
| 103 | + " side='positive',\n", |
| 104 | + ")\n", |
100 | 105 | "\n",
|
101 |
| - "py.iplot(fig, filename='violin/basic', validate=False)" |
| 106 | + "fig = dict(\n", |
| 107 | + " data=[trace1, trace2,],\n", |
| 108 | + " layout=dict(\n", |
| 109 | + " title='',\n", |
| 110 | + " yaxis=dict(zeroline=False),\n", |
| 111 | + " showlegend=False\n", |
| 112 | + " )\n", |
| 113 | + ")\n", |
| 114 | + "\n", |
| 115 | + "py.iplot(fig, filename='violin-for-joyplot')" |
102 | 116 | ]
|
103 | 117 | },
|
104 | 118 | {
|
105 | 119 | "cell_type": "code",
|
106 |
| - "execution_count": 9, |
| 120 | + "execution_count": null, |
107 | 121 | "metadata": {},
|
108 |
| - "outputs": [ |
109 |
| - { |
110 |
| - "data": { |
111 |
| - "text/plain": [ |
112 |
| - "{'data': [{'box': {'visible': False},\n", |
113 |
| - " 'fillcolor': '#8dd3c7',\n", |
114 |
| - " 'line': {'color': 'black'},\n", |
115 |
| - " 'meanline': {'visible': False},\n", |
116 |
| - " 'opacity': 1,\n", |
117 |
| - " 'type': 'violin',\n", |
118 |
| - " 'x0': 'Total Bill',\n", |
119 |
| - " 'y': 0 16.99\n", |
120 |
| - " 1 10.34\n", |
121 |
| - " 2 21.01\n", |
122 |
| - " 3 23.68\n", |
123 |
| - " 4 24.59\n", |
124 |
| - " 5 25.29\n", |
125 |
| - " 6 8.77\n", |
126 |
| - " 7 26.88\n", |
127 |
| - " 8 15.04\n", |
128 |
| - " 9 14.78\n", |
129 |
| - " 10 10.27\n", |
130 |
| - " 11 35.26\n", |
131 |
| - " 12 15.42\n", |
132 |
| - " 13 18.43\n", |
133 |
| - " 14 14.83\n", |
134 |
| - " 15 21.58\n", |
135 |
| - " 16 10.33\n", |
136 |
| - " 17 16.29\n", |
137 |
| - " 18 16.97\n", |
138 |
| - " 19 20.65\n", |
139 |
| - " 20 17.92\n", |
140 |
| - " 21 20.29\n", |
141 |
| - " 22 15.77\n", |
142 |
| - " 23 39.42\n", |
143 |
| - " 24 19.82\n", |
144 |
| - " 25 17.81\n", |
145 |
| - " 26 13.37\n", |
146 |
| - " 27 12.69\n", |
147 |
| - " 28 21.70\n", |
148 |
| - " 29 19.65\n", |
149 |
| - " ... \n", |
150 |
| - " 214 28.17\n", |
151 |
| - " 215 12.90\n", |
152 |
| - " 216 28.15\n", |
153 |
| - " 217 11.59\n", |
154 |
| - " 218 7.74\n", |
155 |
| - " 219 30.14\n", |
156 |
| - " 220 12.16\n", |
157 |
| - " 221 13.42\n", |
158 |
| - " 222 8.58\n", |
159 |
| - " 223 15.98\n", |
160 |
| - " 224 13.42\n", |
161 |
| - " 225 16.27\n", |
162 |
| - " 226 10.09\n", |
163 |
| - " 227 20.45\n", |
164 |
| - " 228 13.28\n", |
165 |
| - " 229 22.12\n", |
166 |
| - " 230 24.01\n", |
167 |
| - " 231 15.69\n", |
168 |
| - " 232 11.61\n", |
169 |
| - " 233 10.77\n", |
170 |
| - " 234 15.53\n", |
171 |
| - " 235 10.07\n", |
172 |
| - " 236 12.60\n", |
173 |
| - " 237 32.83\n", |
174 |
| - " 238 35.83\n", |
175 |
| - " 239 29.03\n", |
176 |
| - " 240 27.18\n", |
177 |
| - " 241 22.67\n", |
178 |
| - " 242 17.82\n", |
179 |
| - " 243 18.78\n", |
180 |
| - " Name: total_bill, Length: 244, dtype: float64}],\n", |
181 |
| - " 'layout': {'title': '', 'yaxis': {'zeroline': False}}}" |
182 |
| - ] |
183 |
| - }, |
184 |
| - "execution_count": 9, |
185 |
| - "metadata": {}, |
186 |
| - "output_type": "execute_result" |
187 |
| - } |
188 |
| - ], |
189 |
| - "source": [ |
190 |
| - "fig" |
191 |
| - ] |
| 122 | + "outputs": [], |
| 123 | + "source": [] |
192 | 124 | },
|
193 | 125 | {
|
194 | 126 | "cell_type": "markdown",
|
|
0 commit comments