Open snowzky opened 2 years ago
Yes, there are many things to improve or clarify. Most of the complexity and limitations are due to the fact that we work in projected coordinate and that the map boundary is not always rectangular or circular. Have tried to set en negative padding?
I think, these points should be addressed one by one when relevant. Do you have a some time to spend on it? Pull requests+feedbacks should help.
Description
Gridlines now work for other than PlateCaree projections, great. Except the handling leaves much to desire. I am using a somewhat zoomed-in view of a specific region of the globe because that is where my data is, and I expect cartopy to also be able handle this kind of cases.
I propose adding the functionality and control to draw_labels - and importantly, to separate gridlines and labels thereof - just like it is in regular matplotlib plotting.
List of improvements
0) Add option for ticks to the axis, either inside or outside, just like for regular plots. Inside mean drawing the gridline slightly bigger for a few points.
1) No documentation of what keyword "geo" means in draw_labels, "For all labels one would use ["x", "y", "top", "bottom", "left", "right", "geo"]."
2) Bug? Setting x or y_inline to true while also using {"bottom": "x", "left": "y"} produces two instances of x or y labels respectively. What is the expected behavior? How can we get one instance of either x or y while also inline labeling?
3) No fine control of the inline placement: why can the user not specify the latitude placement for a longitude label and vice versa? The automatic inline is not always good. (see examples in this post).
4) xlocs and ylocs controls where to draw gridlines. But what if I want more gridlines than I want labels? This is a completely normal case, you might want to show latitude with lines every 3 degree spacing but you don't need to label intermediate lines. Just like for matplotlib, I wish to set xticks and xticklabels (and for y of course) separately.
5) Bugs or wrong behavior with LambertConformal ...? Could be related to issue 1943.
Setting
draw_labels={"bottom": "x", "left": "y"}
still produces two rows of inline longitude labels. Possibly related to example 2, since x_inline is False by default for LambertConformal (I guess: Where do I find default settings for the projections in the docs?)If I in addition set
x_inline=False
(True by default for this projection) it obeys the settings, but the labels now have vertical orientation. The labels rotate to "follow" the gridline orientation it seems. When inline, they were horizontal with no rotation. Addingrotate_labels=False
affects also the ylabels (not shown), what if I want to keep those rotated?the ylabels are by default rotated to follow latitude lines and placed outside, and if set inside no orientation. The latter could be bugged behavior, due to the two instances. Also, if the ylabels inside, the xlabels disappear (presumably due to lack of space, or same bug?)
Code to reproduce
Example 2:
Example 5:
My specific customization case
If anyone has tips or tricks to how I can get latitude y outside, longitude x inside, control placement of inline x label, correct rotation of potential outside x label, and more gridlines than labels - it would be much appreciated. I obviously came across these bugs/lack of control when trying to plot my specific cases. I maintain though that a level of control alike to matplotlib's xticks and xticklabels would be very useful for cartopy. If it can be obtained by switching to matplotlib, that would be okay too, but unfortunately there is not enough examples and documentation for that.
Full environment definition
### Operating system Linux Mint 19.1 ### Cartopy version 20.2