diff --git a/_posts/python/layout/labels/2015-04-09-labels_python_index.html b/_posts/python/layout/labels/2015-04-09-labels_python_index.html deleted file mode 100755 index 0e73db36a3ef..000000000000 --- a/_posts/python/layout/labels/2015-04-09-labels_python_index.html +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: Setting the Title, Legend Entries, and Axis Titles in Python | Examples | Plotly -name: Setting the Title, Legend Entries, and Axis Titles -permalink: python/figure-labels/ -description: How to set the title, legend-entries, and axis-titles in python. -layout: base -thumbnail: thumbnail/labels.jpg -language: python -page_type: example_index -has_thumbnail: false -display_as: layout_opt ---- -{% assign examples = site.posts | where:"language","python" | where:"suite","labels" | sort: "order" %} -{% include auto_examples.html examples=examples %} diff --git a/_posts/python/layout/labels/2015-04-09-styling-names.html b/_posts/python/layout/labels/2015-04-09-styling-names.html deleted file mode 100755 index 45797c2ec0de..000000000000 --- a/_posts/python/layout/labels/2015-04-09-styling-names.html +++ /dev/null @@ -1,47 +0,0 @@ ---- -name: Styling Axes Labels -plot_url: https://plot.ly/~PlotBot/17 -arrangement: horizontal -language: python -suite: labels -order: 0 -sitemap: false ---- -# Learn about API authentication here: https://plot.ly/python/getting-started -# Find your api_key here: https://plot.ly/settings/api - -import plotly.plotly as py -import plotly.graph_objs as go - -trace1 = go.Scatter( - x=[0, 1, 2, 3, 4, 5, 6, 7, 8], - y=[0, 1, 2, 3, 4, 5, 6, 7, 8], - name='Name of Trace 1' -) -trace2 = go.Scatter( - x=[0, 1, 2, 3, 4, 5, 6, 7, 8], - y=[1, 0, 3, 2, 5, 4, 7, 6, 8], - name='Name of Trace 2' -) -data = [trace1, trace2] -layout = go.Layout( - title='Plot Title', - xaxis=dict( - title='x Axis', - titlefont=dict( - family='Courier New, monospace', - size=18, - color='#7f7f7f' - ) - ), - yaxis=dict( - title='y Axis', - titlefont=dict( - family='Courier New, monospace', - size=18, - color='#7f7f7f' - ) - ) -) -fig = go.Figure(data=data, layout=layout) -plot_url = py.plot(fig, filename='styling-names') diff --git a/_posts/python/layout/labels/2015-06-30-labels.html b/_posts/python/layout/labels/2015-06-30-labels.html new file mode 100644 index 000000000000..f6467c503797 --- /dev/null +++ b/_posts/python/layout/labels/2015-06-30-labels.html @@ -0,0 +1,157 @@ +--- +permalink: python/figure-labels/ +description: How to set the title, legend-entries, and axis-titles in python. +name: Setting the Title, Legend Entries, and Axis Titles in Python | Examples | Plotly +has_thumbnail: true +thumbnail: thumbnail/labels.jpg +title: Setting the Title, Legend Entries, and Axis Titles in Python | Examples | Plotly +name: Setting the Title, Legend Entries, and Axis Titles +language: python +page_type: example_index +has_thumbnail: false +display_as: layout_opt +order: 0.5 +ipynb: ~notebook_demo/271 +layout: user-guide +--- +{% raw %} +
+
+
+
+

New to Plotly?

Plotly's Python library is free and open source! Get started by downloading the client and reading the primer. +
You can set up Plotly to work in online or offline mode, or in jupyter notebooks. +
We also have a quick-reference cheatsheet (new!) to help you get started!

+ +
+
+
+
+
+
+
+

Version Check

Plotly's Python API is updated frequently. Run pip install plotly --upgrade to update your Plotly version.

+ +
+
+
+
+
+
In [1]:
+
+
+
import plotly
+plotly.__version__
+
+ +
+
+
+ +
+
+ + +
+ +
Out[1]:
+ + + + +
+
'3.7.1'
+
+ +
+ +
+
+ +
+
+
+
In [2]:
+
+
+
import plotly.plotly as py
+import plotly.graph_objs as go
+
+trace1 = go.Scatter(
+    x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
+    y=[0, 1, 2, 3, 4, 5, 6, 7, 8],
+    name='Name of Trace 1'
+)
+trace2 = go.Scatter(
+    x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
+    y=[1, 0, 3, 2, 5, 4, 7, 6, 8],
+    name='Name of Trace 2'
+)
+data = [trace1, trace2]
+layout = go.Layout(
+    title=go.layout.Title(
+        text='Plot Title',
+        xref='paper',
+        x=0
+    ),
+    xaxis=go.layout.XAxis(
+        title=go.layout.xaxis.Title(
+            text='x Axis',
+            font=dict(
+                family='Courier New, monospace',
+                size=18,
+                color='#7f7f7f'
+            )
+        )
+    ),
+    yaxis=go.layout.YAxis(
+        title=go.layout.yaxis.Title(
+            text='y Axis',
+            font=dict(
+                family='Courier New, monospace',
+                size=18,
+                color='#7f7f7f'
+            )
+        )
+    )
+)
+fig = go.Figure(data=data, layout=layout)
+py.iplot(fig, filename='styling-names')
+
+ +
+
+
+ +
+
+ + +
+ +
Out[2]:
+ + + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+

