Skip to content

Commit 485967e

Browse files
sophungerdwr-psandhu
authored andcommitted
Add variable for color palette
add a variable for the color palette instead of being hard coded. Make it easier to modify.
1 parent 626c317 commit 485967e

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

pydelmod/calibplot.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import copy
2626
import re
2727

28-
28+
cpalette = "Category10"
2929
def parse_time_window(timewindow):
3030
"""
3131
Args:
@@ -914,7 +914,7 @@ def build_inst_plot(
914914
timewindow=inst_plot_timewindow,
915915
zoom_inst_plot=zoom_inst_plot,
916916
).opts(ylabel=y_axis_label, show_grid=True, gridstyle=gridstyle, shared_axes=False)
917-
tsp = tsp.opts(opts.Curve(color=hv.Cycle("Category10")))
917+
tsp = tsp.opts(opts.Curve(color=hv.Cycle(cpalette)))
918918
return tsp
919919

920920

@@ -988,7 +988,7 @@ def build_godin_plot(
988988
gtsp = tsplot(gtsp_plot_data, [p.study.name for p in pp]).opts(
989989
ylabel=godin_y_axis_label, show_grid=True, gridstyle=gridstyle
990990
)
991-
gtsp = gtsp.opts(opts.Curve(color=hv.Cycle("Category10")))
991+
gtsp = gtsp.opts(opts.Curve(color=hv.Cycle(cpalette)))
992992
return gtsp
993993

994994

@@ -1062,7 +1062,7 @@ def build_scatter_plots(
10621062
if splot_plot_data is not None and splot_plot_data[0] is not None:
10631063
splot = (
10641064
scatterplot(splot_plot_data, [p.study.name for p in pp])
1065-
.opts(opts.Scatter(color=shift_cycle(hv.Cycle("Category10"))))
1065+
.opts(opts.Scatter(color=shift_cycle(hv.Cycle(cpalette))))
10661066
.opts(ylabel="Model", legend_position="top_left")
10671067
.opts(show_grid=True, frame_height=250, frame_width=250, data_aspect=1)
10681068
.opts(toolbar=toolbar_option)
@@ -1094,7 +1094,7 @@ def build_scatter_plots(
10941094
if dfmetrics is not None:
10951095
slope_plots = regression_line_plots(dfmetrics, flow_in_thousands)
10961096
scatter_plot = (
1097-
slope_plots.opts(opts.Slope(color=shift_cycle(hv.Cycle("Category10"))))
1097+
slope_plots.opts(opts.Slope(color=shift_cycle(hv.Cycle(cpalette))))
10981098
* splot
10991099
)
11001100
scatter_plot = scatter_plot.opts(
@@ -1682,7 +1682,7 @@ def build_kde_plots(pp, amp_title="(e)", phase_title="(f)", include_toolbar=True
16821682
"Amplitude Diff (%)",
16831683
)
16841684
amp_pdiff_kde = amp_pdiff_kde.opts(
1685-
opts.Distribution(line_color=shift_cycle(hv.Cycle("Category10")), filled=False)
1685+
opts.Distribution(line_color=shift_cycle(hv.Cycle(cpalette)), filled=False)
16861686
)
16871687
amp_pdiff_kde.opts(opts.Distribution(line_width=5))
16881688

@@ -1692,7 +1692,7 @@ def build_kde_plots(pp, amp_title="(e)", phase_title="(f)", include_toolbar=True
16921692
"Phase Diff (minutes)",
16931693
)
16941694
phase_diff_kde = phase_diff_kde.opts(
1695-
opts.Distribution(line_color=shift_cycle(hv.Cycle("Category10")), filled=False)
1695+
opts.Distribution(line_color=shift_cycle(hv.Cycle(cpalette)), filled=False)
16961696
)
16971697
phase_diff_kde.opts(opts.Distribution(line_width=5))
16981698

@@ -1813,7 +1813,7 @@ def create_validation_bar_charts(
18131813
legend_position="right",
18141814
ylabel=m + " (" + u + ")",
18151815
xlabel="",
1816-
color=shift_cycle(hv.Cycle("Category10")),
1816+
color=shift_cycle(hv.Cycle(cpalette)),
18171817
gridstyle=grid_style,
18181818
show_grid=True,
18191819
show_legend=False,

0 commit comments

Comments
 (0)