Skip to content

Commit

Permalink
Merge pull request #463 from NCAR/native_2
Browse files Browse the repository at this point in the history
Native_2 add_lat_lon_gridlines
  • Loading branch information
Heather Craker committed Jul 19, 2022
2 parents 93c47a8 + 0f6c6bc commit 324a509
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions Gallery/MapProjections/NCL_native_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker

import geocat.datafiles as gdf
import geocat.viz as gv

###############################################################################
# Read in data:
Expand Down Expand Up @@ -68,28 +68,23 @@
ticks=cbar_ticks)

# Draw gridlines
gl = ax.gridlines(crs=ccrs.PlateCarree(),
draw_labels=True,
dms=False,
x_inline=False,
y_inline=False,
linewidth=1,
color="black",
alpha=0.25)

# Manipulate latitude and longitude gridline numbers and spacing
gl = gv.add_lat_lon_gridlines(
ax,
color='grey',
labelsize=14,
xlocator=np.arange(130, 144, 4), # longitudes for gridlines
ylocator=np.arange(36, 51, 2)) # latitudes for gridlines

# Remove lat/lon labels on top and right sides of plot
gl.top_labels = False
gl.right_labels = False
gl.xlocator = mticker.FixedLocator([130, 134, 138, 142])
gl.ylocator = mticker.FixedLocator([36, 38, 40, 42, 44, 46, 48, 50])
gl.xlabel_style = {"rotation": 0, "size": 15}
gl.ylabel_style = {"rotation": 0, "size": 15}

# Add title
plt.title("Native Mercator Projection",
loc="center",
y=1.05,
size=15,
fontweight="bold")
fontweight="bold",
pad=0)
plt.title(t.units, loc="right", y=1.0, size=14)
plt.title("free surface deviation", loc="left", y=1.0, size=14)

Expand Down

0 comments on commit 324a509

Please sign in to comment.