8000 Joyplot Doc by Kully · Pull Request #1090 · plotly/documentation · GitHub
[go: up one dir, main page]

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
Next Next commit
started joyplot nb
  • Loading branch information
Coding-with-Adam committed Sep 13, 2018
commit 1bb5a4c8f0e610ee73fe7e547aa548e9a112c995
296 changes: 296 additions & 0 deletions _posts/python/statistical/joyplot/joyplot.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### New to Plotly?\n",
"Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloading the client and [reading the primer](https://plot.ly/python/getting-started/).\n",
"<br>You can set up Plotly to work in [online](https://plot.ly/python/getting-started/#initialization-for-online-plotting) or [offline](https://plot.ly/python/getting-started/#initialization-for-offline-plotting) mode, or in [jupyter notebooks](https://plot.ly/python/getting-started/#start-plotting-online).\n",
"<br>We also have a quick-reference [cheatsheet](https://images.plot.ly/plotly-documentation/images/python_cheat_sheet.pdf) (new!) to help you get started!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Version Check\n",
"Plotly's python package is updated frequently. Run `pip install plotly --upgrade` to use the latest version."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'3.2.0'"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import plotly\n",
"plotly.__version__"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Joy Plots"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"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>"
],
"text/plain": [
"<plotly.tools.PlotlyDisplay object>"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import plotly.plotly as py\n",
"import plotly.graph_objs as go\n",
"\n",
"import pandas as pd\n",
"\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",
"\n",
"py.iplot(fig, filename='violin/basic', validate=False)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"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"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Reference\n",
"See https://plot.ly/python/reference/#violin for more information and chart attribute options!"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<link href=\"//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Inconsolata|Ubuntu+Mono:400,700\" rel=\"stylesheet\" type=\"text/css\" />"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<link rel=\"stylesheet\" type=\"text/css\" href=\"http://help.plot.ly/documentation/all_static/css/ipython-notebook-custom.css\">"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting git+https://github.com/plotly/publisher.git\n",
" Cloning https://github.com/plotly/publisher.git to c:\\users\\branden\\appdata\\local\\temp\\pip-5beb6u-build\n",
"Installing collected packages: publisher\n",
" Found existing installation: publisher 0.11\n",
" Uninstalling publisher-0.11:\n",
" Successfully uninstalled publisher-0.11\n",
" Running setup.py install for publisher: started\n",
" Running setup.py install for publisher: finished with status 'done'\n",
"Successfully installed publisher-0.11\n"
]
}
],
"source": [
"from IPython.display import display, HTML\n",
"\n",
"display(HTML('<link href=\"//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Inconsolata|Ubuntu+Mono:400,700\" rel=\"stylesheet\" type=\"text/css\" />'))\n",
"display(HTML('<link rel=\"stylesheet\" type=\"text/css\" href=\"http://help.plot.ly/documentation/all_static/css/ipython-notebook-custom.css\">'))\n",
"\n",
"! pip install git+https://github.com/plotly/publisher.git --upgrade\n",
"import publisher\n",
"publisher.publish(\n",
" 'joyplot.ipynb', 'python/joy-plots/', 'Joy Plots',\n",
" 'How to make joy plots and ridgeline plots in Python with Plotly.',\n",
" title = 'Joy Plots | Plotly',\n",
" has_thumbnail='true',\n",
" thumbnail='thumbnail/joyplot.jpg',\n",
" language='python', \n",
" display_as='statistical', \n",
" order=12.1, #ipynb='~notebook_demo/201'\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
0