Skip to content

Commit 0cdacad

Browse files
authored
Merge pull request #536 from materialsproject/plotly6
Plotly 6 support
2 parents a79210b + 8950d2f commit 0cdacad

3 files changed

Lines changed: 30 additions & 20 deletions

File tree

crystal_toolkit/components/phase_diagram.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ def __init__(self, *args, **kwargs) -> None:
3636
# Default plot layouts for Binary (2), Ternary (3), Quaternary (4) phase diagrams
3737
default_binary_plot_style = frozendict(
3838
xaxis={
39-
"title": "Fraction",
39+
"title": {
40+
"text": "Fraction",
41+
"font": {"color": "#000000", "size": 24.0},
42+
},
4043
"anchor": "y",
4144
"mirror": "ticks",
4245
"nticks": 8,
@@ -45,12 +48,14 @@ def __init__(self, *args, **kwargs) -> None:
4548
"side": "bottom",
4649
"tickfont": {"size": 16.0},
4750
"ticks": "inside",
48-
"titlefont": {"color": "#000000", "size": 24.0},
4951
"type": "linear",
5052
"zeroline": False,
5153
},
5254
yaxis={
53-
"title": "Formation energy (eV/fu)",
55+
"title": {
56+
"text": "Formation energy (eV/fu)",
57+
"font": {"color": "#000000", "size": 24.0},
58+
},
5459
"anchor": "x",
5560
"mirror": "ticks",
5661
"nticks": 7,
@@ -59,7 +64,6 @@ def __init__(self, *args, **kwargs) -> None:
5964
"side": "left",
6065
"tickfont": {"size": 16.0},
6166
"ticks": "inside",
62-
"titlefont": {"color": "#000000", "size": 24.0},
6367
"type": "linear",
6468
"zeroline": False,
6569
},

crystal_toolkit/components/pourbaix.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,26 @@ class PourbaixDiagramComponent(MPComponent):
5151

5252
default_plot_style = frozendict(
5353
xaxis={
54-
"title": "pH",
54+
"title": {
55+
"text": "pH",
56+
"font": {"color": "#000000", "size": 24.0},
57+
},
5558
"anchor": "y",
5659
"mirror": "ticks",
5760
"showgrid": False,
5861
"showline": True,
5962
"side": "bottom",
6063
"tickfont": {"size": 16.0},
6164
"ticks": "inside",
62-
"titlefont": {"color": "#000000", "size": 24.0},
6365
"type": "linear",
6466
"zeroline": False,
6567
"range": [MIN_PH, MAX_PH],
6668
},
6769
yaxis={
68-
"title": "Applied Potential (V vs. SHE)",
70+
"title": {
71+
"text": "Applied Potential (V vs. SHE)",
72+
"font": {"color": "#000000", "size": 24.0},
73+
},
6974
"anchor": "x",
7075
"mirror": "ticks",
7176
"range": [MIN_V, MAX_V],
@@ -74,7 +79,6 @@ class PourbaixDiagramComponent(MPComponent):
7479
"side": "left",
7580
"tickfont": {"size": 16.0},
7681
"ticks": "inside",
77-
"titlefont": {"color": "#000000", "size": 24.0},
7882
"type": "linear",
7983
"zeroline": False,
8084
},
@@ -343,8 +347,10 @@ def get_figure(
343347
x=list(ph_range),
344348
y=list(v_range),
345349
colorbar={
346-
"title": "∆G<sub>pbx</sub> (eV/atom)",
347-
"titleside": "right",
350+
"title": {
351+
"text": "∆G<sub>pbx</sub> (eV/atom)",
352+
"side": "right",
353+
},
348354
},
349355
colorscale=[
350356
[0, "#000004"],
@@ -896,12 +902,8 @@ def make_figure(
896902
filter_solids=kwargs["filter_solids"],
897903
)
898904

899-
self.logger.debug( # noqa: PLE1205
900-
"Generated pourbaix diagram",
901-
len(pourbaix_entries),
902-
heatmap_entry,
903-
conc_dict,
904-
comp_dict,
905+
self.logger.debug(
906+
f"Generated pourbaix diagram with {len(pourbaix_entries)} entries."
905907
)
906908

907909
figure = self.get_figure(

crystal_toolkit/components/xas.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ def __init__(self, *args, **kwargs) -> None:
2323

2424
default_xas_layout = frozendict(
2525
xaxis={
26-
"title": "Energy (eV)",
26+
"title": {
27+
"text": "Energy (eV)",
28+
"font": {"size": 16.0},
29+
},
2730
"anchor": "y",
2831
"mirror": "ticks",
2932
"nticks": 8,
@@ -32,12 +35,14 @@ def __init__(self, *args, **kwargs) -> None:
3235
"side": "bottom",
3336
"tickfont": {"size": 16.0},
3437
"ticks": "inside",
35-
"titlefont": {"size": 16.0},
3638
"type": "linear",
3739
"zeroline": False,
3840
},
3941
yaxis={
40-
"title": "Absorption Coeff, μ (a.u.)",
42+
"title": {
43+
"text": "Absorption Coeff, μ (a.u.)",
44+
"font": {"size": 16.0},
45+
},
4146
"anchor": "x",
4247
"mirror": "ticks",
4348
"nticks": 7,
@@ -46,7 +51,6 @@ def __init__(self, *args, **kwargs) -> None:
4651
"side": "left",
4752
"tickfont": {"size": 16.0},
4853
"ticks": "inside",
49-
"titlefont": {"size": 16.0},
5054
"type": "linear",
5155
"zeroline": False,
5256
},

0 commit comments

Comments
 (0)