Skip to content
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

Change the 'N' notation by decimal lat/lon degrees #449

Open
SofiViotto opened this issue Feb 16, 2024 · 2 comments
Open

Change the 'N' notation by decimal lat/lon degrees #449

SofiViotto opened this issue Feb 16, 2024 · 2 comments

Comments

@SofiViotto
Copy link

Description

Hi Luke!
I have been working with proplot as I can make beautiful plots. So, first of all, THANK YOU!
However, I always struggle a bit when working with GeoAxis. In this case, I want my maps to show the latitude coordinates as, for example, '-25.50' instead of '25.50° W' and I've been trying to change it but all my attempts failed.

Any ideas on how to change the format?

Best,
Sofia

Steps to reproduce

This is a minimal example

fig,axs=pplt.subplots(ncols=3,nrows=2,proj='cyl')
axs.format(lonlim=(-67.15, -64.95), latlim=(-28, -24),labelsize=7, 
           gridminor=False,dms=False,lonlocator=1, latlocator=1 ,
              labels=True,borders=True, borderscolor='white'
           )
fig.format(abc='A.',abcloc='ul')

for ax in axs:
    ax._gridlines_major.ylabel_style.update({'rotation': 90})

Proplot version

Matplotlib Version : 3.4.3
Proplot Version: 0.9.7
Cartopy Version: 0.22.0

@AWSisco
Copy link

AWSisco commented Feb 27, 2024

Sofia,

Does the following address what you are trying to do? Removing number_format='.2f' will remove the extra decimal places if you do not need them. I also don't know why the negative signs are appearing as hyphens and not a Unicode minus, but that is perhaps a separate issue.

import proplot as pplt
import cartopy

fig,axs=pplt.subplots(ncols=3,nrows=2,proj='cyl')
axs.format(lonlim=(-67.15, -64.95), latlim=(-28, -24),labelsize=7, 
           gridminor=False,dms=False,lonlocator=0.5, latlocator=0.5,
           labels=True,borders=True, borderscolor='white',
           latformatter=cartopy.mpl.ticker.LatitudeFormatter( degree_symbol='',direction_label=False, number_format='.2f'),
           lonformatter=cartopy.mpl.ticker.LongitudeFormatter(degree_symbol='',direction_label=False, number_format='.2f')
          )

fig.format(abc='A.',abcloc='ul')

for ax in axs:
    ax._gridlines_major.ylabel_style.update({'rotation': 90})

sofia

Matplotlib Version : 3.5.3
Proplot Version: 0.9.5.post360
Cartopy Version: 0.20.3

@SofiViotto
Copy link
Author

Hi Adam!
Yes, thanks very much!
Best,
Sofia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants