proplot-dev / proplot

🎨 A succinct matplotlib wrapper for making beautiful, publication-quality graphics
https://proplot.readthedocs.io
MIT License
1.12k stars 102 forks source link

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

Open SofiViotto opened 9 months ago

SofiViotto commented 9 months ago

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 commented 9 months ago

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 commented 8 months ago

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