|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "#### New to Plotly?\n", |
| 8 | + "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", |
| 9 | + "<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", |
| 10 | + "<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!" |
| 11 | + ] |
| 12 | + }, |
| 13 | + { |
| 14 | + "cell_type": "markdown", |
| 15 | + "metadata": {}, |
| 16 | + "source": [ |
| 17 | + "#### Version Check\n", |
| 18 | + "Plotly's python package is updated frequently. Run `pip install plotly --upgrade` to use the latest version." |
| 19 | + ] |
| 20 | + }, |
| 21 | + { |
| 22 | + "cell_type": "code", |
| 23 | + "execution_count": 1, |
| 24 | + "metadata": {}, |
| 25 | + "outputs": [ |
| 26 | + { |
| 27 | + "data": { |
| 28 | + "text/plain": [ |
| 29 | + "'3.6.0'" |
| 30 | + ] |
| 31 | + }, |
| 32 | + "execution_count": 1, |
| 33 | + "metadata": {}, |
| 34 | + "output_type": "execute_result" |
| 35 | + } |
| 36 | + ], |
| 37 | + "source": [ |
| 38 | + "import plotly\n", |
| 39 | + "plotly.__version__" |
| 40 | + ] |
| 41 | + }, |
| 42 | + { |
| 43 | + "cell_type": "markdown", |
| 44 | + "metadata": {}, |
| 45 | + "source": [ |
| 46 | + "#### LaTeX Typesetting" |
| 47 | + ] |
| 48 | + }, |
| 49 | + { |
| 50 | + "cell_type": "code", |
| 51 | + "execution_count": 2, |
| 52 | + "metadata": {}, |
| 53 | + "outputs": [ |
| 54 | + { |
| 55 | + "data": { |
| 56 | + "text/html": [ |
| 57 | + "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~PythonPlotBot/3193.embed\" height=\"525px\" width=\"100%\"></iframe>" |
| 58 | + ], |
| 59 | + "text/plain": [ |
| 60 | + "<plotly.tools.PlotlyDisplay object>" |
| 61 | + ] |
| 62 | + }, |
| 63 | + "execution_count": 2, |
| 64 | + "metadata": {}, |
| 65 | + "output_type": "execute_result" |
| 66 | + } |
| 67 | + ], |
| 68 | + "source": [ |
| 69 | + "import plotly.plotly as py\n", |
| 70 | + "import plotly.graph_objs as go\n", |
| 71 | + "\n", |
| 72 | + "trace1 = go.Scatter(\n", |
| 73 | + " x=[1, 2, 3, 4],\n", |
| 74 | + " y=[1, 4, 9, 16],\n", |
| 75 | + " name=r'$\\alpha_{1c} = 352 \\pm 11 \\text{ km s}^{-1}$'\n", |
| 76 | + ")\n", |
| 77 | + "trace2 = go.Scatter(\n", |
| 78 | + " x=[1, 2, 3, 4],\n", |
| 79 | + " y=[0.5, 2, 4.5, 8],\n", |
| 80 | + " name=r'$\\beta_{1c} = 25 \\pm 11 \\text{ km s}^{-1}$'\n", |
| 81 | + ")\n", |
| 82 | + "data = [trace1, trace2]\n", |
| 83 | + "layout = go.Layout(\n", |
| 84 | + " xaxis=dict(\n", |
| 85 | + " title=r'$\\sqrt{(n_\\text{c}(t|{T_\\text{early}}))}$'\n", |
| 86 | + " ),\n", |
| 87 | + " yaxis=dict(\n", |
| 88 | + " title=r'$d, r \\text{ (solar radius)}$'\n", |
| 89 | + " )\n", |
| 90 | + ")\n", |
| 91 | + "fig = go.Figure(data=data, layout=layout)\n", |
| 92 | + "py.iplot(fig, filename='latex')" |
| 93 | + ] |
| 94 | + }, |
| 95 | + { |
| 96 | + "cell_type": "code", |
| 97 | + "execution_count": 3, |
| 98 | + "metadata": {}, |
| 99 | + "outputs": [ |
| 100 | + { |
| 101 | + "data": { |
| 102 | + "text/html": [ |
| 103 | + "<link href=\"//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Inconsolata|Ubuntu+Mono:400,700\" rel=\"stylesheet\" type=\"text/css\" />" |
| 104 | + ], |
| 105 | + "text/plain": [ |
| 106 | + "<IPython.core.display.HTML object>" |
| 107 | + ] |
| 108 | + }, |
| 109 | + "metadata": {}, |
| 110 | + "output_type": "display_data" |
| 111 | + }, |
| 112 | + { |
| 113 | + "data": { |
| 114 | + "text/html": [ |
| 115 | + "<link rel=\"stylesheet\" type=\"text/css\" href=\"http://help.plot.ly/documentation/all_static/css/ipython-notebook-custom.css\">" |
| 116 | + ], |
| 117 | + "text/plain": [ |
| 118 | + "<IPython.core.display.HTML object>" |
| 119 | + ] |
| 120 | + }, |
| 121 | + "metadata": {}, |
| 122 | + "output_type": "display_data" |
| 123 | + }, |
| 124 | + { |
| 125 | + "name": "stdout", |
| 126 | + "output_type": "stream", |
| 127 | + "text": [ |
| 128 | + "Collecting git+https://github.com/plotly/publisher.git\n", |
| 129 | + " Cloning https://github.com/plotly/publisher.git to c:\\users\\priyat~1\\appdata\\local\\temp\\pip-req-build-14xlc2tw\n", |
| 130 | + "Building wheels for collected packages: publisher\n", |
| 131 | + " Running setup.py bdist_wheel for publisher: started\n", |
| 132 | + " Running setup.py bdist_wheel for publisher: finished with status 'done'\n", |
| 133 | + " Stored in directory: C:\\Users\\PRIYAT~1\\AppData\\Local\\Temp\\pip-ephem-wheel-cache-qma0fxzy\\wheels\\99\\3e\\a0\\fbd22ba24cca72bdbaba53dbc23c1768755fb17b3af0f33966\n", |
| 134 | + "Successfully built publisher\n", |
| 135 | + "Installing collected packages: publisher\n", |
| 136 | + " Found existing installation: publisher 0.13\n", |
| 137 | + " Uninstalling publisher-0.13:\n", |
| 138 | + " Successfully uninstalled publisher-0.13\n", |
| 139 | + "Successfully installed publisher-0.13\n" |
| 140 | + ] |
| 141 | + }, |
| 142 | + { |
| 143 | + "name": "stderr", |
| 144 | + "output_type": "stream", |
| 145 | + "text": [ |
| 146 | + "C:\\Anaconda\\Anaconda3\\lib\\site-packages\\IPython\\nbconvert.py:13: ShimWarning:\n", |
| 147 | + "\n", |
| 148 | + "The `IPython.nbconvert` package has been deprecated since IPython 4.0. You should import from nbconvert instead.\n", |
| 149 | + "\n", |
| 150 | + "C:\\Anaconda\\Anaconda3\\lib\\site-packages\\publisher\\publisher.py:53: UserWarning:\n", |
| 151 | + "\n", |
| 152 | + "Did you \"Save\" this notebook before running this command? Remember to save, always save.\n", |
| 153 | + "\n" |
| 154 | + ] |
| 155 | + } |
| 156 | + ], |
| 157 | + "source": [ |
| 158 | + "from IPython.display import display, HTML\n", |
| 159 | + "\n", |
| 160 | + "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", |
| 161 | + "display(HTML('<link rel=\"stylesheet\" type=\"text/css\" href=\"http://help.plot.ly/documentation/all_static/css/ipython-notebook-custom.css\">'))\n", |
| 162 | + "\n", |
| 163 | + "! pip install git+https://github.com/plotly/publisher.git --upgrade\n", |
| 164 | + "import publisher\n", |
| 165 | + "publisher.publish(\n", |
| 166 | + " 'latex-typesetting.ipynb', 'python/LaTeX/', 'LaTeX',\n", |
| 167 | + " 'How to add LaTeX to python graphs.',\n", |
| 168 | + " title = 'Python LaTeX | Examples | Plotly',\n", |
| 169 | + " has_thumbnail='true', thumbnail='thumbnail/latex.jpg',\n", |
| 170 | + " language='python',\n", |
| 171 | + " display_as='style_opt', order=3, ipynb='~notebook_demo/268')" |
| 172 | + ] |
| 173 | + }, |
| 174 | + { |
| 175 | + "cell_type": "code", |
| 176 | + "execution_count": null, |
| 177 | + "metadata": {}, |
| 178 | + "outputs": [], |
| 179 | + "source": [] |
| 180 | + } |
| 181 | + ], |
| 182 | + "metadata": { |
| 183 | + "kernelspec": { |
| 184 | + "display_name": "Python 3", |
| 185 | + "language": "python", |
| 186 | + "name": "python3" |
| 187 | + }, |
| 188 | + "language_info": { |
| 189 | + "codemirror_mode": { |
| 190 | + "name": "ipython", |
| 191 | + "version": 3 |
| 192 | + }, |
| 193 | + "file_extension": ".py", |
| 194 | + "mimetype": "text/x-python", |
| 195 | + "name": "python", |
| 196 | + "nbconvert_exporter": "python", |
| 197 | + "pygments_lexer": "ipython3", |
| 198 | + "version": "3.7.1" |
| 199 | + } |
| 200 | + }, |
| 201 | + "nbformat": 4, |
| 202 | + "nbformat_minor": 2 |
| 203 | +} |
0 commit comments