Figure.colorbar: Add parameters label/unit/annot/tick/grid and more to set colorbar annotations/labels#4407
Figure.colorbar: Add parameters label/unit/annot/tick/grid and more to set colorbar annotations/labels#4407
Conversation
bc05436 to
955f58d
Compare
955f58d to
64ef1d7
Compare
e2c4db4 to
8911a57
Compare
584c3d0 to
7aa50bd
Compare
|
Ping @GenericMappingTools/pygmt-maintainers for final reviews. |
| unit | ||
| Set the label and unit for the colorbar. The label is placed along the colorbar | ||
| and the unit is placed at the end of the colorbar. | ||
| annot | ||
| tick | ||
| grid | ||
| Intervals for annotations, ticks, and gridlines. Refer to | ||
| :class:`pygmt.params.Axis` for more details on how these parameters work. | ||
| annot_prefix | ||
| annot_unit | ||
| annot_angle | ||
| The prefix, unit and angle for the annotations. The prefix is placed before the | ||
| annotation text; the unit is placed after the annotation text; and the angle is | ||
| the angle of the annotation text. |
There was a problem hiding this comment.
I think this is coming from to be consistent with GMT.
I personally find it confusing to call the y-label "unit" in case the frame is related to a colorbar. Thus we have here "annot_unit" for the unit opitionally added after the annotations, but "unit" in case the frame is related to a basemap.
There was a problem hiding this comment.
I'm also debating which one to choose:
- If we follow the convention used for the
frameparameter, the names should bexlabel/ylabel/annot_prefix/annot_unit/annot_angle(x- and y-label mean labels of long and short dimensions of the colorbar) - If we follow the convention used by the GMT colorbar docs, the names should be
label/unit/annot_prefix/annot_unit/annot_angle(labelandunitare text strings displayed along the long and short dimensions of a colorbar;unitdoesn't have to be a "unit";unitandannnot_unitmay be more confusing)
Or maybe we should call them xlabel/ylabel/annot_prefix/annot_suffix/annot_angle?
There was a problem hiding this comment.
I'm also debating which one to choose:
- If we follow the convention used for the
frameparameter, the names should bexlabel/ylabel/annot_prefix/annot_unit/annot_angle(x- and y-label mean labels of long and short dimensions of the colorbar)
Hm. Maybe I am already confused by myself 🙃. But do you maybe mean xlabel/ylabel/prefix/unit/angle here?
There was a problem hiding this comment.
No, I meant annot_prefix/annot_unit/annot_angle.
While prefix/unit/angle work well in the Axis class for the frame parameter, they're too ambiguous for colorbar annotations. In a colorbar context, it's unclear what prefix mean? I think adding the annot_ prefix can make the parameter's purpose clear to understand.
There was a problem hiding this comment.
Looking at the changes in https://github.com/GenericMappingTools/pygmt-paper-figures/pull/39/changes, only label/unit/annot/tick/grid are used in the examples, and annot_prefix/annot_unit/annot_angle are not used.
So we just need to decide if we want xlabel/ylable or label/unit. We can discuss/implement annot_prefix/annot_unit/annot_angle in a separate PR instead.
There was a problem hiding this comment.
I prefer xlabel / ylabel. @weiji14, @michaelgrund what do you think / prefer?
There was a problem hiding this comment.
I also prefer xlabel/ylabel, so we have at least two votes in favor. We'll proceed with xlabel/ylabel unless any of @weiji14, @michaelgrund, @willschlitzer has strong objections.
There was a problem hiding this comment.
I somewhat prefer label/unit because it'll get confusing when you have a vertical colorbar (see elevation example in https://www.pygmt.org/v0.18.0/gallery/embellishments/colorbar.html), in which case xlabel (label) is on the 'y-axis' and ylabel (unit) is on the x-axis. But no strong opinions if we decide to go with xlabel/ylabel.
See #4243 (comment) for context. After #4406.
Preview: https://pygmt-dev--4407.org.readthedocs.build/en/4407/api/generated/pygmt.Figure.colorbar.html#pygmt.Figure.colorbar