set_bin_labelsο
- ColorBar.set_bin_labels(bins, names, tick_lines='center', show_values=False)ο
Set the tick-labels of the colorbar to custom names with respect to a given set of bins.
The labels will be placed at the center of each bin.
This is most useful when using
Maps.set_classify.UserDefined(bins=[...])
to classify the data with respect to custom bins.- Parameters:
bins (list) β A list of (right) bin-boundaries used to set the label-positions. (e.g. bins=[1, 2, 6] will result in labels located at [1.5 and 4])
names (list) β
A list of names that should be used as labels.
The first name is assigned to the values smaller than bins[0]
Names 1 to βlen(bins)β are assigned to the intermediate bins
The βlen(bins) + 1β label is assigned to the values larger than bins[-1] (if not available a β?β label will be used)
tick_lines (str) β
Set appearance of the tick-lines
βboundaryβ: show only (minor) tick lines at the bin-boundaries
βcenterβ: show only (major) tick lines at the center of the bins
βbothβ: show both major and minor tick lines
None: donβt show any tick lines
The default is βcenterβ
show_values (bool) β If True, numerical values of the bin-boundaries will be shown as minor-tick labels. The default is False
Examples
>>> bins = [1, 2, 3] >>> names = ["smaller than 1", >>> "between 1 and 2", >>> "between 2 and 3", >>> "larger than 3"] >>> >>> m.add_colorbar() >>> m.label_bin_centers(bins, names)