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 5f743ff

Browse filesBrowse files
committed
Template updates
- Add 'none' template that applies no defaults. - Update plotly express to fall back to v3-style defaults when there are no template colorway/colorscales specified. - Update the plotly express Plotly colorway with new v4 theme ordering
1 parent 09b3d80 commit 5f743ff
Copy full SHA for 5f743ff

File tree

4 files changed

+22
-16
lines changed
Filter options

4 files changed

+22
-16
lines changed

‎packages/python/plotly/plotly/colors/qualitative.py

Copy file name to clipboardExpand all lines: packages/python/plotly/plotly/colors/qualitative.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ def swatches():
1818
"#EF553B",
1919
"#00cc96",
2020
"#ab63fa",
21+
"#FFA15A",
2122
"#19d3f3",
22-
"#e763fa",
23-
"#fecb52",
24-
"#ffa15a",
25-
"#ff6692",
26-
"#b6e880",
23+
"#FF6692",
24+
"#B6E880",
25+
"#FF97FF",
26+
"#FECB52",
2727
]
2828

2929
D3 = [

‎packages/python/plotly/plotly/colors/sequential.py

Copy file name to clipboardExpand all lines: packages/python/plotly/plotly/colors/sequential.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def swatches():
105105
PuBuGn,
106106
PuRd,
107107
Purples,
108+
RdBu,
108109
RdPu,
109110
Reds,
110111
YlGn,

‎packages/python/plotly/plotly/express/_core.py

Copy file name to clipboardExpand all lines: packages/python/plotly/plotly/express/_core.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -659,19 +659,19 @@ def apply_default_cascade(args):
659659
args["color_continuous_scale"] = [
660660
x[1] for x in template.layout.colorscale.sequential
661661
]
662-
except AttributeError:
662+
except (AttributeError, TypeError):
663663
pass
664664
if args["color_continuous_scale"] is None:
665-
args["color_continuous_scale"] = sequential.Plasma
665+
args["color_continuous_scale"] = sequential.Viridis
666666

667667
if "color_discrete_sequence" in args:
668668
if args["color_discrete_sequence"] is None:
669669
try:
670670
args["color_discrete_sequence"] = template.layout.colorway
671-
except AttributeError:
671+
except (AttributeError, TypeError):
672672
pass
673673
if args["color_discrete_sequence"] is None:
674-
args["color_discrete_sequence"] = qualitative.Plotly
674+
args["color_discrete_sequence"] = qualitative.D3
675675

676676
# If both marginals and faceting are specified, faceting wins
677677
if args.get("facet_col", None) and args.get("marginal_y", None):

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

Copy file name to clipboardExpand all lines: packages/python/plotly/plotly/io/_templates.py
+12-7Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def __init__(self):
4040
"plotly_dark",
4141
"presentation",
4242
"xgridoff",
43+
"none",
4344
]
4445

4546
for template_name in default_templates:
@@ -64,13 +65,17 @@ def __getitem__(self, item):
6465
if template is Lazy:
6566
from plotly.graph_objs.layout import Template
6667

67-
# Load template from package data
68-
path = os.path.join("package_data", "templates", item + ".json")
69-
template_str = pkgutil.get_data("plotly", path).decode("utf-8")
70-
template_dict = json.loads(template_str)
71-
template = Template(template_dict)
72-
73-
self._templates[item] = template
68+
if item == "none":
69+
# "none" is a special built-in named template that applied no defaults
70+
self._templates[item] = Template()
71+
else:
72+
# Load template from package data
73+
path = os.path.join("package_data", "templates", item + ".json")
74+
template_str = pkgutil.get_data("plotly", path).decode("utf-8")
75+
template_dict = json.loads(template_str)
76+
template = Template(template_dict)
77+
78+
self._templates[item] = template
7479

7580
return template
7681

0 commit comments

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