Reference

See https://plot.ly/python/reference/#layout for more information!

+ +
+
+
+ + +{% endraw %} \ No newline at end of file diff --git a/_posts/python/layout/labels/labels.ipynb b/_posts/python/layout/labels/labels.ipynb new file mode 100644 index 000000000000..5d0464b82caa --- /dev/null +++ b/_posts/python/layout/labels/labels.ipynb @@ -0,0 +1,211 @@ +{ + "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", + "
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", + "
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 API is updated frequently. Run pip install plotly --upgrade to update your Plotly version." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'3.7.1'" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly\n", + "plotly.__version__" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly.plotly as py\n", + "import plotly.graph_objs as go\n", + "\n", + "trace1 = go.Scatter(\n", + " x=[0, 1, 2, 3, 4, 5, 6, 7, 8],\n", + " y=[0, 1, 2, 3, 4, 5, 6, 7, 8],\n", + " name='Name of Trace 1'\n", + ")\n", + "trace2 = go.Scatter(\n", + " x=[0, 1, 2, 3, 4, 5, 6, 7, 8],\n", + " y=[1, 0, 3, 2, 5, 4, 7, 6, 8],\n", + " name='Name of Trace 2'\n", + ")\n", + "data = [trace1, trace2]\n", + "layout = go.Layout(\n", + " title=go.layout.Title(\n", + " text='Plot Title',\n", + " xref='paper',\n", + " x=0\n", + " ),\n", + " xaxis=go.layout.XAxis(\n", + " title=go.layout.xaxis.Title(\n", + " text='x Axis',\n", + " font=dict(\n", + " family='Courier New, monospace',\n", + " size=18,\n", + " color='#7f7f7f'\n", + " )\n", + " )\n", + " ),\n", + " yaxis=go.layout.YAxis(\n", + " title=go.layout.yaxis.Title(\n", + " text='y Axis',\n", + " font=dict(\n", + " family='Courier New, monospace',\n", + " size=18,\n", + " color='#7f7f7f'\n", + " )\n", + " )\n", + " )\n", + ")\n", + "fig = go.Figure(data=data, layout=layout)\n", + "py.iplot(fig, filename='styling-names')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Reference\n", + "See https://plot.ly/python/reference/#layout for more information!" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "" + ] + }, + "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 /tmp/pip-req-build-g_hb8ys1\n", + "Building wheels for collected packages: publisher\n", + " Running setup.py bdist_wheel for publisher ... \u001b[?25ldone\n", + "\u001b[?25h Stored in directory: /tmp/pip-ephem-wheel-cache-clgwp6cl/wheels/99/3e/a0/fbd22ba24cca72bdbaba53dbc23c1768755fb17b3af0f33966\n", + "Successfully built publisher\n", + "Installing collected packages: publisher\n", + " Found existing installation: publisher 0.13\n", + " Uninstalling publisher-0.13:\n", + " Successfully uninstalled publisher-0.13\n", + "Successfully installed publisher-0.13\n", + "\u001b[33mYou are using pip version 10.0.1, however version 19.0.3 is available.\n", + "You should consider upgrading via the 'pip install --upgrade pip' command.\u001b[0m\n" + ] + } + ], + "source": [ + "from IPython.display import display, HTML\n", + "\n", + "display(HTML(''))\n", + "display(HTML(''))\n", + "\n", + "! pip install git+https://github.com/plotly/publisher.git --upgrade\n", + "import publisher\n", + "publisher.publish(\n", + " 'labels.ipynb', 'python/figure-labels/', 'Setting the Title, Legend Entries, and Axis Titles in Python | Examples | Plotly',\n", + " 'How to set the title, legend-entries, and axis-titles in python.',\n", + " title = 'Setting the Title, Legend Entries, and Axis Titles in Python | Examples | Plotly',\n", + " name = 'Setting the Title, Legend Entries, and Axis Titles',\n", + " thumbnail='thumbnail/labels.jpg', language='python',\n", + " page_type='example_index', has_thumbnail='false', display_as='layout_opt', order=0.5, \n", + " ipynb='~notebook_demo/271')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "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" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}