diff --git a/_posts/python/style/latex/2015-04-09-latex.html b/_posts/python/style/latex/2015-04-09-latex.html deleted file mode 100644 index c279e5a09777..000000000000 --- a/_posts/python/style/latex/2015-04-09-latex.html +++ /dev/null @@ -1,36 +0,0 @@ ---- -name: LaTeX Typesetting -plot_url: https://plot.ly/~PlotBot/3 -arrangement: horizontal -language: python -suite: latex -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=[1, 2, 3, 4], - y=[1, 4, 9, 16], - name='$\\alpha_{1c} = 352 \\pm 11 \\text{ km s}^{-1}$' -) -trace2 = go.Scatter( - x=[1, 2, 3, 4], - y=[0.5, 2, 4.5, 8], - name='$\\beta_{1c} = 25 \\pm 11 \\text{ km s}^{-1}$' -) -data = [trace1, trace2] -layout = go.Layout( - xaxis=dict( - title='$\\sqrt{(n_\\text{c}(t|{T_\\text{early}}))}$' - ), - yaxis=dict( - title='$d, r \\text{ (solar radius)}$' - ) -) -fig = go.Figure(data=data, layout=layout) -plot_url = py.plot(fig, filename='latex') diff --git a/_posts/python/style/latex/2015-04-09-latex_python_index.html b/_posts/python/style/latex/2015-04-09-latex_python_index.html deleted file mode 100644 index 2ebb7dafddbf..000000000000 --- a/_posts/python/style/latex/2015-04-09-latex_python_index.html +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: Python LaTeX | Examples | Plotly -name: LaTeX -permalink: python/LaTeX/ -description: How to add LaTeX to python graphs. -layout: base -thumbnail: thumbnail/latex.jpg -language: python -page_type: example_index -has_thumbnail: false -display_as: style_opt -order: 3 ---- -{% assign examples = site.posts | where:"language","python" | where:"suite","latex" | sort: "order" %} -{% include auto_examples.html examples=examples %} diff --git a/_posts/python/style/latex/2015-06-30-latex-typesetting.html b/_posts/python/style/latex/2015-06-30-latex-typesetting.html new file mode 100644 index 000000000000..b9052d2a0926 --- /dev/null +++ b/_posts/python/style/latex/2015-06-30-latex-typesetting.html @@ -0,0 +1,133 @@ +--- +permalink: python/LaTeX/ +description: How to add LaTeX to python graphs. +name: LaTeX +has_thumbnail: true +thumbnail: thumbnail/latex.jpg +title: Python LaTeX | Examples | Plotly +has_thumbnail: true +language: python +display_as: style_opt +order: 3 +ipynb: ~notebook_demo/268 +layout: user-guide +page_type: u-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 package is updated frequently. Run pip install plotly --upgrade to use the latest version.

+ +
+
+
+
+
+
In [1]:
+
+
+
import plotly
+plotly.__version__
+
+ +
+
+
+ +
+
+ + +
+ +
Out[1]:
+ + + + +
+
'3.6.0'
+
+ +
+ +
+
+ +
+
+
+
+

LaTeX Typesetting

+
+
+
+
+
+
In [2]:
+
+
+
import plotly.plotly as py
+import plotly.graph_objs as go
+
+trace1 = go.Scatter(
+    x=[1, 2, 3, 4],
+    y=[1, 4, 9, 16],
+    name=r'$\alpha_{1c} = 352 \pm 11 \text{ km s}^{-1}$'
+)
+trace2 = go.Scatter(
+    x=[1, 2, 3, 4],
+    y=[0.5, 2, 4.5, 8],
+    name=r'$\beta_{1c} = 25 \pm 11 \text{ km s}^{-1}$'
+)
+data = [trace1, trace2]
+layout = go.Layout(
+    xaxis=dict(
+        title=r'$\sqrt{(n_\text{c}(t|{T_\text{early}}))}$'
+    ),
+    yaxis=dict(
+        title=r'$d, r \text{ (solar radius)}$'
+    )
+)
+fig = go.Figure(data=data, layout=layout)
+py.iplot(fig, filename='latex')
+
+ +
+
+
+ +
+
+ + +
+ +
Out[2]:
+ + + +
+ +
+ +
+ +
+
+ +
+ + +{% endraw %} \ No newline at end of file diff --git a/_posts/python/style/latex/latex-typesetting.ipynb b/_posts/python/style/latex/latex-typesetting.ipynb new file mode 100644 index 000000000000..716030b91f48 --- /dev/null +++ b/_posts/python/style/latex/latex-typesetting.ipynb @@ -0,0 +1,203 @@ +{ + "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 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.6.0'" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import plotly\n", + "plotly.__version__" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### LaTeX Typesetting" + ] + }, + { + "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=[1, 2, 3, 4],\n", + " y=[1, 4, 9, 16],\n", + " name=r'$\\alpha_{1c} = 352 \\pm 11 \\text{ km s}^{-1}$'\n", + ")\n", + "trace2 = go.Scatter(\n", + " x=[1, 2, 3, 4],\n", + " y=[0.5, 2, 4.5, 8],\n", + " name=r'$\\beta_{1c} = 25 \\pm 11 \\text{ km s}^{-1}$'\n", + ")\n", + "data = [trace1, trace2]\n", + "layout = go.Layout(\n", + " xaxis=dict(\n", + " title=r'$\\sqrt{(n_\\text{c}(t|{T_\\text{early}}))}$'\n", + " ),\n", + " yaxis=dict(\n", + " title=r'$d, r \\text{ (solar radius)}$'\n", + " )\n", + ")\n", + "fig = go.Figure(data=data, layout=layout)\n", + "py.iplot(fig, filename='latex')" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "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 c:\\users\\priyat~1\\appdata\\local\\temp\\pip-req-build-14xlc2tw\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\\PRIYAT~1\\AppData\\Local\\Temp\\pip-ephem-wheel-cache-qma0fxzy\\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" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "C:\\Anaconda\\Anaconda3\\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\\Anaconda3\\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(''))\n", + "display(HTML(''))\n", + "\n", + "! pip install git+https://github.com/plotly/publisher.git --upgrade\n", + "import publisher\n", + "publisher.publish(\n", + " 'latex-typesetting.ipynb', 'python/LaTeX/', 'LaTeX',\n", + " 'How to add LaTeX to python graphs.',\n", + " title = 'Python LaTeX | Examples | Plotly',\n", + " has_thumbnail='true', thumbnail='thumbnail/latex.jpg',\n", + " language='python',\n", + " display_as='style_opt', order=3, ipynb='~notebook_demo/268')" + ] + }, + { + "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.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}