utils.draw.plot_error_curves¶
Function ยท Source
mdnc.utils.draw.plot_error_curves(
gen, x_error_num=10,
y_error_method='std', plot_method='error',
xlabel=None, ylabel='value', y_log=False,
figure_size=(6, 5.5), legend_loc=None, legend_col=None,
fig=None, ax=None
)
Plot lines with error bars for multiple data groups. Each group is given by:
- one 1D array and one 2D array, representing the x axis (assuming to have a shape of
(N,)
) and a stack of data samples (with a shape of(N, M)
). Each time point corresponds toM
samples in the same distribution. - or a 2D array. In this case, we only have the
(N, M)
data stack.
Arguments¶
Requries
Argument | Type | Description |
---|---|---|
gen | object | A generator callable object (function), each yield returns a sample. It allows users to provide an extra kwargs dict for each iteration (see Examples). For each iteration, it returns 1D + 2D arrays, or a single 2D array. |
x_error_num | int | The number of displayed error bars. |
y_error_method | str | The method for calculating the error bar. Could be:
|
plot_method | str | The method for plotting the figure. Could be:
|
xlabel | str | The x axis label. |
ylabel | str | The y axis label. |
y_log | bool | A flag. Whether to convert the y axis into the logarithmic format. |
figure_size | (float, float) | A tuple with two values representing the (width, height) of the output figure. The unit is inch. |
legend_loc | str orint or(float, float) | The localtion of the legend, see matplotlib.pyplot.legend to view details. (The legend only works when passing label to each iteration). |
legend_col | int | The number of columns of the legend, see matplotlib.pyplot.legend to view details. (The legend only works when passing label to each iteration). |
fig | object | A matplotlib figure instance. If not given, would use plt.gcf() for instead. |
ax | object | A matplotlib subplot instance. If not given, would use plt.gca() for instead. |
Examples¶
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
Last update: March 14, 2021