Skip to content

Commit

Permalink
add custom lines #140
Browse files Browse the repository at this point in the history
  • Loading branch information
TatianaBurek committed Feb 11, 2022
1 parent d67ab2f commit 84719f6
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 5 deletions.
5 changes: 3 additions & 2 deletions metplotpy/plots/bar/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ def _create_figure(self):
# add custom lines
if len(self.series_list) > 0:
self._add_lines(
sorted(self.series_list[0].series_data[self.config_obj.indy_var].unique()),
self.config_obj)
self.config_obj,
sorted(self.series_list[0].series_data[self.config_obj.indy_var].unique())
)

# apply y axis limits
self._yaxis_limits()
Expand Down
5 changes: 3 additions & 2 deletions metplotpy/plots/box/box.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,9 @@ def _create_figure(self):
# add custom lines
if len(self.series_list) > 0:
self._add_lines(
sorted(self.series_list[0].series_data[self.config_obj.indy_var].unique()),
self.config_obj)
self.config_obj,
sorted(self.series_list[0].series_data[self.config_obj.indy_var].unique())
)

# apply y axis limits
self._yaxis_limits()
Expand Down
4 changes: 4 additions & 0 deletions metplotpy/plots/eclv/eclv.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ def _create_figure(self):
for series_points in series.series_points:
n_stats = list(map(add, n_stats, series_points['nstat']))

# add custom lines
if len(self.series_list) > 0:
self._add_lines(self.config_obj)

# apply y axis limits
self._yaxis_limits()

Expand Down
4 changes: 4 additions & 0 deletions metplotpy/plots/ens_ss/ens_ss.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ def _create_figure(self):
self._draw_series(self.series_list[i])
i = i + counter

# add custom lines
if len(self.series_list) > 0:
self._add_lines(self.config_obj)

# apply y axis limits
self._yaxis_limits()
self._y2axis_limits()
Expand Down
6 changes: 6 additions & 0 deletions metplotpy/plots/histogram/hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ def _create_figure(self):
for series in self.series_list:
self._draw_series(series)

# add custom lines
if len(self.series_list) > 0:
self._add_lines(
self.config_obj
)

def _draw_series(self, series: HistSeries) -> None:
"""
Draws the formatted Bar on the plot
Expand Down
2 changes: 1 addition & 1 deletion metplotpy/plots/line/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def _create_figure(self):
n_stats = list(map(add, n_stats, series.series_points['nstat']))

# add custom lines
self._add_lines(x_points_index, self.config_obj)
self._add_lines(self.config_obj, x_points_index)

# apply y axis limits
self._yaxis_limits()
Expand Down
3 changes: 3 additions & 0 deletions metplotpy/plots/reliability_diagram/reliability.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ def _create_figure(self):
# it isn't requested (as set in the config file)
if series.plot_disp:
self._draw_series(series, x_points_index_adj)
# add custom lines
if len(self.series_list) > 0:
self._add_lines(self.config_obj)

def _draw_series(self, series: ReliabilitySeries, x_points_index_adj: list) -> None:
"""
Expand Down
7 changes: 7 additions & 0 deletions metplotpy/plots/roc_diagram/roc_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ def __init__(self, parameters):
# create binary versions of the plot.
self.figure = self._create_figure()

# add custom lines
if len(self.series_list) > 0:
self._add_lines(self.config_obj)

def _read_input_data(self):
"""
Read the input data file (either CTC or PCT linetype)
Expand Down Expand Up @@ -315,6 +319,7 @@ def _create_figure(self):
secondary_y=False
)


def add_trace_copy(trace):
"""Adds separate traces for markers and a legend.
This is a fix for not printing 'Aa' in the legend
Expand All @@ -332,6 +337,8 @@ def add_trace_copy(trace):

if self.config_obj.add_point_thresholds:
fig.for_each_trace(add_trace_copy)


return fig

def save_to_file(self):
Expand Down

0 comments on commit 84719f6

Please sign in to comment.