Fix `plot_uncertainty_bounds_component()`.
Issue one: the supplied axes object is not used, current
one is taken instead. When using sub-plots, this results in
all plots of given type ending in the last active plot.
Issue two: `numpy.ComplexWarning` is raised when the
`ax.fill_between()` is called due to complex values of both
`upper_bound` and `lower_bond`.
@@ -1594,6 +1594,9 @@ def plot_uncertainty_bounds_component(
'''
+ if ax is None:
+ ax = plb.gca()
+
if m is None:
M = range(self[0].number_of_ports)
else:
@@ -1608,8 +1611,6 @@ def plot_uncertainty_bounds_component(
plot_attribute = attribute
- ax = plb.gca()
-
ntwk_mean = self.__getattribute__('mean_'+attribute)
ntwk_std = self.__getattribute__('std_'+attribute)
ntwk_std.s = n_deviations * ntwk_std.s
@@ -1635,7 +1636,7 @@ def plot_uncertainty_bounds_component(
if color_error is None:
color_error = ax.get_lines()[-1].get_color()
ax.fill_between(ntwk_mean.frequency.f,
- lower_bound, upper_bound, alpha=alpha, color=color_error,
+ lower_bound.real, upper_bound.real, alpha=alpha, color=color_error,
**kwargs_error)
# ax.plot(ntwk_mean.frequency.f_scaled, ntwk_mean.s[:,m,n],*args,**kwargs)
