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

Missing 180 degree label in 'npaeqd' projection #417

Open
664787022 opened this issue Apr 6, 2023 · 3 comments
Open

Missing 180 degree label in 'npaeqd' projection #417

664787022 opened this issue Apr 6, 2023 · 3 comments
Labels

Comments

@664787022
Copy link

Description

When I set proj='npaeqd', proplot 0.9.7 does not show all longitude labels, but only far bottom label . This problem does not exists in 0.9.5.post332.

import proplot as pplt
import numpy as np

fig, ax = pplt.subplots(ncols=2, nrows=2, proj='npaeqd', share=False)
ax.format(labels=True, coast=True,
          lonlocator=np.arange(-180,180+30,30))

image

Steps to reproduce

import proplot as pplt
import numpy as np

fig, ax = pplt.subplots(ncols=2, nrows=2, proj='npaeqd', share=False)
ax.format(labels=True, coast=True,
          lonlocator=np.arange(-180,180+30,30))

Expected behavior:
 
show longitude labels as in proplot 0.9.5.post332
 
image


 
By the way, how can I make longitude labels like this as in cartopy? ( showing far top label 180° compared to picture 2)
 

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import matplotlib.path as mpath
import numpy as np

fig = plt.figure(figsize=[10, 5])
ax1 = fig.add_subplot(1, 2, 1, projection=ccrs.NorthPolarStereo())

leftlon, rightlon, lowerlat, upperlat = (-180,180,0,90)
ax1.set_extent([leftlon, rightlon, lowerlat, upperlat], ccrs.PlateCarree())

# add labels
ax1.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
              xlocs = np.arange(-180,180+30,30), 
              linewidth=1, color='grey',linestyle='--')

# set the boundary
theta = np.linspace(0, 2*np.pi, 100)
center, radius = [0.5, 0.5], 0.5
verts = np.vstack([np.sin(theta), np.cos(theta)]).T
circle = mpath.Path(verts * radius + center)
ax1.set_boundary(circle, transform=ax1.transAxes)

image

 
Actual behavior: Only showing the far bottom label as in picture 1.

Equivalent steps in matplotlib

import proplot as pplt
import numpy as np

fig, ax = pplt.subplots(ncols=2, nrows=2, proj='npaeqd',share=False)
ax.format(labels=True, coast=True,
          lonlocator=np.arange(-180,180+30,30))

Proplot version

matplotlib 3.4.3
proplot 0.9.7
cartopy 0.20.2

@lukelbd
Copy link
Collaborator

lukelbd commented Apr 6, 2023

Hi there -- it's a little confusing, but the 0.9.5.postXYZ versions you get from installing "dev" are actually newer than 0.9.7. I just created 0.9.7 by going back in the version history to the last release, creating a branch, and enforcing a maximum matplotlib version in setup.cfg on that branch, so that people installing stable versions of proplot for the first time get compatible matplotlib versions (see #309 -- think this is common practice for other packages... but took me a long time to figure out). It doesn't show 0.9.7.postXYZ when you install "dev" just because 0.9.7 lives on a separate branch.

So, this is already fixed :). And re: cartopy grid labels, you can pass rotatelabels=True to format() or set pplt.rc['grid.rotatelabels'] = True. Proplot just picks a different default behavior there.

@664787022
Copy link
Author

664787022 commented Apr 6, 2023

Hi there -- it's a little confusing, but the 0.9.5.postXYZ versions you get from installing "dev" are actually newer than 0.9.7. I just created 0.9.7 by going back in the version history to the last release, creating a branch, and enforcing a maximum matplotlib version in setup.cfg on that branch, so that people installing stable versions of proplot for the first time get compatible matplotlib versions (see #309 -- think this is common practice for other packages... but took me a long time to figure out). It doesn't show 0.9.7.postXYZ when you install "dev" just because 0.9.7 lives on a separate branch.

So, this is already fixed :). And re: cartopy grid labels, you can pass rotatelabels=True to format() or set pplt.rc['grid.rotatelabels'] = True. Proplot just picks a different default behavior there.

Thanks a lot! I do not know much about branch management and sorry for bothering.
What I am actually confused in my second question is that proplot lost the far top longitude label 180°. Is there a way to add 180° as in Cartopy?
图片2

@lukelbd
Copy link
Collaborator

lukelbd commented Apr 6, 2023

Hmm not sure about that. I'll re-open

@lukelbd lukelbd reopened this Apr 6, 2023
@lukelbd lukelbd added bug and removed already fixed labels Apr 6, 2023
@lukelbd lukelbd changed the title longitude labels go wrong in 'npaeqd' projection Missing 180 degree label in 'npaeqd' projection Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants