Skip to content

Commit 0fe8334

Browse files
committed
showcases: fix: re-added missing function to modifiedplot.py
1 parent b9db7ae commit 0fe8334

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

python/modifiedplot.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,36 @@ def get_prop(k):
7272

7373
p.ylabel(utils.make_chart_title(df, ["title"]))
7474

75+
def plot_vectors_separate(df, props, legend_func=utils.make_legend_label):
76+
"""
77+
This is very similar to `plot_vectors`, with identical usage.
78+
The only difference is in the end result, where each vector will
79+
be plotted in its own separate set of axes (coordinate system),
80+
arranged vertically, with a shared X axis during navigation.
81+
"""
82+
def get_prop(k):
83+
return props[k] if k in props else None
84+
85+
title_cols, legend_cols = utils.extract_label_columns(df, props)
86+
87+
df.sort_values(by=['order'], inplace=True)
88+
89+
ax = None
90+
for i, t in enumerate(df.itertuples(index=False)):
91+
style = utils._make_line_args(props, t, df)
92+
ax = plt.subplot(df.shape[0], 1, i+1, sharex=ax)
93+
94+
if i != df.shape[0]-1:
95+
plt.setp(ax.get_xticklabels(), visible=False)
96+
ax.xaxis.get_label().set_visible(False)
97+
98+
plt.plot(t.vectime, t.vecvalue, label=legend_func(legend_cols, t, props), **style)
99+
100+
plt.subplot(df.shape[0], 1, 1)
101+
102+
title = get_prop("title") or make_chart_title(df, title_cols)
103+
utils.set_plot_title(title)
104+
75105
def plot_vectors_separate_grouped(df_list, props, legend_func=utils.make_legend_label):
76106
p = ideplot if chart.is_native_chart() else plt
77107

0 commit comments

Comments
 (0)