Commit af4f3fc5 authored by Sean Leavey's avatar Sean Leavey
Browse files

Move xlabel and ylabel defaults to plotter where appropriate

parent 8be496ea
......@@ -665,6 +665,15 @@ class BodePlotter(MplGroupPlotter):
self.xlim = xlim
self.mag_ylim = mag_ylim
self.phase_ylim = phase_ylim
if xlabel is None:
xlabel = r"$\bf{Frequency}$ (Hz)"
if ylabel_mag is None:
if scale_db:
ylabel_mag = r"$\bf{Magnitude}$ (dB)"
else:
ylabel_mag = r"$\bf{Magnitude}$"
if ylabel_phase is None:
ylabel_phase = r"$\bf{Phase}$ ($\degree$)"
self.xlabel = xlabel
self.ylabel_mag = ylabel_mag
self.ylabel_phase = ylabel_phase
......@@ -727,7 +736,11 @@ class SpectralDensityPlotter(MplGroupPlotter):
super().__init__(**kwargs)
self.xlim = xlim
self.ylim = ylim
if xlabel is None:
xlabel = r"$\bf{Frequency}$ (Hz)"
self.xlabel = xlabel
if ylabel is None:
ylabel = r"$\bf{Noise}$"
self.ylabel = ylabel
@property
......
......@@ -965,15 +965,6 @@ class Solution:
if not groups:
filters = ", ".join([f"'{param}'" for param in default_none_param_names])
raise NoDataException(f"No responses found. Consider setting one of {filters}.")
if xlabel is None:
xlabel = r"$\bf{Frequency}$ (Hz)"
if ylabel_mag is None:
if scale_db:
ylabel_mag = r"$\bf{Magnitude}$ (dB)"
else:
ylabel_mag = r"$\bf{Magnitude}$"
if ylabel_phase is None:
ylabel_phase = r"$\bf{Phase}$ ($\degree$)"
# Add reference functions.
groups[self.DEFAULT_REF_GROUP_NAME] = self.response_references
# Draw plot.
......@@ -1045,8 +1036,6 @@ class Solution:
if not groups:
filters = ", ".join([f"'{param}'" for param in default_none_param_names])
raise NoDataException(f"No noise spectra found. Consider setting one of {filters}.")
if xlabel is None:
xlabel = r"$\bf{Frequency}$ (Hz)"
if ylabel is None:
# Show all plotted noise units.
unit_tex = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment