@@ -106,11 +106,10 @@ def imshow(
106106
107107 labels : dict with str keys and str values (default `{}`)
108108 Overrides names used in the figure for axis titles (keys ``x`` and ``y``),
109- colorbar title (key ``colorbar``) and hover (key ``color``). The values
110- should correspond to the desired label to be displayed. If ``img`` is an
111- xarray, dimension names are used for axis titles, and long name for the
112- colorbar title (unless overridden in ``labels``). Possible keys are:
113- x, y, color and colorbar.
109+ colorbar title and hover (key ``color``). The values should correspond
110+ to the desired label to be displayed. If ``img`` is an xarray, dimension
111+ names are used for axis titles, and long name for the colorbar title
112+ (unless overridden in ``labels``). Possible keys are: x, y, and color.
114113
115114 color_continuous_scale : str or list of str
116115 colormap used to map scalar data to colors (for a 2D image). This parameter is
@@ -169,7 +168,6 @@ def imshow(
169168 args = locals ()
170169 apply_default_cascade (args )
171170 img_is_xarray = False
172- colorbar_title = ""
173171 if xarray_imported :
174172 if isinstance (img , xarray .DataArray ):
175173 y_label , x_label = img .dims [0 ], img .dims [1 ]
@@ -183,7 +181,6 @@ def imshow(
183181 if aspect is None :
184182 aspect = "auto"
185183 z_name = xarray .plot .utils .label_from_attrs (img ).replace ("\n " , "<br>" )
186- colorbar_title = z_name
187184
188185 if labels is not None :
189186 if "x" in labels :
@@ -192,8 +189,6 @@ def imshow(
192189 y_label = labels ["y" ]
193190 if "color" in labels :
194191 z_name = labels ["color" ]
195- if "colorbar" in labels :
196- colorbar_title = labels ["colorbar" ]
197192
198193 if not img_is_xarray :
199194 if aspect is None :
@@ -226,7 +221,7 @@ def imshow(
226221 cmid = color_continuous_midpoint ,
227222 cmin = range_color [0 ],
228223 cmax = range_color [1 ],
229- colorbar = dict (title = colorbar_title ),
224+ colorbar = dict (title = z_name ),
230225 )
231226
232227 # For 2D+RGB data, use Image trace
0 commit comments