{ "cells": [ { "cell_type": "markdown", "id": "860a082c", "metadata": {}, "source": [ "# Plotly 水平线、垂线和矩形\n", "\n", "参考:[Horizontal and Vertical Lines and Rectangles | Python | Plotly](https://plotly.com/python/horizontal-vertical-shapes/)\n", "\n", "*在 plotly 4.12 中引入*\n", "\n", "可以通过 `plotly.graph_objects.Figure` 的 `add_hline`, `add_vline`, `add_hrect`, 和 `add_vrect` 方法添加横跨整个 plot 的水平线、垂线和矩形。这些形状固定在一个轴的端点上,而不管绘图的范围如何,固定在另一个轴上的数据坐标上。下面展示了一些可能性,尝试平移和缩放结果图,看看形状如何粘在一些轴上:" ] }, { "cell_type": "code", "execution_count": 1, "id": "3f5c7860", "metadata": {}, "outputs": [], "source": [ "import plotly.graph_objects as go\n", "go.FigureWidget(); # 初始化" ] }, { "cell_type": "code", "execution_count": 2, "id": "9a58675c", "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "petal_length=%{x}
petal_width=%{y}", "legendgroup": "", "marker": { "color": "#636efa", "symbol": "circle" }, "mode": "markers", "name": "", "orientation": "v", "showlegend": false, "type": "scatter", "x": [ 1.4, 1.4, 1.3, 1.5, 1.4, 1.7, 1.4, 1.5, 1.4, 1.5, 1.5, 1.6, 1.4, 1.1, 1.2, 1.5, 1.3, 1.4, 1.7, 1.5, 1.7, 1.5, 1, 1.7, 1.9, 1.6, 1.6, 1.5, 1.4, 1.6, 1.6, 1.5, 1.5, 1.4, 1.5, 1.2, 1.3, 1.5, 1.3, 1.5, 1.3, 1.3, 1.3, 1.6, 1.9, 1.4, 1.6, 1.4, 1.5, 1.4, 4.7, 4.5, 4.9, 4, 4.6, 4.5, 4.7, 3.3, 4.6, 3.9, 3.5, 4.2, 4, 4.7, 3.6, 4.4, 4.5, 4.1, 4.5, 3.9, 4.8, 4, 4.9, 4.7, 4.3, 4.4, 4.8, 5, 4.5, 3.5, 3.8, 3.7, 3.9, 5.1, 4.5, 4.5, 4.7, 4.4, 4.1, 4, 4.4, 4.6, 4, 3.3, 4.2, 4.2, 4.2, 4.3, 3, 4.1, 6, 5.1, 5.9, 5.6, 5.8, 6.6, 4.5, 6.3, 5.8, 6.1, 5.1, 5.3, 5.5, 5, 5.1, 5.3, 5.5, 6.7, 6.9, 5, 5.7, 4.9, 6.7, 4.9, 5.7, 6, 4.8, 4.9, 5.6, 5.8, 6.1, 6.4, 5.6, 5.1, 5.6, 6.1, 5.6, 5.5, 4.8, 5.4, 5.6, 5.1, 5.1, 5.9, 5.7, 5.2, 5, 5.2, 5.4, 5.1 ], "xaxis": "x", "y": [ 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.2, 0.4, 0.4, 0.3, 0.3, 0.3, 0.2, 0.4, 0.2, 0.5, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4, 0.1, 0.2, 0.1, 0.2, 0.2, 0.1, 0.2, 0.2, 0.3, 0.3, 0.2, 0.6, 0.4, 0.3, 0.2, 0.2, 0.2, 0.2, 1.4, 1.5, 1.5, 1.3, 1.5, 1.3, 1.6, 1, 1.3, 1.4, 1, 1.5, 1, 1.4, 1.3, 1.4, 1.5, 1, 1.5, 1.1, 1.8, 1.3, 1.5, 1.2, 1.3, 1.4, 1.4, 1.7, 1.5, 1, 1.1, 1, 1.2, 1.6, 1.5, 1.6, 1.5, 1.3, 1.3, 1.3, 1.2, 1.4, 1.2, 1, 1.3, 1.2, 1.3, 1.3, 1.1, 1.3, 2.5, 1.9, 2.1, 1.8, 2.2, 2.1, 1.7, 1.8, 1.8, 2.5, 2, 1.9, 2.1, 2, 2.4, 2.3, 1.8, 2.2, 2.3, 1.5, 2.3, 2, 2, 1.8, 2.1, 1.8, 1.8, 1.8, 2.1, 1.6, 1.9, 2, 2.2, 1.5, 1.4, 2.3, 2.4, 1.8, 1.8, 2.1, 2.4, 2.3, 1.9, 2.3, 2.5, 2.3, 1.9, 2, 2.3, 1.8 ], "yaxis": "y" } ], "layout": { "legend": { "tracegroupgap": 0 }, "margin": { "t": 60 }, "shapes": [ { "type": "line", "x0": 0, "x1": 1, "xref": "x domain", "y0": 0.9, "y1": 0.9, "yref": "y" }, { "type": "rect", "x0": 0.9, "x1": 2, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" } ], "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "petal_length" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "petal_width" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import plotly.express as px\n", "\n", "df = px.data.iris()\n", "fig = px.scatter(df, x=\"petal_length\", y=\"petal_width\")\n", "fig.add_hline(y=0.9)\n", "fig.add_vrect(x0=0.9, x1=2)\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "c55b8088", "metadata": {}, "source": [ "这些形状可以通过传递和 `add_shape` 相同参数来设置样式:" ] }, { "cell_type": "code", "execution_count": 3, "id": "cddbae1d", "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "petal_length=%{x}
petal_width=%{y}", "legendgroup": "", "marker": { "color": "#636efa", "symbol": "circle" }, "mode": "markers", "name": "", "orientation": "v", "showlegend": false, "type": "scatter", "x": [ 1.4, 1.4, 1.3, 1.5, 1.4, 1.7, 1.4, 1.5, 1.4, 1.5, 1.5, 1.6, 1.4, 1.1, 1.2, 1.5, 1.3, 1.4, 1.7, 1.5, 1.7, 1.5, 1, 1.7, 1.9, 1.6, 1.6, 1.5, 1.4, 1.6, 1.6, 1.5, 1.5, 1.4, 1.5, 1.2, 1.3, 1.5, 1.3, 1.5, 1.3, 1.3, 1.3, 1.6, 1.9, 1.4, 1.6, 1.4, 1.5, 1.4, 4.7, 4.5, 4.9, 4, 4.6, 4.5, 4.7, 3.3, 4.6, 3.9, 3.5, 4.2, 4, 4.7, 3.6, 4.4, 4.5, 4.1, 4.5, 3.9, 4.8, 4, 4.9, 4.7, 4.3, 4.4, 4.8, 5, 4.5, 3.5, 3.8, 3.7, 3.9, 5.1, 4.5, 4.5, 4.7, 4.4, 4.1, 4, 4.4, 4.6, 4, 3.3, 4.2, 4.2, 4.2, 4.3, 3, 4.1, 6, 5.1, 5.9, 5.6, 5.8, 6.6, 4.5, 6.3, 5.8, 6.1, 5.1, 5.3, 5.5, 5, 5.1, 5.3, 5.5, 6.7, 6.9, 5, 5.7, 4.9, 6.7, 4.9, 5.7, 6, 4.8, 4.9, 5.6, 5.8, 6.1, 6.4, 5.6, 5.1, 5.6, 6.1, 5.6, 5.5, 4.8, 5.4, 5.6, 5.1, 5.1, 5.9, 5.7, 5.2, 5, 5.2, 5.4, 5.1 ], "xaxis": "x", "y": [ 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.2, 0.4, 0.4, 0.3, 0.3, 0.3, 0.2, 0.4, 0.2, 0.5, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4, 0.1, 0.2, 0.1, 0.2, 0.2, 0.1, 0.2, 0.2, 0.3, 0.3, 0.2, 0.6, 0.4, 0.3, 0.2, 0.2, 0.2, 0.2, 1.4, 1.5, 1.5, 1.3, 1.5, 1.3, 1.6, 1, 1.3, 1.4, 1, 1.5, 1, 1.4, 1.3, 1.4, 1.5, 1, 1.5, 1.1, 1.8, 1.3, 1.5, 1.2, 1.3, 1.4, 1.4, 1.7, 1.5, 1, 1.1, 1, 1.2, 1.6, 1.5, 1.6, 1.5, 1.3, 1.3, 1.3, 1.2, 1.4, 1.2, 1, 1.3, 1.2, 1.3, 1.3, 1.1, 1.3, 2.5, 1.9, 2.1, 1.8, 2.2, 2.1, 1.7, 1.8, 1.8, 2.5, 2, 1.9, 2.1, 2, 2.4, 2.3, 1.8, 2.2, 2.3, 1.5, 2.3, 2, 2, 1.8, 2.1, 1.8, 1.8, 1.8, 2.1, 1.6, 1.9, 2, 2.2, 1.5, 1.4, 2.3, 2.4, 1.8, 1.8, 2.1, 2.4, 2.3, 1.9, 2.3, 2.5, 2.3, 1.9, 2, 2.3, 1.8 ], "yaxis": "y" } ], "layout": { "legend": { "tracegroupgap": 0 }, "margin": { "t": 60 }, "shapes": [ { "line": { "color": "green", "dash": "dash", "width": 3 }, "type": "line", "x0": 2.5, "x1": 2.5, "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "fillcolor": "red", "line": { "width": 0 }, "opacity": 0.2, "type": "rect", "x0": 0, "x1": 1, "xref": "x domain", "y0": 0.9, "y1": 2.6, "yref": "y" } ], "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "petal_length" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "petal_width" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import plotly.express as px\n", "\n", "df = px.data.iris()\n", "fig = px.scatter(df, x=\"petal_length\", y=\"petal_width\")\n", "fig.add_vline(x=2.5, line_width=3, line_dash=\"dash\", line_color=\"green\")\n", "fig.add_hrect(y0=0.9, y1=2.6, line_width=0, fillcolor=\"red\", opacity=0.2)\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "102c50c9", "metadata": {}, "source": [ "## 添加文本注释\n", "\n", "[](plotly:text-and-annotations) 可以选择使用 `annotation_text` 关键字参数添加到 autoshape,并使用 `annotation_position` 参数定位:" ] }, { "cell_type": "code", "execution_count": 5, "id": "8fdc41a3", "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "company=GOOG
date=%{x}
value=%{y}", "legendgroup": "GOOG", "line": { "color": "#636efa", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "GOOG", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x", "y": [ 1, 1.018172278347936, 1.032007866452698, 1.066782783389724, 1.0087731636550117, 0.9415276737437316, 0.99325918262539, 1.0222821547641083, 0.9788520214265992, 1.0524482730908842, 1.0303929312465263, 0.926821104067592, 0.9360932452590338, 0.913638710861412, 0.93380695379017, 0.9734447261178653, 0.9345146364100892, 0.9509902470625956, 0.9963982380519172, 0.9674568868105002, 0.9758943718805396, 1.015668254641377, 1.0169111849053498, 1.0453898287179595, 1.0483111519067918, 1.0121753574512644, 1.0344211867653972, 1.0785588920381208, 1.075011617811375, 1.1236312044424703, 1.1102129167272332, 1.1228237368393843, 1.0895729410299655, 1.1074367837463466, 1.1052048693141154, 1.0567939333314087, 1.0637798374890872, 1.0579370795194665, 1.0827776350267664, 1.0500077089175164, 1.007121903906116, 0.9947651405743836, 0.9720929301886708, 0.959681788913054, 0.9672663993407256, 0.9630385756700248, 0.9289168536315806, 0.992923504040418, 0.9404389054995582, 0.945446952912676, 0.8886892896888904, 0.9408925313390586, 0.9714034098401132, 0.9591373489949891, 0.9963982380519172, 0.989802500200548, 1.0077298024501202, 0.9934950771344468, 1.0103608540932627, 1.0073850422758417, 1.035165084150587, 1.0363716889645844, 1.0746032883264525, 1.0936918990354445, 1.064487521016258, 1.095188886079836, 1.1049145977684258, 1.1216987538299403, 1.1541874899828073, 1.075456162061569, 1.0562859304552756, 1.0544986709579427, 1.0283425342867192, 1.001270175031893, 0.9671666152648106, 0.98468558802946, 1.0178275181736574, 0.980657443195294, 1.0266368965939394, 1.0387124690620373, 1.025285100664745, 1.1344366027859267, 1.0832494231376286, 1.0778240762422375, 1.068379555417282, 1.0445098208996275, 1.0779056980467905, 1.0931748145700046, 1.12459294475006, 1.115856106545024, 1.1114649285805127, 1.0968672799119472, 1.10271900878617, 1.129972884606169, 1.1477913211905195, 1.155602744537941, 1.189742629754999, 1.2110630442115171, 1.1751993590303178, 1.183927115646047, 1.216279741365772, 1.222820990588552, 1.22441776261611, 1.2265044859331442, 1.213013658002661 ], "yaxis": "y" }, { "hovertemplate": "company=AAPL
date=%{x}
value=%{y}", "legendgroup": "AAPL", "line": { "color": "#EF553B", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "AAPL", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x", "y": [ 1, 1.0119428342857142, 1.0197714685714288, 0.9800571142857144, 0.9171428571428571, 0.8937714514285715, 0.9853142457142856, 1.002857142857143, 1.006914325714286, 1.02845712, 1.0172571657142857, 0.9425142971428572, 0.9587428514285714, 0.9621714571428572, 0.99845712, 0.9469714342857144, 0.9275428971428572, 1.0504571542857144, 1.07765712, 1.06462856, 1.0776000114285715, 1.0870857428571428, 1.0954285542857145, 1.0790856914285714, 1.0566857028571428, 1.0577714342857143, 1.0741142914285715, 1.093314297142857, 1.0939428685714283, 1.0913142628571428, 1.1885143142857142, 1.1858857085714285, 1.2433142971428572, 1.235200022857143, 1.3007428857142855, 1.2645714457142856, 1.279085691428571, 1.2437714514285716, 1.2899428857142856, 1.2816571028571428, 1.2692000057142856, 1.253199988571429, 1.236000017142857, 1.1855999771428571, 1.1684000057142856, 1.1058857085714286, 0.9845142457142856, 1.0204571542857144, 0.9628000285714284, 0.9455999771428572, 0.8613142628571429, 0.8927428342857143, 0.8471999714285714, 0.8702285314285714, 0.8961143257142857, 0.9014856857142858, 0.95154288, 0.9737714514285716, 0.97382856, 0.9884000057142855, 0.9998285771428572, 0.9880571657142858, 1.0635428285714286, 1.0917143028571428, 1.0854285542857145, 1.1257142857142857, 1.1363999714285713, 1.1649142914285715, 1.1674285885714286, 1.21, 1.126742817142857, 1.08, 1.02268572, 1.00040004, 1.0865713942857145, 1.1013714571428572, 1.135885708571429, 1.130971417142857, 1.167028548571429, 1.1617143028571428, 1.15765712, 1.1870857428571429, 1.1658285942857145, 1.1485143142857142, 1.18, 1.1579428514285717, 1.1928000285714286, 1.218628542857143, 1.25, 1.2441714057142856, 1.25040004, 1.2971999714285716, 1.3497714685714286, 1.3509143085714286, 1.409028582857143, 1.4618286114285712, 1.4865143714285716, 1.5186286285714288, 1.4958857085714288, 1.5271428571428571, 1.5469142342857145, 1.57228568, 1.5968000114285714, 1.6559999314285714, 1.6779999657142857 ], "yaxis": "y" }, { "hovertemplate": "company=AMZN
date=%{x}
value=%{y}", "legendgroup": "AMZN", "line": { "color": "#00cc96", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "AMZN", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x", "y": [ 1, 1.0618806117055757, 1.0532404284307677, 1.1406756202628388, 1.1633743377885228, 1.0898676795580526, 1.1786207619316666, 1.2203654438831366, 1.2205688381237838, 1.284548542665418, 1.2786826844946546, 1.2167532101702832, 1.1775224533715958, 1.1432627388670606, 1.16405781403187, 1.242730666448932, 1.2794473988384474, 1.2862244591394254, 1.3040906767647622, 1.2808711585229775, 1.3099809658381354, 1.3355191588974509, 1.3700554610940725, 1.3960736368996989, 1.3958296232020404, 1.3829181608736414, 1.391729163581091, 1.4750394640760272, 1.4755844971819587, 1.4784890230752108, 1.4833867718479574, 1.5346502643964448, 1.5313308069300795, 1.5501814209506477, 1.637494456642517, 1.5881591374274802, 1.6029011479217037, 1.5580080272628667, 1.6295946560652816, 1.5373757268816928, 1.4551718788522234, 1.435174192909178, 1.3365524179114776, 1.3550368620941855, 1.3931936419790223, 1.2963616956201691, 1.22204146042711, 1.375083410656027, 1.3254226411301075, 1.295141330176286, 1.1206615472526131, 1.202483038516975, 1.2817010232963573, 1.334721869745653, 1.3799892040777797, 1.359137222458745, 1.3230632475991762, 1.2921391799289847, 1.3081910371293215, 1.3273996770823542, 1.3600809993969647, 1.3186455808291295, 1.393136635454831, 1.435776232539301, 1.4487771761299302, 1.4947687054188046, 1.4994712046698764, 1.5146280474808236, 1.5869876346023932, 1.596612214272432, 1.537644171481961, 1.5205753430783882, 1.483378627942562, 1.44415601504927, 1.4677172714127285, 1.521120475440709, 1.5549896884611636, 1.540613747734834, 1.58070684404494, 1.6361032717659916, 1.5982882308164057, 1.5808207570233568, 1.4833460531345568, 1.4706054102388, 1.4583936118945735, 1.4234505212166575, 1.445148654606286, 1.491701504811883, 1.4964446227063888, 1.4596872708598625, 1.4037863302335007, 1.4153391824933792, 1.4090502488441077, 1.4298696556551374, 1.43297747571907, 1.4574742658589632, 1.452950830015895, 1.4152089825177483, 1.420277551536714, 1.465089434095106, 1.425061388144621, 1.4326601685000062, 1.4534552436648156, 1.52122624451373, 1.503360026888393 ], "yaxis": "y" }, { "hovertemplate": "company=FB
date=%{x}
value=%{y}", "legendgroup": "FB", "line": { "color": "#ab63fa", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "FB", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x", "y": [ 1, 0.9599678310954936, 0.9702434422185674, 1.0168584099483515, 1.0183569327795472, 0.9425207136466456, 0.949210571606832, 0.9809472149548658, 0.9452501435830832, 0.9913298905647344, 0.9905806264731936, 0.8530371628674177, 0.8551778853033591, 0.8413165210173983, 0.8804923666954552, 0.8899116599439659, 0.9290339332394776, 0.9451966568307202, 1.0007492587396545, 0.9776825642702948, 0.9896708164943808, 1.038212463316699, 1.0120417443283358, 1.048166977313343, 1.0796895826698554, 1.039978596521961, 1.0876638451914205, 1.109553119307901, 1.12357503483302, 0.9359914015737306, 0.951458353177682, 0.9647310099631464, 0.9301578668399936, 0.934706922085943, 0.940486970067317, 0.8725715159998442, 0.868718232741186, 0.8719828084993478, 0.8801712695690254, 0.8420122930046896, 0.822799036998693, 0.8244581110690464, 0.7780036945784202, 0.8046561475625534, 0.7758094853901156, 0.7467486995959743, 0.7050039698687512, 0.7525287475773482, 0.735456214007293, 0.7709927394918039, 0.668718185644586, 0.712871248181817, 0.7382927084305257, 0.769601275795517, 0.8029969932139043, 0.7974845609584834, 0.8868611275292119, 0.8955311566861818, 0.8696815348242483, 0.8664168787877908, 0.8685041144713691, 0.907679960149426, 0.8883060779778621, 0.8795289843340972, 0.8921059494105662, 0.9404334779630672, 0.9585228806468435, 0.9541342963617566, 1.024832747396326, 1.0461332337340143, 1.0079742571696786, 0.9917045600737096, 0.9690125351133252, 0.9497992791073284, 0.9277495340299856, 0.9704575658402708, 1.0229595550561554, 1.0329140690527994, 1.0511104505931883, 1.0964409334832987, 1.0616001853379655, 1.0690393020378066, 1.011613582715111, 1.0053518863681492, 0.9831415097733526, 0.951297801938524, 0.993684731270493, 1.003425201923729, 1.0018196199576253, 1.0164837404393767, 0.9478191079105452, 0.9657478790768677, 0.9857639608531776, 0.9946481136318508, 1.0055659243596704, 1.03623221184162, 1.0213539730900516, 1.044153062537231, 1.0640620851786324, 1.0791543619217223, 1.07599677037206, 1.0388546682733315, 1.104094173804843, 1.113727585323171, 1.0984746770626277 ], "yaxis": "y" }, { "hovertemplate": "company=NFLX
date=%{x}
value=%{y}", "legendgroup": "NFLX", "line": { "color": "#FFA15A", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "NFLX", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x", "y": [ 1, 1.0535263142643383, 1.0498595254569378, 1.3076813155940448, 1.273536771428717, 1.188008929282134, 1.3263487897912096, 1.3616362026373592, 1.4336396058469547, 1.5783608462698024, 1.5165008067883996, 1.4331158380609592, 1.406495542490225, 1.375541688281783, 1.484118227436587, 1.5608837620628662, 1.484642138086525, 1.5243106261176576, 1.5546453794312736, 1.5437877293254985, 1.6728891882258874, 1.7140339274719294, 1.7170817582484463, 1.866660325094997, 1.9576645850358447, 1.864041067097456, 1.94414015086099, 1.884851557577705, 1.7193674908479577, 1.691556657660921, 1.633839648701375, 1.647078369277624, 1.50854798541483, 1.7087480282692504, 1.7509404459512254, 1.660459949034241, 1.7360826197418304, 1.720034255916133, 1.7816562507344105, 1.6731749018244944, 1.617029334324746, 1.5842183202957685, 1.4278298007564696, 1.4719748494696214, 1.4451640257830367, 1.3629695899097676, 1.2325348866009125, 1.3625886860662726, 1.262631595251403, 1.2707271281792676, 1.1733415549944868, 1.2194865512765718, 1.4170674789973934, 1.6076479259096166, 1.6148387919701228, 1.6098384682642397, 1.6184103905326357, 1.6551740498315624, 1.699461814861141, 1.7287488945009553, 1.7016048311442251, 1.6648411718452985, 1.721319979015192, 1.7191771103581814, 1.6979855684083631, 1.7405113638622944, 1.6721748970861734, 1.716034084574645, 1.7850849901165535, 1.8335634546034707, 1.7193199695385504, 1.6879375377890014, 1.6876518241903944, 1.6347444679569396, 1.7185103405278743, 1.6178389585732904, 1.758226497494488, 1.7492261453110591, 1.8122290534732837, 1.7774655512770718, 1.5005476379697218, 1.5990284823318142, 1.518310297673454, 1.471165225221077, 1.4419733358261506, 1.3878755896024673, 1.398876103650743, 1.381827735086725, 1.400780927644628, 1.2893470810670251, 1.2528214711933554, 1.299061872016242, 1.347349808387309, 1.3110147218673576, 1.3182532521012131, 1.3658269020946976, 1.388494690497293, 1.4049716271019663, 1.4785466146353017, 1.4984522906221185, 1.4636411194904255, 1.421496227879989, 1.6043620457078422, 1.567169808867808, 1.5408828958311611 ], "yaxis": "y" }, { "hovertemplate": "company=MSFT
date=%{x}
value=%{y}", "legendgroup": "MSFT", "line": { "color": "#19d3f3", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "MSFT", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x", "y": [ 1, 1.015988161560536, 1.0205238457756245, 1.0665607876956391, 1.040707528275144, 0.9998865857832728, 1.043202153459527, 1.0665607876956391, 1.0551082990110374, 1.0946819232411402, 1.072683930770293, 0.9885474319413214, 1.034924537137441, 1.0231318851767346, 1.0554484622871425, 1.0772196149853812, 1.0865177211357813, 1.0790339249567087, 1.1078352963411884, 1.0926408755495889, 1.1153191832334917, 1.1428733270694336, 1.1523981709400573, 1.1353894401771305, 1.1385644826269534, 1.1181539716939797, 1.147068848008417, 1.1954869895569342, 1.2050118447667115, 1.2210000857013248, 1.225082192423581, 1.2359677687727004, 1.2198661929954373, 1.2291642991458374, 1.2737271737447062, 1.227009825898405, 1.2855199050794894, 1.2956117406596723, 1.2968590589214408, 1.2714592862805467, 1.242431086462613, 1.2321125018230523, 1.2128358835959658, 1.203764617218174, 1.242431086462613, 1.2279169808840689, 1.1687265864899288, 1.2573987581948347, 1.1885701057133435, 1.2022904705229511, 1.1138451159123457, 1.1383376428543452, 1.1557999511101045, 1.1656650489700635, 1.2213402489774292, 1.2152170945636216, 1.1654382205366092, 1.1982083638006946, 1.2271232401151322, 1.2583059131804986, 1.275994970495635, 1.2530899137523548, 1.3143213671771998, 1.3272479912178707, 1.3373398267980536, 1.3594511427723972, 1.371470623166558, 1.398911443499003, 1.4728426811919109, 1.4616168621926098, 1.4415465939098175, 1.45220551191279, 1.4314547583296346, 1.4024265471725468, 1.489964746797488, 1.5018708923489987, 1.5531239130712344, 1.518993128041884, 1.5541444028995486, 1.5750084006121237, 1.5491551411916282, 1.6026759586647925, 1.5523300929282209, 1.5615149549492018, 1.5435990692006107, 1.5125297196387406, 1.5632157599905712, 1.5772763674503605, 1.5570926849508404, 1.581131634400008, 1.5617416132953483, 1.5661638719545554, 1.583852929269692, 1.5581131747791548, 1.5957590748212025, 1.629663201504406, 1.655062974145301, 1.7005329130166025, 1.6962239778608914, 1.7165211652903694, 1.720716595516122, 1.7522394318575931, 1.7848962516181823, 1.8024719740906685, 1.7881845268582712 ], "yaxis": "y" } ], "layout": { "annotations": [ { "showarrow": false, "text": "Jan 1, 2018 baseline", "x": 1, "xanchor": "right", "xref": "x domain", "y": 1, "yanchor": "top", "yref": "y" }, { "showarrow": false, "text": "decline", "x": "2018-09-24", "xanchor": "left", "xref": "x", "y": 1, "yanchor": "top", "yref": "y domain" } ], "legend": { "title": { "text": "company" }, "tracegroupgap": 0 }, "margin": { "t": 60 }, "shapes": [ { "line": { "dash": "dot" }, "type": "line", "x0": 0, "x1": 1, "xref": "x domain", "y0": 1, "y1": 1, "yref": "y" }, { "fillcolor": "green", "line": { "width": 0 }, "opacity": 0.25, "type": "rect", "x0": "2018-09-24", "x1": "2018-12-18", "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" } ], "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "date" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "value" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import plotly.express as px\n", "\n", "df = px.data.stocks(indexed=True)\n", "fig = px.line(df)\n", "fig.add_hline(y=1, line_dash=\"dot\",\n", " annotation_text=\"Jan 1, 2018 baseline\", \n", " annotation_position=\"bottom right\")\n", "fig.add_vrect(x0=\"2018-09-24\", x1=\"2018-12-18\", \n", " annotation_text=\"decline\", annotation_position=\"top left\",\n", " fillcolor=\"green\", opacity=0.25, line_width=0)\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "1dab47bb", "metadata": {}, "source": [ "注释的额外格式可以通过使用 `annotation_` 前缀的 magic-下划线或传递一个 `dict` 或 `go.layout.Annotation` 实例到 `annotation` 参数来完成:" ] }, { "cell_type": "code", "execution_count": 6, "id": "96b3c985", "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "company=GOOG
date=%{x}
value=%{y}", "legendgroup": "GOOG", "line": { "color": "#636efa", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "GOOG", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x", "y": [ 1, 1.018172278347936, 1.032007866452698, 1.066782783389724, 1.0087731636550117, 0.9415276737437316, 0.99325918262539, 1.0222821547641083, 0.9788520214265992, 1.0524482730908842, 1.0303929312465263, 0.926821104067592, 0.9360932452590338, 0.913638710861412, 0.93380695379017, 0.9734447261178653, 0.9345146364100892, 0.9509902470625956, 0.9963982380519172, 0.9674568868105002, 0.9758943718805396, 1.015668254641377, 1.0169111849053498, 1.0453898287179595, 1.0483111519067918, 1.0121753574512644, 1.0344211867653972, 1.0785588920381208, 1.075011617811375, 1.1236312044424703, 1.1102129167272332, 1.1228237368393843, 1.0895729410299655, 1.1074367837463466, 1.1052048693141154, 1.0567939333314087, 1.0637798374890872, 1.0579370795194665, 1.0827776350267664, 1.0500077089175164, 1.007121903906116, 0.9947651405743836, 0.9720929301886708, 0.959681788913054, 0.9672663993407256, 0.9630385756700248, 0.9289168536315806, 0.992923504040418, 0.9404389054995582, 0.945446952912676, 0.8886892896888904, 0.9408925313390586, 0.9714034098401132, 0.9591373489949891, 0.9963982380519172, 0.989802500200548, 1.0077298024501202, 0.9934950771344468, 1.0103608540932627, 1.0073850422758417, 1.035165084150587, 1.0363716889645844, 1.0746032883264525, 1.0936918990354445, 1.064487521016258, 1.095188886079836, 1.1049145977684258, 1.1216987538299403, 1.1541874899828073, 1.075456162061569, 1.0562859304552756, 1.0544986709579427, 1.0283425342867192, 1.001270175031893, 0.9671666152648106, 0.98468558802946, 1.0178275181736574, 0.980657443195294, 1.0266368965939394, 1.0387124690620373, 1.025285100664745, 1.1344366027859267, 1.0832494231376286, 1.0778240762422375, 1.068379555417282, 1.0445098208996275, 1.0779056980467905, 1.0931748145700046, 1.12459294475006, 1.115856106545024, 1.1114649285805127, 1.0968672799119472, 1.10271900878617, 1.129972884606169, 1.1477913211905195, 1.155602744537941, 1.189742629754999, 1.2110630442115171, 1.1751993590303178, 1.183927115646047, 1.216279741365772, 1.222820990588552, 1.22441776261611, 1.2265044859331442, 1.213013658002661 ], "yaxis": "y" }, { "hovertemplate": "company=AAPL
date=%{x}
value=%{y}", "legendgroup": "AAPL", "line": { "color": "#EF553B", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "AAPL", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x", "y": [ 1, 1.0119428342857142, 1.0197714685714288, 0.9800571142857144, 0.9171428571428571, 0.8937714514285715, 0.9853142457142856, 1.002857142857143, 1.006914325714286, 1.02845712, 1.0172571657142857, 0.9425142971428572, 0.9587428514285714, 0.9621714571428572, 0.99845712, 0.9469714342857144, 0.9275428971428572, 1.0504571542857144, 1.07765712, 1.06462856, 1.0776000114285715, 1.0870857428571428, 1.0954285542857145, 1.0790856914285714, 1.0566857028571428, 1.0577714342857143, 1.0741142914285715, 1.093314297142857, 1.0939428685714283, 1.0913142628571428, 1.1885143142857142, 1.1858857085714285, 1.2433142971428572, 1.235200022857143, 1.3007428857142855, 1.2645714457142856, 1.279085691428571, 1.2437714514285716, 1.2899428857142856, 1.2816571028571428, 1.2692000057142856, 1.253199988571429, 1.236000017142857, 1.1855999771428571, 1.1684000057142856, 1.1058857085714286, 0.9845142457142856, 1.0204571542857144, 0.9628000285714284, 0.9455999771428572, 0.8613142628571429, 0.8927428342857143, 0.8471999714285714, 0.8702285314285714, 0.8961143257142857, 0.9014856857142858, 0.95154288, 0.9737714514285716, 0.97382856, 0.9884000057142855, 0.9998285771428572, 0.9880571657142858, 1.0635428285714286, 1.0917143028571428, 1.0854285542857145, 1.1257142857142857, 1.1363999714285713, 1.1649142914285715, 1.1674285885714286, 1.21, 1.126742817142857, 1.08, 1.02268572, 1.00040004, 1.0865713942857145, 1.1013714571428572, 1.135885708571429, 1.130971417142857, 1.167028548571429, 1.1617143028571428, 1.15765712, 1.1870857428571429, 1.1658285942857145, 1.1485143142857142, 1.18, 1.1579428514285717, 1.1928000285714286, 1.218628542857143, 1.25, 1.2441714057142856, 1.25040004, 1.2971999714285716, 1.3497714685714286, 1.3509143085714286, 1.409028582857143, 1.4618286114285712, 1.4865143714285716, 1.5186286285714288, 1.4958857085714288, 1.5271428571428571, 1.5469142342857145, 1.57228568, 1.5968000114285714, 1.6559999314285714, 1.6779999657142857 ], "yaxis": "y" }, { "hovertemplate": "company=AMZN
date=%{x}
value=%{y}", "legendgroup": "AMZN", "line": { "color": "#00cc96", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "AMZN", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x", "y": [ 1, 1.0618806117055757, 1.0532404284307677, 1.1406756202628388, 1.1633743377885228, 1.0898676795580526, 1.1786207619316666, 1.2203654438831366, 1.2205688381237838, 1.284548542665418, 1.2786826844946546, 1.2167532101702832, 1.1775224533715958, 1.1432627388670606, 1.16405781403187, 1.242730666448932, 1.2794473988384474, 1.2862244591394254, 1.3040906767647622, 1.2808711585229775, 1.3099809658381354, 1.3355191588974509, 1.3700554610940725, 1.3960736368996989, 1.3958296232020404, 1.3829181608736414, 1.391729163581091, 1.4750394640760272, 1.4755844971819587, 1.4784890230752108, 1.4833867718479574, 1.5346502643964448, 1.5313308069300795, 1.5501814209506477, 1.637494456642517, 1.5881591374274802, 1.6029011479217037, 1.5580080272628667, 1.6295946560652816, 1.5373757268816928, 1.4551718788522234, 1.435174192909178, 1.3365524179114776, 1.3550368620941855, 1.3931936419790223, 1.2963616956201691, 1.22204146042711, 1.375083410656027, 1.3254226411301075, 1.295141330176286, 1.1206615472526131, 1.202483038516975, 1.2817010232963573, 1.334721869745653, 1.3799892040777797, 1.359137222458745, 1.3230632475991762, 1.2921391799289847, 1.3081910371293215, 1.3273996770823542, 1.3600809993969647, 1.3186455808291295, 1.393136635454831, 1.435776232539301, 1.4487771761299302, 1.4947687054188046, 1.4994712046698764, 1.5146280474808236, 1.5869876346023932, 1.596612214272432, 1.537644171481961, 1.5205753430783882, 1.483378627942562, 1.44415601504927, 1.4677172714127285, 1.521120475440709, 1.5549896884611636, 1.540613747734834, 1.58070684404494, 1.6361032717659916, 1.5982882308164057, 1.5808207570233568, 1.4833460531345568, 1.4706054102388, 1.4583936118945735, 1.4234505212166575, 1.445148654606286, 1.491701504811883, 1.4964446227063888, 1.4596872708598625, 1.4037863302335007, 1.4153391824933792, 1.4090502488441077, 1.4298696556551374, 1.43297747571907, 1.4574742658589632, 1.452950830015895, 1.4152089825177483, 1.420277551536714, 1.465089434095106, 1.425061388144621, 1.4326601685000062, 1.4534552436648156, 1.52122624451373, 1.503360026888393 ], "yaxis": "y" }, { "hovertemplate": "company=FB
date=%{x}
value=%{y}", "legendgroup": "FB", "line": { "color": "#ab63fa", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "FB", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x", "y": [ 1, 0.9599678310954936, 0.9702434422185674, 1.0168584099483515, 1.0183569327795472, 0.9425207136466456, 0.949210571606832, 0.9809472149548658, 0.9452501435830832, 0.9913298905647344, 0.9905806264731936, 0.8530371628674177, 0.8551778853033591, 0.8413165210173983, 0.8804923666954552, 0.8899116599439659, 0.9290339332394776, 0.9451966568307202, 1.0007492587396545, 0.9776825642702948, 0.9896708164943808, 1.038212463316699, 1.0120417443283358, 1.048166977313343, 1.0796895826698554, 1.039978596521961, 1.0876638451914205, 1.109553119307901, 1.12357503483302, 0.9359914015737306, 0.951458353177682, 0.9647310099631464, 0.9301578668399936, 0.934706922085943, 0.940486970067317, 0.8725715159998442, 0.868718232741186, 0.8719828084993478, 0.8801712695690254, 0.8420122930046896, 0.822799036998693, 0.8244581110690464, 0.7780036945784202, 0.8046561475625534, 0.7758094853901156, 0.7467486995959743, 0.7050039698687512, 0.7525287475773482, 0.735456214007293, 0.7709927394918039, 0.668718185644586, 0.712871248181817, 0.7382927084305257, 0.769601275795517, 0.8029969932139043, 0.7974845609584834, 0.8868611275292119, 0.8955311566861818, 0.8696815348242483, 0.8664168787877908, 0.8685041144713691, 0.907679960149426, 0.8883060779778621, 0.8795289843340972, 0.8921059494105662, 0.9404334779630672, 0.9585228806468435, 0.9541342963617566, 1.024832747396326, 1.0461332337340143, 1.0079742571696786, 0.9917045600737096, 0.9690125351133252, 0.9497992791073284, 0.9277495340299856, 0.9704575658402708, 1.0229595550561554, 1.0329140690527994, 1.0511104505931883, 1.0964409334832987, 1.0616001853379655, 1.0690393020378066, 1.011613582715111, 1.0053518863681492, 0.9831415097733526, 0.951297801938524, 0.993684731270493, 1.003425201923729, 1.0018196199576253, 1.0164837404393767, 0.9478191079105452, 0.9657478790768677, 0.9857639608531776, 0.9946481136318508, 1.0055659243596704, 1.03623221184162, 1.0213539730900516, 1.044153062537231, 1.0640620851786324, 1.0791543619217223, 1.07599677037206, 1.0388546682733315, 1.104094173804843, 1.113727585323171, 1.0984746770626277 ], "yaxis": "y" }, { "hovertemplate": "company=NFLX
date=%{x}
value=%{y}", "legendgroup": "NFLX", "line": { "color": "#FFA15A", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "NFLX", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x", "y": [ 1, 1.0535263142643383, 1.0498595254569378, 1.3076813155940448, 1.273536771428717, 1.188008929282134, 1.3263487897912096, 1.3616362026373592, 1.4336396058469547, 1.5783608462698024, 1.5165008067883996, 1.4331158380609592, 1.406495542490225, 1.375541688281783, 1.484118227436587, 1.5608837620628662, 1.484642138086525, 1.5243106261176576, 1.5546453794312736, 1.5437877293254985, 1.6728891882258874, 1.7140339274719294, 1.7170817582484463, 1.866660325094997, 1.9576645850358447, 1.864041067097456, 1.94414015086099, 1.884851557577705, 1.7193674908479577, 1.691556657660921, 1.633839648701375, 1.647078369277624, 1.50854798541483, 1.7087480282692504, 1.7509404459512254, 1.660459949034241, 1.7360826197418304, 1.720034255916133, 1.7816562507344105, 1.6731749018244944, 1.617029334324746, 1.5842183202957685, 1.4278298007564696, 1.4719748494696214, 1.4451640257830367, 1.3629695899097676, 1.2325348866009125, 1.3625886860662726, 1.262631595251403, 1.2707271281792676, 1.1733415549944868, 1.2194865512765718, 1.4170674789973934, 1.6076479259096166, 1.6148387919701228, 1.6098384682642397, 1.6184103905326357, 1.6551740498315624, 1.699461814861141, 1.7287488945009553, 1.7016048311442251, 1.6648411718452985, 1.721319979015192, 1.7191771103581814, 1.6979855684083631, 1.7405113638622944, 1.6721748970861734, 1.716034084574645, 1.7850849901165535, 1.8335634546034707, 1.7193199695385504, 1.6879375377890014, 1.6876518241903944, 1.6347444679569396, 1.7185103405278743, 1.6178389585732904, 1.758226497494488, 1.7492261453110591, 1.8122290534732837, 1.7774655512770718, 1.5005476379697218, 1.5990284823318142, 1.518310297673454, 1.471165225221077, 1.4419733358261506, 1.3878755896024673, 1.398876103650743, 1.381827735086725, 1.400780927644628, 1.2893470810670251, 1.2528214711933554, 1.299061872016242, 1.347349808387309, 1.3110147218673576, 1.3182532521012131, 1.3658269020946976, 1.388494690497293, 1.4049716271019663, 1.4785466146353017, 1.4984522906221185, 1.4636411194904255, 1.421496227879989, 1.6043620457078422, 1.567169808867808, 1.5408828958311611 ], "yaxis": "y" }, { "hovertemplate": "company=MSFT
date=%{x}
value=%{y}", "legendgroup": "MSFT", "line": { "color": "#19d3f3", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "MSFT", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x", "y": [ 1, 1.015988161560536, 1.0205238457756245, 1.0665607876956391, 1.040707528275144, 0.9998865857832728, 1.043202153459527, 1.0665607876956391, 1.0551082990110374, 1.0946819232411402, 1.072683930770293, 0.9885474319413214, 1.034924537137441, 1.0231318851767346, 1.0554484622871425, 1.0772196149853812, 1.0865177211357813, 1.0790339249567087, 1.1078352963411884, 1.0926408755495889, 1.1153191832334917, 1.1428733270694336, 1.1523981709400573, 1.1353894401771305, 1.1385644826269534, 1.1181539716939797, 1.147068848008417, 1.1954869895569342, 1.2050118447667115, 1.2210000857013248, 1.225082192423581, 1.2359677687727004, 1.2198661929954373, 1.2291642991458374, 1.2737271737447062, 1.227009825898405, 1.2855199050794894, 1.2956117406596723, 1.2968590589214408, 1.2714592862805467, 1.242431086462613, 1.2321125018230523, 1.2128358835959658, 1.203764617218174, 1.242431086462613, 1.2279169808840689, 1.1687265864899288, 1.2573987581948347, 1.1885701057133435, 1.2022904705229511, 1.1138451159123457, 1.1383376428543452, 1.1557999511101045, 1.1656650489700635, 1.2213402489774292, 1.2152170945636216, 1.1654382205366092, 1.1982083638006946, 1.2271232401151322, 1.2583059131804986, 1.275994970495635, 1.2530899137523548, 1.3143213671771998, 1.3272479912178707, 1.3373398267980536, 1.3594511427723972, 1.371470623166558, 1.398911443499003, 1.4728426811919109, 1.4616168621926098, 1.4415465939098175, 1.45220551191279, 1.4314547583296346, 1.4024265471725468, 1.489964746797488, 1.5018708923489987, 1.5531239130712344, 1.518993128041884, 1.5541444028995486, 1.5750084006121237, 1.5491551411916282, 1.6026759586647925, 1.5523300929282209, 1.5615149549492018, 1.5435990692006107, 1.5125297196387406, 1.5632157599905712, 1.5772763674503605, 1.5570926849508404, 1.581131634400008, 1.5617416132953483, 1.5661638719545554, 1.583852929269692, 1.5581131747791548, 1.5957590748212025, 1.629663201504406, 1.655062974145301, 1.7005329130166025, 1.6962239778608914, 1.7165211652903694, 1.720716595516122, 1.7522394318575931, 1.7848962516181823, 1.8024719740906685, 1.7881845268582712 ], "yaxis": "y" } ], "layout": { "annotations": [ { "font": { "color": "blue", "size": 20 }, "showarrow": false, "text": "Jan 1, 2018 baseline", "x": 1, "xanchor": "right", "xref": "x domain", "y": 1, "yanchor": "top", "yref": "y" }, { "font": { "family": "Times New Roman", "size": 20 }, "showarrow": false, "text": "decline", "x": "2018-09-24", "xanchor": "left", "xref": "x", "y": 1, "yanchor": "top", "yref": "y domain" } ], "legend": { "title": { "text": "company" }, "tracegroupgap": 0 }, "margin": { "t": 60 }, "shapes": [ { "line": { "dash": "dot" }, "type": "line", "x0": 0, "x1": 1, "xref": "x domain", "y0": 1, "y1": 1, "yref": "y" }, { "fillcolor": "green", "line": { "width": 0 }, "opacity": 0.25, "type": "rect", "x0": "2018-09-24", "x1": "2018-12-18", "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" } ], "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "date" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "value" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import plotly.express as px\n", "\n", "df = px.data.stocks(indexed=True)\n", "fig = px.line(df)\n", "fig.add_hline(y=1, line_dash=\"dot\",\n", " annotation_text=\"Jan 1, 2018 baseline\", \n", " annotation_position=\"bottom right\",\n", " annotation_font_size=20,\n", " annotation_font_color=\"blue\"\n", " )\n", "fig.add_vrect(x0=\"2018-09-24\", x1=\"2018-12-18\", \n", " annotation_text=\"decline\", annotation_position=\"top left\",\n", " annotation=dict(font_size=20, font_family=\"Times New Roman\"),\n", " fillcolor=\"green\", opacity=0.25, line_width=0)\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "729f6149", "metadata": {}, "source": [ "## 添加到多个层/子图\n", "\n", "通过将 `row` 和/或 `col` 设置为 `\"all\"` 来实现相同的行或框可以添加到多个 [](plotly:subplots) / {doc}`../statistical-charts/facet-plots`。默认的 `row` 和/或 `col` 值是 `\"all\"`。" ] }, { "cell_type": "code", "execution_count": 7, "id": "c755ea3d", "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "company=GOOG
date=%{x}
value=%{y}", "legendgroup": "GOOG", "line": { "color": "#636efa", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "GOOG", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x5", "y": [ 1, 1.018172278347936, 1.032007866452698, 1.066782783389724, 1.0087731636550117, 0.9415276737437316, 0.99325918262539, 1.0222821547641083, 0.9788520214265992, 1.0524482730908842, 1.0303929312465263, 0.926821104067592, 0.9360932452590338, 0.913638710861412, 0.93380695379017, 0.9734447261178653, 0.9345146364100892, 0.9509902470625956, 0.9963982380519172, 0.9674568868105002, 0.9758943718805396, 1.015668254641377, 1.0169111849053498, 1.0453898287179595, 1.0483111519067918, 1.0121753574512644, 1.0344211867653972, 1.0785588920381208, 1.075011617811375, 1.1236312044424703, 1.1102129167272332, 1.1228237368393843, 1.0895729410299655, 1.1074367837463466, 1.1052048693141154, 1.0567939333314087, 1.0637798374890872, 1.0579370795194665, 1.0827776350267664, 1.0500077089175164, 1.007121903906116, 0.9947651405743836, 0.9720929301886708, 0.959681788913054, 0.9672663993407256, 0.9630385756700248, 0.9289168536315806, 0.992923504040418, 0.9404389054995582, 0.945446952912676, 0.8886892896888904, 0.9408925313390586, 0.9714034098401132, 0.9591373489949891, 0.9963982380519172, 0.989802500200548, 1.0077298024501202, 0.9934950771344468, 1.0103608540932627, 1.0073850422758417, 1.035165084150587, 1.0363716889645844, 1.0746032883264525, 1.0936918990354445, 1.064487521016258, 1.095188886079836, 1.1049145977684258, 1.1216987538299403, 1.1541874899828073, 1.075456162061569, 1.0562859304552756, 1.0544986709579427, 1.0283425342867192, 1.001270175031893, 0.9671666152648106, 0.98468558802946, 1.0178275181736574, 0.980657443195294, 1.0266368965939394, 1.0387124690620373, 1.025285100664745, 1.1344366027859267, 1.0832494231376286, 1.0778240762422375, 1.068379555417282, 1.0445098208996275, 1.0779056980467905, 1.0931748145700046, 1.12459294475006, 1.115856106545024, 1.1114649285805127, 1.0968672799119472, 1.10271900878617, 1.129972884606169, 1.1477913211905195, 1.155602744537941, 1.189742629754999, 1.2110630442115171, 1.1751993590303178, 1.183927115646047, 1.216279741365772, 1.222820990588552, 1.22441776261611, 1.2265044859331442, 1.213013658002661 ], "yaxis": "y5" }, { "hovertemplate": "company=AAPL
date=%{x}
value=%{y}", "legendgroup": "AAPL", "line": { "color": "#EF553B", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "AAPL", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x6", "y": [ 1, 1.0119428342857142, 1.0197714685714288, 0.9800571142857144, 0.9171428571428571, 0.8937714514285715, 0.9853142457142856, 1.002857142857143, 1.006914325714286, 1.02845712, 1.0172571657142857, 0.9425142971428572, 0.9587428514285714, 0.9621714571428572, 0.99845712, 0.9469714342857144, 0.9275428971428572, 1.0504571542857144, 1.07765712, 1.06462856, 1.0776000114285715, 1.0870857428571428, 1.0954285542857145, 1.0790856914285714, 1.0566857028571428, 1.0577714342857143, 1.0741142914285715, 1.093314297142857, 1.0939428685714283, 1.0913142628571428, 1.1885143142857142, 1.1858857085714285, 1.2433142971428572, 1.235200022857143, 1.3007428857142855, 1.2645714457142856, 1.279085691428571, 1.2437714514285716, 1.2899428857142856, 1.2816571028571428, 1.2692000057142856, 1.253199988571429, 1.236000017142857, 1.1855999771428571, 1.1684000057142856, 1.1058857085714286, 0.9845142457142856, 1.0204571542857144, 0.9628000285714284, 0.9455999771428572, 0.8613142628571429, 0.8927428342857143, 0.8471999714285714, 0.8702285314285714, 0.8961143257142857, 0.9014856857142858, 0.95154288, 0.9737714514285716, 0.97382856, 0.9884000057142855, 0.9998285771428572, 0.9880571657142858, 1.0635428285714286, 1.0917143028571428, 1.0854285542857145, 1.1257142857142857, 1.1363999714285713, 1.1649142914285715, 1.1674285885714286, 1.21, 1.126742817142857, 1.08, 1.02268572, 1.00040004, 1.0865713942857145, 1.1013714571428572, 1.135885708571429, 1.130971417142857, 1.167028548571429, 1.1617143028571428, 1.15765712, 1.1870857428571429, 1.1658285942857145, 1.1485143142857142, 1.18, 1.1579428514285717, 1.1928000285714286, 1.218628542857143, 1.25, 1.2441714057142856, 1.25040004, 1.2971999714285716, 1.3497714685714286, 1.3509143085714286, 1.409028582857143, 1.4618286114285712, 1.4865143714285716, 1.5186286285714288, 1.4958857085714288, 1.5271428571428571, 1.5469142342857145, 1.57228568, 1.5968000114285714, 1.6559999314285714, 1.6779999657142857 ], "yaxis": "y6" }, { "hovertemplate": "company=AMZN
date=%{x}
value=%{y}", "legendgroup": "AMZN", "line": { "color": "#00cc96", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "AMZN", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x3", "y": [ 1, 1.0618806117055757, 1.0532404284307677, 1.1406756202628388, 1.1633743377885228, 1.0898676795580526, 1.1786207619316666, 1.2203654438831366, 1.2205688381237838, 1.284548542665418, 1.2786826844946546, 1.2167532101702832, 1.1775224533715958, 1.1432627388670606, 1.16405781403187, 1.242730666448932, 1.2794473988384474, 1.2862244591394254, 1.3040906767647622, 1.2808711585229775, 1.3099809658381354, 1.3355191588974509, 1.3700554610940725, 1.3960736368996989, 1.3958296232020404, 1.3829181608736414, 1.391729163581091, 1.4750394640760272, 1.4755844971819587, 1.4784890230752108, 1.4833867718479574, 1.5346502643964448, 1.5313308069300795, 1.5501814209506477, 1.637494456642517, 1.5881591374274802, 1.6029011479217037, 1.5580080272628667, 1.6295946560652816, 1.5373757268816928, 1.4551718788522234, 1.435174192909178, 1.3365524179114776, 1.3550368620941855, 1.3931936419790223, 1.2963616956201691, 1.22204146042711, 1.375083410656027, 1.3254226411301075, 1.295141330176286, 1.1206615472526131, 1.202483038516975, 1.2817010232963573, 1.334721869745653, 1.3799892040777797, 1.359137222458745, 1.3230632475991762, 1.2921391799289847, 1.3081910371293215, 1.3273996770823542, 1.3600809993969647, 1.3186455808291295, 1.393136635454831, 1.435776232539301, 1.4487771761299302, 1.4947687054188046, 1.4994712046698764, 1.5146280474808236, 1.5869876346023932, 1.596612214272432, 1.537644171481961, 1.5205753430783882, 1.483378627942562, 1.44415601504927, 1.4677172714127285, 1.521120475440709, 1.5549896884611636, 1.540613747734834, 1.58070684404494, 1.6361032717659916, 1.5982882308164057, 1.5808207570233568, 1.4833460531345568, 1.4706054102388, 1.4583936118945735, 1.4234505212166575, 1.445148654606286, 1.491701504811883, 1.4964446227063888, 1.4596872708598625, 1.4037863302335007, 1.4153391824933792, 1.4090502488441077, 1.4298696556551374, 1.43297747571907, 1.4574742658589632, 1.452950830015895, 1.4152089825177483, 1.420277551536714, 1.465089434095106, 1.425061388144621, 1.4326601685000062, 1.4534552436648156, 1.52122624451373, 1.503360026888393 ], "yaxis": "y3" }, { "hovertemplate": "company=FB
date=%{x}
value=%{y}", "legendgroup": "FB", "line": { "color": "#ab63fa", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "FB", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x4", "y": [ 1, 0.9599678310954936, 0.9702434422185674, 1.0168584099483515, 1.0183569327795472, 0.9425207136466456, 0.949210571606832, 0.9809472149548658, 0.9452501435830832, 0.9913298905647344, 0.9905806264731936, 0.8530371628674177, 0.8551778853033591, 0.8413165210173983, 0.8804923666954552, 0.8899116599439659, 0.9290339332394776, 0.9451966568307202, 1.0007492587396545, 0.9776825642702948, 0.9896708164943808, 1.038212463316699, 1.0120417443283358, 1.048166977313343, 1.0796895826698554, 1.039978596521961, 1.0876638451914205, 1.109553119307901, 1.12357503483302, 0.9359914015737306, 0.951458353177682, 0.9647310099631464, 0.9301578668399936, 0.934706922085943, 0.940486970067317, 0.8725715159998442, 0.868718232741186, 0.8719828084993478, 0.8801712695690254, 0.8420122930046896, 0.822799036998693, 0.8244581110690464, 0.7780036945784202, 0.8046561475625534, 0.7758094853901156, 0.7467486995959743, 0.7050039698687512, 0.7525287475773482, 0.735456214007293, 0.7709927394918039, 0.668718185644586, 0.712871248181817, 0.7382927084305257, 0.769601275795517, 0.8029969932139043, 0.7974845609584834, 0.8868611275292119, 0.8955311566861818, 0.8696815348242483, 0.8664168787877908, 0.8685041144713691, 0.907679960149426, 0.8883060779778621, 0.8795289843340972, 0.8921059494105662, 0.9404334779630672, 0.9585228806468435, 0.9541342963617566, 1.024832747396326, 1.0461332337340143, 1.0079742571696786, 0.9917045600737096, 0.9690125351133252, 0.9497992791073284, 0.9277495340299856, 0.9704575658402708, 1.0229595550561554, 1.0329140690527994, 1.0511104505931883, 1.0964409334832987, 1.0616001853379655, 1.0690393020378066, 1.011613582715111, 1.0053518863681492, 0.9831415097733526, 0.951297801938524, 0.993684731270493, 1.003425201923729, 1.0018196199576253, 1.0164837404393767, 0.9478191079105452, 0.9657478790768677, 0.9857639608531776, 0.9946481136318508, 1.0055659243596704, 1.03623221184162, 1.0213539730900516, 1.044153062537231, 1.0640620851786324, 1.0791543619217223, 1.07599677037206, 1.0388546682733315, 1.104094173804843, 1.113727585323171, 1.0984746770626277 ], "yaxis": "y4" }, { "hovertemplate": "company=NFLX
date=%{x}
value=%{y}", "legendgroup": "NFLX", "line": { "color": "#FFA15A", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "NFLX", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x", "y": [ 1, 1.0535263142643383, 1.0498595254569378, 1.3076813155940448, 1.273536771428717, 1.188008929282134, 1.3263487897912096, 1.3616362026373592, 1.4336396058469547, 1.5783608462698024, 1.5165008067883996, 1.4331158380609592, 1.406495542490225, 1.375541688281783, 1.484118227436587, 1.5608837620628662, 1.484642138086525, 1.5243106261176576, 1.5546453794312736, 1.5437877293254985, 1.6728891882258874, 1.7140339274719294, 1.7170817582484463, 1.866660325094997, 1.9576645850358447, 1.864041067097456, 1.94414015086099, 1.884851557577705, 1.7193674908479577, 1.691556657660921, 1.633839648701375, 1.647078369277624, 1.50854798541483, 1.7087480282692504, 1.7509404459512254, 1.660459949034241, 1.7360826197418304, 1.720034255916133, 1.7816562507344105, 1.6731749018244944, 1.617029334324746, 1.5842183202957685, 1.4278298007564696, 1.4719748494696214, 1.4451640257830367, 1.3629695899097676, 1.2325348866009125, 1.3625886860662726, 1.262631595251403, 1.2707271281792676, 1.1733415549944868, 1.2194865512765718, 1.4170674789973934, 1.6076479259096166, 1.6148387919701228, 1.6098384682642397, 1.6184103905326357, 1.6551740498315624, 1.699461814861141, 1.7287488945009553, 1.7016048311442251, 1.6648411718452985, 1.721319979015192, 1.7191771103581814, 1.6979855684083631, 1.7405113638622944, 1.6721748970861734, 1.716034084574645, 1.7850849901165535, 1.8335634546034707, 1.7193199695385504, 1.6879375377890014, 1.6876518241903944, 1.6347444679569396, 1.7185103405278743, 1.6178389585732904, 1.758226497494488, 1.7492261453110591, 1.8122290534732837, 1.7774655512770718, 1.5005476379697218, 1.5990284823318142, 1.518310297673454, 1.471165225221077, 1.4419733358261506, 1.3878755896024673, 1.398876103650743, 1.381827735086725, 1.400780927644628, 1.2893470810670251, 1.2528214711933554, 1.299061872016242, 1.347349808387309, 1.3110147218673576, 1.3182532521012131, 1.3658269020946976, 1.388494690497293, 1.4049716271019663, 1.4785466146353017, 1.4984522906221185, 1.4636411194904255, 1.421496227879989, 1.6043620457078422, 1.567169808867808, 1.5408828958311611 ], "yaxis": "y" }, { "hovertemplate": "company=MSFT
date=%{x}
value=%{y}", "legendgroup": "MSFT", "line": { "color": "#19d3f3", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines", "name": "MSFT", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2018-01-01", "2018-01-08", "2018-01-15", "2018-01-22", "2018-01-29", "2018-02-05", "2018-02-12", "2018-02-19", "2018-02-26", "2018-03-05", "2018-03-12", "2018-03-19", "2018-03-26", "2018-04-02", "2018-04-09", "2018-04-16", "2018-04-23", "2018-04-30", "2018-05-07", "2018-05-14", "2018-05-21", "2018-05-28", "2018-06-04", "2018-06-11", "2018-06-18", "2018-06-25", "2018-07-02", "2018-07-09", "2018-07-16", "2018-07-23", "2018-07-30", "2018-08-06", "2018-08-13", "2018-08-20", "2018-08-27", "2018-09-03", "2018-09-10", "2018-09-17", "2018-09-24", "2018-10-01", "2018-10-08", "2018-10-15", "2018-10-22", "2018-10-29", "2018-11-05", "2018-11-12", "2018-11-19", "2018-11-26", "2018-12-03", "2018-12-10", "2018-12-17", "2018-12-24", "2018-12-31", "2019-01-07", "2019-01-14", "2019-01-21", "2019-01-28", "2019-02-04", "2019-02-11", "2019-02-18", "2019-02-25", "2019-03-04", "2019-03-11", "2019-03-18", "2019-03-25", "2019-04-01", "2019-04-08", "2019-04-15", "2019-04-22", "2019-04-29", "2019-05-06", "2019-05-13", "2019-05-20", "2019-05-27", "2019-06-03", "2019-06-10", "2019-06-17", "2019-06-24", "2019-07-01", "2019-07-08", "2019-07-15", "2019-07-22", "2019-07-29", "2019-08-05", "2019-08-12", "2019-08-19", "2019-08-26", "2019-09-02", "2019-09-09", "2019-09-16", "2019-09-23", "2019-09-30", "2019-10-07", "2019-10-14", "2019-10-21", "2019-10-28", "2019-11-04", "2019-11-11", "2019-11-18", "2019-11-25", "2019-12-02", "2019-12-09", "2019-12-16", "2019-12-23", "2019-12-30" ], "xaxis": "x2", "y": [ 1, 1.015988161560536, 1.0205238457756245, 1.0665607876956391, 1.040707528275144, 0.9998865857832728, 1.043202153459527, 1.0665607876956391, 1.0551082990110374, 1.0946819232411402, 1.072683930770293, 0.9885474319413214, 1.034924537137441, 1.0231318851767346, 1.0554484622871425, 1.0772196149853812, 1.0865177211357813, 1.0790339249567087, 1.1078352963411884, 1.0926408755495889, 1.1153191832334917, 1.1428733270694336, 1.1523981709400573, 1.1353894401771305, 1.1385644826269534, 1.1181539716939797, 1.147068848008417, 1.1954869895569342, 1.2050118447667115, 1.2210000857013248, 1.225082192423581, 1.2359677687727004, 1.2198661929954373, 1.2291642991458374, 1.2737271737447062, 1.227009825898405, 1.2855199050794894, 1.2956117406596723, 1.2968590589214408, 1.2714592862805467, 1.242431086462613, 1.2321125018230523, 1.2128358835959658, 1.203764617218174, 1.242431086462613, 1.2279169808840689, 1.1687265864899288, 1.2573987581948347, 1.1885701057133435, 1.2022904705229511, 1.1138451159123457, 1.1383376428543452, 1.1557999511101045, 1.1656650489700635, 1.2213402489774292, 1.2152170945636216, 1.1654382205366092, 1.1982083638006946, 1.2271232401151322, 1.2583059131804986, 1.275994970495635, 1.2530899137523548, 1.3143213671771998, 1.3272479912178707, 1.3373398267980536, 1.3594511427723972, 1.371470623166558, 1.398911443499003, 1.4728426811919109, 1.4616168621926098, 1.4415465939098175, 1.45220551191279, 1.4314547583296346, 1.4024265471725468, 1.489964746797488, 1.5018708923489987, 1.5531239130712344, 1.518993128041884, 1.5541444028995486, 1.5750084006121237, 1.5491551411916282, 1.6026759586647925, 1.5523300929282209, 1.5615149549492018, 1.5435990692006107, 1.5125297196387406, 1.5632157599905712, 1.5772763674503605, 1.5570926849508404, 1.581131634400008, 1.5617416132953483, 1.5661638719545554, 1.583852929269692, 1.5581131747791548, 1.5957590748212025, 1.629663201504406, 1.655062974145301, 1.7005329130166025, 1.6962239778608914, 1.7165211652903694, 1.720716595516122, 1.7522394318575931, 1.7848962516181823, 1.8024719740906685, 1.7881845268582712 ], "yaxis": "y2" } ], "layout": { "annotations": [ { "showarrow": false, "text": "company=NFLX", "x": 0.245, "xanchor": "center", "xref": "paper", "y": 0.2866666666666666, "yanchor": "bottom", "yref": "paper" }, { "showarrow": false, "text": "company=MSFT", "x": 0.755, "xanchor": "center", "xref": "paper", "y": 0.2866666666666666, "yanchor": "bottom", "yref": "paper" }, { "showarrow": false, "text": "company=AMZN", "x": 0.245, "xanchor": "center", "xref": "paper", "y": 0.6433333333333333, "yanchor": "bottom", "yref": "paper" }, { "showarrow": false, "text": "company=FB", "x": 0.755, "xanchor": "center", "xref": "paper", "y": 0.6433333333333333, "yanchor": "bottom", "yref": "paper" }, { "showarrow": false, "text": "company=GOOG", "x": 0.245, "xanchor": "center", "xref": "paper", "y": 0.9999999999999999, "yanchor": "bottom", "yref": "paper" }, { "showarrow": false, "text": "company=AAPL", "x": 0.755, "xanchor": "center", "xref": "paper", "y": 0.9999999999999999, "yanchor": "bottom", "yref": "paper" }, { "showarrow": false, "text": "Jan 1, 2018 baseline", "x": 1, "xanchor": "right", "xref": "x5 domain", "y": 1, "yanchor": "top", "yref": "y5" }, { "showarrow": false, "text": "Jan 1, 2018 baseline", "x": 1, "xanchor": "right", "xref": "x6 domain", "y": 1, "yanchor": "top", "yref": "y6" }, { "showarrow": false, "text": "decline", "x": "2018-09-24", "xanchor": "left", "xref": "x", "y": 1, "yanchor": "top", "yref": "y domain" }, { "showarrow": false, "text": "decline", "x": "2018-09-24", "xanchor": "left", "xref": "x3", "y": 1, "yanchor": "top", "yref": "y3 domain" }, { "showarrow": false, "text": "decline", "x": "2018-09-24", "xanchor": "left", "xref": "x5", "y": 1, "yanchor": "top", "yref": "y5 domain" } ], "legend": { "title": { "text": "company" }, "tracegroupgap": 0 }, "margin": { "t": 60 }, "shapes": [ { "line": { "dash": "dot" }, "type": "line", "x0": 0, "x1": 1, "xref": "x5 domain", "y0": 1, "y1": 1, "yref": "y5" }, { "line": { "dash": "dot" }, "type": "line", "x0": 0, "x1": 1, "xref": "x6 domain", "y0": 1, "y1": 1, "yref": "y6" }, { "fillcolor": "green", "line": { "width": 0 }, "opacity": 0.25, "type": "rect", "x0": "2018-09-24", "x1": "2018-12-18", "xref": "x", "y0": 0, "y1": 1, "yref": "y domain" }, { "fillcolor": "green", "line": { "width": 0 }, "opacity": 0.25, "type": "rect", "x0": "2018-09-24", "x1": "2018-12-18", "xref": "x3", "y0": 0, "y1": 1, "yref": "y3 domain" }, { "fillcolor": "green", "line": { "width": 0 }, "opacity": 0.25, "type": "rect", "x0": "2018-09-24", "x1": "2018-12-18", "xref": "x5", "y0": 0, "y1": 1, "yref": "y5 domain" } ], "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "anchor": "y", "domain": [ 0, 0.49 ], "title": { "text": "date" } }, "xaxis2": { "anchor": "y2", "domain": [ 0.51, 1 ], "matches": "x", "title": { "text": "date" } }, "xaxis3": { "anchor": "y3", "domain": [ 0, 0.49 ], "matches": "x", "showticklabels": false }, "xaxis4": { "anchor": "y4", "domain": [ 0.51, 1 ], "matches": "x", "showticklabels": false }, "xaxis5": { "anchor": "y5", "domain": [ 0, 0.49 ], "matches": "x", "showticklabels": false }, "xaxis6": { "anchor": "y6", "domain": [ 0.51, 1 ], "matches": "x", "showticklabels": false }, "yaxis": { "anchor": "x", "domain": [ 0, 0.2866666666666666 ], "title": { "text": "value" } }, "yaxis2": { "anchor": "x2", "domain": [ 0, 0.2866666666666666 ], "matches": "y", "showticklabels": false }, "yaxis3": { "anchor": "x3", "domain": [ 0.35666666666666663, 0.6433333333333333 ], "matches": "y", "title": { "text": "value" } }, "yaxis4": { "anchor": "x4", "domain": [ 0.35666666666666663, 0.6433333333333333 ], "matches": "y", "showticklabels": false }, "yaxis5": { "anchor": "x5", "domain": [ 0.7133333333333333, 0.9999999999999999 ], "matches": "y", "title": { "text": "value" } }, "yaxis6": { "anchor": "x6", "domain": [ 0.7133333333333333, 0.9999999999999999 ], "matches": "y", "showticklabels": false } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import plotly.express as px\n", "\n", "df = px.data.stocks(indexed=True)\n", "fig = px.line(df, facet_col=\"company\", facet_col_wrap=2)\n", "fig.add_hline(y=1, line_dash=\"dot\", row=3, col=\"all\",\n", " annotation_text=\"Jan 1, 2018 baseline\", \n", " annotation_position=\"bottom right\")\n", "fig.add_vrect(x0=\"2018-09-24\", x1=\"2018-12-18\", row=\"all\", col=1,\n", " annotation_text=\"decline\", annotation_position=\"top left\",\n", " fillcolor=\"green\", opacity=0.25, line_width=0)\n", "fig.show()" ] }, { "cell_type": "markdown", "id": "e94c1f18", "metadata": {}, "source": [ "## 参考\n", "\n", "可以查看 [`add_hline`](https://plotly.com/python-api-reference/generated/plotly.graph_objects.Figure.html?highlight=add_hline#plotly.graph_objects.Figure.add_hline), [`add_vline`](https://plotly.com/python-api-reference/generated/plotly.graph_objects.Figure.html?highlight=add_vline#plotly.graph_objects.Figure.add_vline), [`add_hrect`](https://plotly.com/python-api-reference/generated/plotly.graph_objects.Figure.html?highlight=add_hrect#plotly.graph_objects.Figure.add_hrect), [`add_vrect`](https://plotly.com/python-api-reference/generated/plotly.graph_objects.Figure.html?highlight=add_vrect#plotly.graph_objects.Figure.add_vrect) 的参考文档。" ] } ], "metadata": { "jupytext": { "formats": "md:myst", "text_representation": { "extension": ".md", "format_name": "myst", "format_version": 0.13, "jupytext_version": "1.10.3" } }, "kernelspec": { "display_name": "Python 3.10.4 ('tvmx': conda)", "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.10.4" }, "source_map": [ 13, 24, 32, 36, 44, 53, 57, 63, 75, 79, 95, 101, 113 ], "vscode": { "interpreter": { "hash": "e579259ee6098e2b9319de590d145b4b096774fe457bdf04260e3ba5c171e887" } } }, "nbformat": 4, "nbformat_minor": 5 }