proplot-dev / proplot

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

Control lon and lat gridline label color independently #362

Open zxdawn opened 2 years ago

zxdawn commented 2 years ago

Description

Sometimes, users may want to set different colors for lat and lon gridline labels. However, gridlabelcolor will change both.

Steps to reproduce

import proplot as pplt

fig, axs = pplt.subplots(proj='npstere')

axs.format(coast=True, boundinglat=60, latlines=10, facecolor='Gray',
           gridcolor='w', gridlabelcolor='b',
           gridlinewidth=2, gridlinestyle='--', latinline=True, lonlabels=True,
           )

image

Expected behavior: [What you expected to happen]

The longitude gridlabel is black and the latitude one is white.

Actual behavior:

Both are same color.

Equivalent steps in matplotlib

import matplotlib.pyplot as plt
import cartopy.crs as ccrs

ax = plt.subplot(projection=ccrs.NorthPolarStereo())
ax.set_extent([-180,180,90,60], ccrs.PlateCarree())
ax.coastlines()
gl = ax.gridlines(draw_labels=True)
gl.xlabel_style = {'color': 'k'}
gl.ylabel_style = {'color': 'b'}

image

Proplot version

3.5.1
0.9.5.post202