Skip to content

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

Open

Description

@SofiViotto

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

Activity

  1. AWSisco commented on Feb 27, 2024

    @AWSisco

    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

  2. SofiViotto commented on Mar 7, 2024

    @SofiViotto
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions