{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Get and Change a Public Figure"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import chart_studio.plotly as py\n",
"# Learn about API authentication here: https://plotly.com/python/getting-started\n",
"# Find your api_key here: https://plotly.com/settings/api\n",
"\n",
"fig = py.get_figure(\"https://plotly.com/~PlotBot/5\")\n",
"\n",
"fig['layout']['title'] = \"Never forget that title!\"\n",
"\n",
"py.iplot(fig, filename=\"python-change_plot\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Get Data and Change Plot"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import chart_studio.plotly as py\n",
"import plotly.graph_objects as go\n",
"# Learn about API authentication here: https://plotly.com/python/getting-started\n",
"# Find your api_key here: https://plotly.com/settings/api\n",
"\n",
"data = py.get_figure(\"https://plotly.com/~PythonPlotBot/3483\").data\n",
"distance = [d['y'][0] for d in data] # check out the data for yourself!\n",
"\n",
"fig = go.Figure()\n",
"fig.add_histogram(y=distance, name=\"flyby distance\", histnorm='probability')\n",
"xaxis = dict(title=\"Probability for Flyby at this Distance\")\n",
"yaxis = dict(title=\"Distance from Earth (Earth Radii)\")\n",
"fig.update_layout(title=\"data source: https://plotly.com/~AlexHP/68\", xaxis=xaxis, yaxis=yaxis)\n",
"\n",
"plot_url = py.plot(fig, filename=\"python-get-data\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Get and Replot a Public Figure with URL"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import chart_studio.plotly as py\n",
"# Learn about API authentication here: https://plotly.com/python/getting-started\n",
"# Find your api_key here: https://plotly.com/settings/api\n",
"\n",
"fig = py.get_figure(\"https://plotly.com/~PlotBot/5\")\n",
"\n",
"plot_url = py.plot(fig, filename=\"python-replot1\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Get and Replot a Public Figure with ID"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"import chart_studio.plotly as py\n",
"# Learn about API authentication here: https://plotly.com/python/getting-started\n",
"# Find your api_key here: https://plotly.com/settings/api\n",
"\n",
"fig = py.get_figure(\"PlotBot\", 5)\n",
"\n",
"plot_url = py.plot(fig, filename=\"python-replot2\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"jupytext": {
"notebook_metadata_filter": "all",
"text_representation": {
"extension": ".md",
"format_name": "markdown",
"format_version": "1.1",
"jupytext_version": "1.1.7"
}
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
},
"plotly": {
"description": "How to download plotly users's public graphs and data with python.",
"display_as": "chart_studio",
"has_thumbnail": true,
"language": "python",
"layout": "base",
"name": "Get Requests",
"order": 8,
"permalink": "python/get-requests/",
"thumbnail": "thumbnail/spectral.jpg",
"title": "Python Get Requests | Examples | Plotly",
"v4upgrade": true
}
},
"nbformat": 4,
"nbformat_minor": 2
}