Skip to content

Joyplot Doc #1090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add a notebook - WIP
  • Loading branch information
Coding-with-Adam committed Sep 14, 2018
commit ab10f37ba6c722b03561e11b18240483b1c9782f
160 changes: 46 additions & 114 deletions _posts/python/statistical/joyplot/joyplot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,21 @@
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"execution_count": 2,
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"text/html": [
"<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~jordanpeterson/529.embed\" height=\"525px\" width=\"100%\"></iframe>"
"<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~jordanpeterson/1160.embed\" height=\"525px\" width=\"100%\"></iframe>"
],
"text/plain": [
"<plotly.tools.PlotlyDisplay object>"
]
},
"execution_count": 11,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -73,122 +75,52 @@
"\n",
"df = pd.read_csv(\"https://raw.githubusercontent.com/plotly/datasets/master/violin_data.csv\")\n",
"\n",
"fig = {\n",
" \"data\": [{\n",
" \"type\": 'violin',\n",
" \"y\": df['total_bill'],\n",
" \"box\": {\n",
" \"visible\": False\n",
" },\n",
" \"line\": {\n",
" \"color\": 'black'\n",
" },\n",
" \"meanline\": {\n",
" \"visible\": False\n",
" },\n",
" \"fillcolor\": '#8dd3c7',\n",
" \"opacity\": 1,\n",
" \"x0\": 'Total Bill'\n",
" }],\n",
" \"layout\" : {\n",
" \"title\": \"\",\n",
" \"yaxis\": {\n",
" \"zeroline\": False,\n",
" }\n",
" }\n",
"}\n",
"trace1 = dict(\n",
" orientation='h',\n",
" type='violin',\n",
" x=list(df['total_bill'] + 4),\n",
" y0=1,\n",
" box=dict(visible=False),\n",
" line=dict(width=0),\n",
" meanline=dict(visible=False),\n",
" fillcolor='#c78dd3',\n",
" opacity=0.8,\n",
" points=False,\n",
" side='positive',\n",
")\n",
"\n",
"trace2 = dict(\n",
" orientation='h',\n",
" type='violin',\n",
" x=list(df['total_bill'] + 4),\n",
" y0=0.1,\n",
" box=dict(visible=False),\n",
" line=dict(width=0),\n",
" meanline=dict(visible=False),\n",
" fillcolor='#8dd3c7',\n",
" opacity=0.8,\n",
" points=False,\n",
" side='positive',\n",
")\n",
"\n",
"py.iplot(fig, filename='violin/basic', validate=False)"
"fig = dict(\n",
" data=[trace1, trace2,],\n",
" layout=dict(\n",
" title='',\n",
" yaxis=dict(zeroline=False),\n",
" showlegend=False\n",
" )\n",
")\n",
"\n",
"py.iplot(fig, filename='violin-for-joyplot')"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'data': [{'box': {'visible': False},\n",
" 'fillcolor': '#8dd3c7',\n",
" 'line': {'color': 'black'},\n",
" 'meanline': {'visible': False},\n",
" 'opacity': 1,\n",
" 'type': 'violin',\n",
" 'x0': 'Total Bill',\n",
" 'y': 0 16.99\n",
" 1 10.34\n",
" 2 21.01\n",
" 3 23.68\n",
" 4 24.59\n",
" 5 25.29\n",
" 6 8.77\n",
" 7 26.88\n",
" 8 15.04\n",
" 9 14.78\n",
" 10 10.27\n",
" 11 35.26\n",
" 12 15.42\n",
" 13 18.43\n",
" 14 14.83\n",
" 15 21.58\n",
" 16 10.33\n",
" 17 16.29\n",
" 18 16.97\n",
" 19 20.65\n",
" 20 17.92\n",
" 21 20.29\n",
" 22 15.77\n",
" 23 39.42\n",
" 24 19.82\n",
" 25 17.81\n",
" 26 13.37\n",
" 27 12.69\n",
" 28 21.70\n",
" 29 19.65\n",
" ... \n",
" 214 28.17\n",
" 215 12.90\n",
" 216 28.15\n",
" 217 11.59\n",
" 218 7.74\n",
" 219 30.14\n",
" 220 12.16\n",
" 221 13.42\n",
" 222 8.58\n",
" 223 15.98\n",
" 224 13.42\n",
" 225 16.27\n",
" 226 10.09\n",
" 227 20.45\n",
" 228 13.28\n",
" 229 22.12\n",
" 230 24.01\n",
" 231 15.69\n",
" 232 11.61\n",
" 233 10.77\n",
" 234 15.53\n",
" 235 10.07\n",
" 236 12.60\n",
" 237 32.83\n",
" 238 35.83\n",
" 239 29.03\n",
" 240 27.18\n",
" 241 22.67\n",
" 242 17.82\n",
" 243 18.78\n",
" Name: total_bill, Length: 244, dtype: float64}],\n",
" 'layout': {'title': '', 'yaxis': {'zeroline': False}}}"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fig"
]
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
Expand Down