Skip to content

Commit

Permalink
Merge 53b5114 into ef98259
Browse files Browse the repository at this point in the history
  • Loading branch information
macrocosme committed Apr 28, 2021
2 parents ef98259 + 53b5114 commit f34f7fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion vispy/scene/widgets/colorbar.py
Expand Up @@ -78,7 +78,7 @@ def __init__(self, cmap, orientation,

self._colorbar = ColorBarVisual(size=dummy_size, cmap=cmap,
orientation=orientation,
label_str=label, clim=clim,
label_text=label, clim=clim,
label_color=label_color,
border_width=border_width,
border_color=border_color, **kwargs)
Expand Down
12 changes: 7 additions & 5 deletions vispy/visuals/colorbar.py
Expand Up @@ -255,7 +255,7 @@ class ColorBarVisual(CompoundVisual):
pos : tuple (x, y)
Position where the colorbar is to be placed with
respect to the center of the colorbar
label_str : str
label_text : str
The label that is to be drawn with the colorbar
that provides information about the colorbar.
label_color : str | vispy.color.Color
Expand All @@ -280,22 +280,21 @@ class ColorBarVisual(CompoundVisual):

def __init__(self, cmap, orientation, size,
pos=[0, 0],
label_str="",
label_text="",
label_color='black',
clim=(0.0, 1.0),
border_width=1.0,
border_color="black",
**kwargs):

self._label_str = label_str
self._label_color = label_color
self._cmap = get_colormap(cmap)
self._clim = clim
self._pos = pos
self._size = size
self._orientation = orientation

self._label = TextVisual(self._label_str, color=self._label_color)
self._label = TextVisual(label_text, color=self._label_color)

self._ticks = []
self._ticks.append(TextVisual(str(self._clim[0]),
Expand Down Expand Up @@ -597,7 +596,10 @@ def label(self):

@label.setter
def label(self, label):
self._label = label
if isinstance(label, str):
self._label.text = label
else:
self._label = label
self._update()

@property
Expand Down

0 comments on commit f34f7fb

Please sign in to comment.