Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 643f58e

Browse filesBrowse files
Merge pull request #1864 from joelostblom/mpl-template
Add mpl-like template
2 parents 5830055 + 6765ade commit 643f58e
Copy full SHA for 643f58e

File tree

Expand file treeCollapse file tree

3 files changed

+79
-0
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+79
-0
lines changed

‎packages/python/plotly/plotly/io/_templates.py

Copy file name to clipboardExpand all lines: packages/python/plotly/plotly/io/_templates.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def __init__(self):
3737
default_templates = [
3838
"ggplot2",
3939
"seaborn",
40+
"simple_white",
4041
"plotly",
4142
"plotly_white",
4243
"plotly_dark",
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"layout": {"colorway": ["#1F77B4", "#FF7F0E", "#2CA02C", "#D62728", "#9467BD", "#8C564B", "#E377C2", "#7F7F7F", "#BCBD22", "#17BECF"], "font": {"color": "rgb(36,36,36)"}, "hovermode": "closest", "hoverlabel": {"align": "left"}, "paper_bgcolor": "white", "plot_bgcolor": "white", "polar": {"bgcolor": "white", "angularaxis": {"gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside"}, "radialaxis": {"gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside"}}, "ternary": {"bgcolor": "white", "aaxis": {"gridcolor": "#DFE8F3", "linecolor": "#A2B1C6", "showgrid": false, "showline": true, "ticks": "outside"}, "baxis": {"gridcolor": "#DFE8F3", "linecolor": "#A2B1C6", "showgrid": false, "showline": true, "ticks": "outside"}, "caxis": {"gridcolor": "#DFE8F3", "linecolor": "#A2B1C6", "showgrid": false, "showline": true, "ticks": "outside"}}, "colorscale": {"sequential": [[0.0, "#440154"], [0.1111111111111111, "#482878"], [0.2222222222222222, "#3e4989"], [0.3333333333333333, "#31688e"], [0.4444444444444444, "#26828e"], [0.5555555555555556, "#1f9e89"], [0.6666666666666666, "#35b779"], [0.7777777777777778, "#6ece58"], [0.8888888888888888, "#b5de2b"], [1.0, "#fde725"]], "sequentialminus": [[0.0, "#440154"], [0.1111111111111111, "#482878"], [0.2222222222222222, "#3e4989"], [0.3333333333333333, "#31688e"], [0.4444444444444444, "#26828e"], [0.5555555555555556, "#1f9e89"], [0.6666666666666666, "#35b779"], [0.7777777777777778, "#6ece58"], [0.8888888888888888, "#b5de2b"], [1.0, "#fde725"]], "diverging": [[0.0, "rgb(103,0,31)"], [0.1, "rgb(178,24,43)"], [0.2, "rgb(214,96,77)"], [0.3, "rgb(244,165,130)"], [0.4, "rgb(253,219,199)"], [0.5, "rgb(247,247,247)"], [0.6, "rgb(209,229,240)"], [0.7, "rgb(146,197,222)"], [0.8, "rgb(67,147,195)"], [0.9, "rgb(33,102,172)"], [1.0, "rgb(5,48,97)"]]}, "xaxis": {"gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside", "zerolinecolor": "rgb(36,36,36)", "automargin": true, "zeroline": false}, "yaxis": {"gridcolor": "rgb(232,232,232)", "linecolor": "rgb(36,36,36)", "showgrid": false, "showline": true, "ticks": "outside", "zerolinecolor": "rgb(36,36,36)", "automargin": true, "zeroline": false}, "scene": {"xaxis": {"backgroundcolor": "white", "gridcolor": "#DFE8F3", "linecolor": "rgb(36,36,36)", "showbackground": true, "showgrid": false, "showline": true, "ticks": "outside", "zerolinecolor": "rgb(36,36,36)", "gridwidth": 2, "zeroline": false}, "yaxis": {"backgroundcolor": "white", "gridcolor": "#DFE8F3", "linecolor": "rgb(36,36,36)", "showbackground": true, "showgrid": false, "showline": true, "ticks": "outside", "zerolinecolor": "rgb(36,36,36)", "gridwidth": 2, "zeroline": false}, "zaxis": {"backgroundcolor": "white", "gridcolor": "#DFE8F3", "linecolor": "rgb(36,36,36)", "showbackground": true, "showgrid": false, "showline": true, "ticks": "outside", "zerolinecolor": "rgb(36,36,36)", "gridwidth": 2, "zeroline": false}}, "shapedefaults": {"fillcolor": "black", "line": {"width": 0}, "opacity": 0.3}, "annotationdefaults": {"arrowhead": 0, "arrowwidth": 1}, "geo": {"bgcolor": "white", "landcolor": "white", "subunitcolor": "white", "showland": true, "showlakes": true, "lakecolor": "white"}, "title": {"x": 0.05}, "mapbox": {"style": "light"}}, "data": {"histogram2dcontour": [{"type": "histogram2dcontour", "colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}, "colorscale": [[0.0, "#440154"], [0.1111111111111111, "#482878"], [0.2222222222222222, "#3e4989"], [0.3333333333333333, "#31688e"], [0.4444444444444444, "#26828e"], [0.5555555555555556, "#1f9e89"], [0.6666666666666666, "#35b779"], [0.7777777777777778, "#6ece58"], [0.8888888888888888, "#b5de2b"], [1.0, "#fde725"]]}], "choropleth": [{"type": "choropleth", "colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}}], "histogram2d": [{"type": "histogram2d", "colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}, "colorscale": [[0.0, "#440154"], [0.1111111111111111, "#482878"], [0.2222222222222222, "#3e4989"], [0.3333333333333333, "#31688e"], [0.4444444444444444, "#26828e"], [0.5555555555555556, "#1f9e89"], [0.6666666666666666, "#35b779"], [0.7777777777777778, "#6ece58"], [0.8888888888888888, "#b5de2b"], [1.0, "#fde725"]]}], "heatmap": [{"type": "heatmap", "colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}, "colorscale": [[0.0, "#440154"], [0.1111111111111111, "#482878"], [0.2222222222222222, "#3e4989"], [0.3333333333333333, "#31688e"], [0.4444444444444444, "#26828e"], [0.5555555555555556, "#1f9e89"], [0.6666666666666666, "#35b779"], [0.7777777777777778, "#6ece58"], [0.8888888888888888, "#b5de2b"], [1.0, "#fde725"]]}], "heatmapgl": [{"type": "heatmapgl", "colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}, "colorscale": [[0.0, "#440154"], [0.1111111111111111, "#482878"], [0.2222222222222222, "#3e4989"], [0.3333333333333333, "#31688e"], [0.4444444444444444, "#26828e"], [0.5555555555555556, "#1f9e89"], [0.6666666666666666, "#35b779"], [0.7777777777777778, "#6ece58"], [0.8888888888888888, "#b5de2b"], [1.0, "#fde725"]]}], "contourcarpet": [{"type": "contourcarpet", "colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}}], "contour": [{"type": "contour", "colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}, "colorscale": [[0.0, "#440154"], [0.1111111111111111, "#482878"], [0.2222222222222222, "#3e4989"], [0.3333333333333333, "#31688e"], [0.4444444444444444, "#26828e"], [0.5555555555555556, "#1f9e89"], [0.6666666666666666, "#35b779"], [0.7777777777777778, "#6ece58"], [0.8888888888888888, "#b5de2b"], [1.0, "#fde725"]]}], "surface": [{"type": "surface", "colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}, "colorscale": [[0.0, "#440154"], [0.1111111111111111, "#482878"], [0.2222222222222222, "#3e4989"], [0.3333333333333333, "#31688e"], [0.4444444444444444, "#26828e"], [0.5555555555555556, "#1f9e89"], [0.6666666666666666, "#35b779"], [0.7777777777777778, "#6ece58"], [0.8888888888888888, "#b5de2b"], [1.0, "#fde725"]]}], "mesh3d": [{"type": "mesh3d", "colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}}], "scatter": [{"type": "scatter", "marker": {"colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}}}], "parcoords": [{"type": "parcoords", "line": {"colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}}}], "scatterpolargl": [{"type": "scatterpolargl", "marker": {"colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}}}], "bar": [{"error_x": {"color": "rgb(36,36,36)"}, "error_y": {"color": "rgb(36,36,36)"}, "marker": {"line": {"color": "white", "width": 0.5}}, "type": "bar"}], "scattergeo": [{"type": "scattergeo", "marker": {"colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}}}], "scatterpolar": [{"type": "scatterpolar", "marker": {"colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}}}], "histogram": [{"marker": {"line": {"color": "white", "width": 0.6}}, "type": "histogram"}], "scattergl": [{"type": "scattergl", "marker": {"colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}}}], "scatter3d": [{"type": "scatter3d", "line": {"colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}}, "marker": {"colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}}}], "scattermapbox": [{"type": "scattermapbox", "marker": {"colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}}}], "scatterternary": [{"type": "scatterternary", "marker": {"colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}}}], "scattercarpet": [{"type": "scattercarpet", "marker": {"colorbar": {"outlinewidth": 10, "tickcolor": "rgb(36,36,36)", "ticklen": 8, "ticks": "outside", "tickwidth": 2}}}], "carpet": [{"aaxis": {"endlinecolor": "rgb(36,36,36)", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "rgb(36,36,36)"}, "baxis": {"endlinecolor": "rgb(36,36,36)", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "rgb(36,36,36)"}, "type": "carpet"}], "table": [{"cells": {"fill": {"color": "rgb(237,237,237)"}, "line": {"color": "white"}}, "header": {"fill": {"color": "rgb(217,217,217)"}, "line": {"color": "white"}}, "type": "table"}], "barpolar": [{"marker": {"line": {"color": "white", "width": 0.5}}, "type": "barpolar"}]}}

‎packages/python/plotly/templategen/definitions.py

Copy file name to clipboardExpand all lines: packages/python/plotly/templategen/definitions.py
+77Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from templategen.utils import initialize_template
33
from .utils.colors import colors
44
import colorcet as cc
5+
import plotly.express as px
56

67
# dict of template builder functions
78
# This way we can loop over definitions in __init__.py
@@ -73,6 +74,82 @@ def ggplot2():
7374
builders["ggplot2"] = ggplot2
7475

7576

77+
def simple_white():
78+
# Set colorbar_common
79+
colorbar_common = dict(
80+
outlinewidth=10,
81+
tickcolor=colors["gray14"],
82+
ticks="outside",
83+
tickwidth=2,
84+
ticklen=8,
85+
)
86+
87+
# Common axis common properties
88+
axis_common = dict(
89+
showgrid=False,
90+
gridcolor=colors["gray91"],
91+
linecolor=colors["gray14"],
92+
ticks="outside",
93+
showline=True,
94+
)
95+
# semi-transparent black and no outline
96+
shape_defaults = dict(fillcolor="black", line={"width": 0}, opacity=0.3)
97+
98+
# Remove arrow head and make line thinner
99+
annotation_defaults = {"arrowhead": 0, "arrowwidth": 1}
100+
101+
template = initialize_template(
102+
paper_clr="white",
103+
font_clr=colors["gray14"],
104+
panel_background_clr="white",
105+
panel_grid_clr="white",
106+
axis_ticks_clr=colors["gray14"],
107+
zerolinecolor_clr=colors["gray14"],
108+
table_cell_clr=colors["gray93"],
109+
table_header_clr=colors["gray85"],
110+
table_line_clr="white",
111+
colorway=px.colors.qualitative.D3,
112+
colorbar_common=colorbar_common,
113+
colorscale=px.colors.sequential.Viridis,
114+
colorscale_diverging=px.colors.diverging.RdBu,
115+
axis_common=axis_common,
116+
annotation_defaults=annotation_defaults,
117+
shape_defaults=shape_defaults,
118+
)
119+
120+
# Left align title
121+
template.layout.title.x = 0.05
122+
123+
# Increase grid width for 3d plots
124+
opts = dict(gridwidth=2, gridcolor=plotly_clrs["gray91"], zeroline=False)
125+
template.layout.scene.xaxis.update(opts)
126+
template.layout.scene.yaxis.update(opts)
127+
template.layout.scene.zaxis.update(opts)
128+
129+
# Darken ternary
130+
opts = dict(linecolor=plotly_clrs["gray14"], gridcolor=plotly_clrs["gray91"])
131+
template.layout.ternary.aaxis.update(opts)
132+
template.layout.ternary.baxis.update(opts)
133+
template.layout.ternary.caxis.update(opts)
134+
135+
# Remove lines through the origin
136+
template.layout.xaxis.update(zeroline=False)
137+
template.layout.yaxis.update(zeroline=False)
138+
139+
# Separate histogram bins wit ha white line
140+
opts = {"marker": {"line": {"width": 0.6, "color": "white"}}}
141+
template.data.histogram = [opts]
142+
143+
# Mapbox light style
144+
template.layout.mapbox.style = "light"
145+
146+
# Set table header font color to white
147+
return template
148+
149+
150+
builders["simple_white"] = simple_white
151+
152+
76153
def seaborn():
77154
# Define colors
78155
# -------------

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.