-
Notifications
You must be signed in to change notification settings - Fork 235
Figure.colorbar: Add position/length/width and more parameters to specify colorbar position and properties #4048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it would be good to add an alias for -S,
-S[+aangle][+c|n][+r][+s][+xlabel][+yunit]
as I realized that this flags allows to set x and y labels in case frame (-B) cannot be used, e.g., if equalsize (-L) is used.
I am wondering if adding an alias, e.g., appearance, using the old alias system still makes sense or if we should do this directly using the new alias system to introduce aliases for the single modifieres.
d846477 to
a352945
Compare
0607414 to
c892202
Compare
…cify colorbar position and properties
c892202 to
8bdb98e
Compare
yvonnefroehlich
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one small typo for now, will look at this PR in detail today or tomorrow.
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
pygmt/src/colorbar.py
Outdated
| nan_rectangle: bool | str = False, | ||
| nan_rectangle_position: Literal["start", "end"] | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps shorter names nan and nan_position are better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think nan_position (or nan_side) is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've renamed them to nan/nan_position in 57f8c39.
pygmt/src/colorbar.py
Outdated
| sidebar_triangles: bool | Literal["foreground", "background"] = False, | ||
| sidebar_triangles_height: float | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The names are also a little too long. It's also unclear what sidebar means. What about fg_triangle/bg_triangle and triangle_height?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree that these names are a bit long. fg_trinagle and bg_triangle would mean we have two parameters, correct? Maybe cb_triangles; "cb" for "colorbar", which is clearer as "sidebar"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel cb_triangles is a bad name for two reasons:
- It's unclear what
cbstands for - This is a parameter for
Figure.colorbar, so the prefixcb(short forcolorbar) is a little duplicate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about fgcolor/bgcolor, which fgcolor=True/bgcolor=True means draw a triangle for foreground/background color.
fgcolor/bgcolor are also used in the Pattern class, but it takes a color, not a boolean value.
Edit: fgcolor/bgcolor may be good names, but it would be unclear what triangle_height means.
So, I still prefer fg_triangle/bg_triangle/triangle_height.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've renamed them to fg_triangle/bg_triangle/triangle_height in 405383c.
[g|j|J|n|x]<refpoint>[+j<justify>][+o<dx>[/<dy>]]position+w<length>[/<width>]]length/widthsizesize[+e[b|f][<length>]]fg_triangle/bg_triangle/triangle_heighttrianglestriangles[+h|v]oriention="horizontal"or "vertical"horizontal,verticalhorizontal[+n|N[<txt>]]nan/nan_positionnannan[+r]reversereverseReferences
Preview: https://pygmt-dev--4048.org.readthedocs.build/en/4048/api/generated/pygmt.Figure.colorbar.html#pygmt.Figure.colorbar