-
-
Notifications
You must be signed in to change notification settings - Fork 543
HTML to ipynb for bubble, bar, area, box, error bar and quiver-plots #1048
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
af8454f
HTML to ipynb for bubble, bar, area, box, error bar
priyatharsan 4160d0f
added quiver-plots update
priyatharsan e7d739d
changed bubble chart type to basic, edited description, added permali…
a08d04c
Revert "changed bubble chart type to basic, edited description, added…
priyatharsan 4a536a8
updated the titles, import orders and other reviewed changes
priyatharsan cca2025
updated import order and removed the commented texts
priyatharsan 9d83fdc
reference update
priyatharsan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
14 changes: 0 additions & 14 deletions
14
_posts/matplotlib/area/2015-04-09-area_matplotlib_index.html
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,305 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n", | ||
"#### 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.1.1'" | ||
] | ||
}, | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"import plotly\n", | ||
"plotly.__version__" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"#### Area Plot" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~priyatharsan/687.embed\" height=\"288px\" width=\"432px\"></iframe>" | ||
], | ||
"text/plain": [ | ||
"<plotly.tools.PlotlyDisplay object>" | ||
] | ||
}, | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"import matplotlib.pyplot as plt\n", | ||
"import plotly.plotly as py\n", | ||
"import plotly.tools as tls\n", | ||
"\n", | ||
"# Learn about API authentication here: https://plot.ly/python/getting-started\n", | ||
"# Find your api_key here: https://plot.ly/settings/api\n", | ||
"\n", | ||
"fig, ax = plt.subplots()\n", | ||
"ax.plot([2,1,3,1,2])\n", | ||
"\n", | ||
"update = {'data':[{'fill': 'tozeroy'}]} # this updates the trace\n", | ||
"plotly_fig = tls.mpl_to_plotly( fig )\n", | ||
"plotly_fig.update(update)\n", | ||
"py.iplot(plotly_fig, update=update, filename='mpl-basic-area')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"#### Multiple Line Area Plot" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~priyatharsan/685.embed\" height=\"288px\" width=\"432px\"></iframe>" | ||
], | ||
"text/plain": [ | ||
"<plotly.tools.PlotlyDisplay object>" | ||
] | ||
}, | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"import plotly.plotly as py\n", | ||
"import plotly.tools as tls\n", | ||
"\n", | ||
"# Learn about API authentication here: https://plot.ly/python/getting-started\n", | ||
"# Find your api_key here: https://plot.ly/settings/api\n", | ||
"\n", | ||
"x = np.linspace(0, 2*np.pi, 100)\n", | ||
"fig, ax = plt.subplots()\n", | ||
"ax.plot(np.sin(x), label='sin'); ax.plot(np.cos(x), label='cos')\n", | ||
"\n", | ||
"update = {'data':[{'fill': 'tozeroy'}]} # this updates BOTH traces now\n", | ||
"plotly_fig = tls.mpl_to_plotly( fig )\n", | ||
"plotly_fig.update(update)\n", | ||
"py.iplot(plotly_fig, filename='mpl-multi-fill')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"#### Stacked Line Plot" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~priyatharsan/683.embed\" height=\"288px\" width=\"432px\"></iframe>" | ||
], | ||
"text/plain": [ | ||
"<plotly.tools.PlotlyDisplay object>" | ||
] | ||
}, | ||
10000 "execution_count": 4, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"import plotly.plotly as py\n", | ||
"import plotly.tools as tls\n", | ||
"\n", | ||
"# Learn about API authentication here: https://plot.ly/python/getting-started\n", | ||
"# Find your api_key here: https://plot.ly/settings/api\n", | ||
"\n", | ||
"# create our stacked data manually\n", | ||
"y0 = np.random.rand(100)\n", | ||
"y1 = y0 + np.random.rand(100)\n", | ||
"y2 = y1 + np.random.rand(100)\n", | ||
"capacity = 3*np.ones(100)\n", | ||
"\n", | ||
"# make the mpl plot (no fill yet)\n", | ||
"fig, ax = plt.subplots()\n", | ||
"ax.plot(y0, label='y0')\n", | ||
"ax.plot(y1, label='y1')\n", | ||
"ax.plot(y2, label='y2')\n", | ||
"ax.plot(capacity, label='capacity')\n", | ||
"\n", | ||
"# set all traces' \"fill\" so that it fills to the next 'y' trace\n", | ||
"update = {'data':[{'fill': 'tonexty'}]}\n", | ||
"\n", | ||
"# strip style just lets Plotly make the styling choices (e.g., colors)\n", | ||
"plotly_fig = tls.mpl_to_plotly( fig )\n", | ||
"plotly_fig.update(update)\n", | ||
"py.iplot(plotly_fig, strip_style=True, filename='mpl-stacked-line')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"#### Reference\n", | ||
"See https://plot.ly/python/filled-area-plots/ for more information and chart attribute options!" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"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\\thars\\appdata\\local\\temp\\pip-req-build-j1q7bm\n", | ||
"Building wheels for collected packages: publisher\n", | ||
" Running setup.py bdist_wheel for publisher: started\n", | ||
" Running setup.py bdist_wheel for publisher: finished with status 'done'\n", | ||
" Stored in directory: c:\\users\\thars\\appdata\\local\\temp\\pip-ephem-wheel-cache-d3mdxz\\wheels\\99\\3e\\a0\\fbd22ba24cca72bdbaba53dbc23c1768755fb17b3af0f33966\n", | ||
"Successfully built publisher\n", | ||
"Installing collected packages: publisher\n", | ||
" Found existing installation: publisher 0.11\n", | ||
" Uninstalling publisher-0.11:\n", | ||
" Successfully uninstalled publisher-0.11\n", | ||
"Successfully installed publisher-0.11\n" | ||
] | ||
}, | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"C:\\Anaconda\\Anaconda2\\lib\\site-packages\\IPython\\nbconvert.py:13: ShimWarning:\n", | ||
"\n", | ||
"The `IPython.nbconvert` package has been deprecated since IPython 4.0. You should import from nbconvert instead.\n", | ||
"\n", | ||
"C:\\Anaconda\\Anaconda2\\lib\\site-packages\\publisher\\publisher.py:53: UserWarning:\n", | ||
"\n", | ||
"Did you \"Save\" this notebook before running this command? Remember to save, always save.\n", | ||
"\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", | ||
" 'matplotlib_area.ipynb', 'matplotlib/filled-area-pl 95F0 ots/', 'Filled Area Plots',\n", | ||
" 'How to make a filled area plot in matplotlib. An area chart displays a solid color between the traces of a graph.',\n", | ||
" title = 'Matplotlib Filled Area Plots | Plotly',\n", | ||
" has_thumbnail='true', thumbnail='thumbnail/area.jpg',\n", | ||
" language='matplotlib',\n", | ||
" page_type='example_index',\n", | ||
" display_as='basic', ipynb='~notebook_demo/246')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"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.14" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at it again, I don't think that we require these commented lines anymore. They seem redundant given that this information is contained in the New to Plotly? section.