1313from emsarray .plot import make_plot_title
1414from emsarray .types import DataArrayOrName , Landmark
1515from emsarray .utils import name_to_data_array
16+
1617from .base import Transect
1718
1819
@@ -77,6 +78,7 @@ def plot(
7778
7879 setup_distance_axis (transect , axes )
7980 if depth_coordinate is not None :
81+ ylim : tuple [float , float ] | bool
8082 if len (transect .segments ) > 0 :
8183 depths_with_data = numpy .flatnonzero (numpy .isfinite (transect_data .values ).any (axis = - 1 ))
8284 depth_bounds = dataset [depth_coordinate .attrs ['bounds' ]]
@@ -85,7 +87,7 @@ def plot(
8587 depth_bounds .values [depths_with_data [- 1 ], 1 ],
8688 )
8789 else :
88- ylim = None
90+ ylim = False
8991 setup_depth_axis (transect , axes , depth_coordinate = depth_coordinate , ylim = ylim )
9092
9193 if bathymetry is not None :
@@ -181,12 +183,12 @@ def setup_depth_axis(
181183 axes .set_ylim (depth_max , depth_min )
182184 else :
183185 axes .set_ylim (depth_min , depth_max )
184- elif ylim not in { False , None } :
186+ elif ylim is not False :
185187 axes .set_ylim (ylim )
186188
187189 if label is True :
188- label = depth_coordinate .attrs .get ('long_name' )
189- if label not in { False , None } :
190+ label = str ( depth_coordinate .attrs .get ('long_name' ) )
191+ if label is not None and label is not False :
190192 axis .set_label_text (label )
191193
192194 if units is True :
0 commit comments