allow colorbar ticks at arbitrary position #113
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This extend the
ColorMap
and its successorsLinearColormap
andStepColormap
so that one may specify the positions of ticks to display independently of theindex
parameter. Currently theindex
parameter is used both to determine the color scale and as the location of the legend labels.It is possible that the two roles are better to be separated. For example, one decided to split colors by the percentile values of the data, which would result in any numeric values. However, for the visualization purpose, numbers shown in the color bar are better to be "good" numbers such as 0, 50, 100. For example, this discussion is related to this feature: python-visualization/folium#1374.
This PR enables this feature by an adding additional argument
tick_labels
toLinearColormap
andStepColormap
, which is used as the tick positions. The default value isNone
, for which the current behavior is maintained. This logic is implemented in theColorMap.render
method.In addition the
LinearColormap.to_step
method is updated so that thetick_labels
attribute is maintained to the result.Examples: