Plot gridlines crossing dateline on Lambert projection¶
In [1]:
Copied!
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
In [2]:
Copied!
# Create a Lambert Conformal projection:
# +proj=lcc +lat_0=-40.630005 +lon_0=173.08 +lat_1=-30 +lat_2=-60 +x_0=0 +y_0=0 +R=6370000 +nadgrids=@null +units=m +no_defs +type=crs'
proj = ccrs.LambertConformal(central_longitude=173.08, central_latitude=-40.630005,
false_easting=0, false_northing=0,
standard_parallels=(-30, -60))
# Draw a set of axes with coastlines:
fig = plt.figure(figsize=(9, 9), frameon=True)
ax = fig.add_axes([0.08, 0.05, 0.8, 0.94], projection=proj)
ax.set_extent([160, 190, -50, -30], crs=ccrs.PlateCarree())
ax.coastlines(resolution='50m')
ax.gridlines(draw_labels=True, xlocs=[160, 165, 170, 175, 179.99999, -175, -170])#, ylocs=[-50, -45, -40, -35, -30])
# Create a Lambert Conformal projection:
# +proj=lcc +lat_0=-40.630005 +lon_0=173.08 +lat_1=-30 +lat_2=-60 +x_0=0 +y_0=0 +R=6370000 +nadgrids=@null +units=m +no_defs +type=crs'
proj = ccrs.LambertConformal(central_longitude=173.08, central_latitude=-40.630005,
false_easting=0, false_northing=0,
standard_parallels=(-30, -60))
# Draw a set of axes with coastlines:
fig = plt.figure(figsize=(9, 9), frameon=True)
ax = fig.add_axes([0.08, 0.05, 0.8, 0.94], projection=proj)
ax.set_extent([160, 190, -50, -30], crs=ccrs.PlateCarree())
ax.coastlines(resolution='50m')
ax.gridlines(draw_labels=True, xlocs=[160, 165, 170, 175, 179.99999, -175, -170])#, ylocs=[-50, -45, -40, -35, -30])
Out[2]:
<cartopy.mpl.gridliner.Gridliner at 0x7280039f38c0>
In [3]:
Copied!
# Create a Lambert Conformal projection:
# +proj=lcc +lat_0=-40.630005 +lon_0=173.08 +lat_1=-30 +lat_2=-60 +x_0=0 +y_0=0 +R=6370000 +nadgrids=@null +units=m +no_defs +type=crs'
proj = ccrs.LambertConformal(central_longitude=173.08, central_latitude=-40.630005,
false_easting=0, false_northing=0,
standard_parallels=(-30, -60))
# Draw a set of axes with coastlines:
fig = plt.figure(figsize=(9, 9), frameon=True)
ax = fig.add_axes([0.08, 0.05, 0.8, 0.94], projection=proj)
ax.set_extent([160, 190, -50, -30], crs=ccrs.PlateCarree())
ax.coastlines(resolution='50m')
gl = ax.gridlines(draw_labels=True, x_inline=False, xlocs=[160, 165, 170, 175, 179.99999, -175, -170])#, ylocs=[-50, -45, -40, -35, -30])
gl.xlabel_style = dict(rotation=0, ha='center') #{'size': 6, 'color': 'w', 'rotation': 0, 'ha':'right'}
gl.right_labels = False
gl.top_labels = False
# Create a Lambert Conformal projection:
# +proj=lcc +lat_0=-40.630005 +lon_0=173.08 +lat_1=-30 +lat_2=-60 +x_0=0 +y_0=0 +R=6370000 +nadgrids=@null +units=m +no_defs +type=crs'
proj = ccrs.LambertConformal(central_longitude=173.08, central_latitude=-40.630005,
false_easting=0, false_northing=0,
standard_parallels=(-30, -60))
# Draw a set of axes with coastlines:
fig = plt.figure(figsize=(9, 9), frameon=True)
ax = fig.add_axes([0.08, 0.05, 0.8, 0.94], projection=proj)
ax.set_extent([160, 190, -50, -30], crs=ccrs.PlateCarree())
ax.coastlines(resolution='50m')
gl = ax.gridlines(draw_labels=True, x_inline=False, xlocs=[160, 165, 170, 175, 179.99999, -175, -170])#, ylocs=[-50, -45, -40, -35, -30])
gl.xlabel_style = dict(rotation=0, ha='center') #{'size': 6, 'color': 'w', 'rotation': 0, 'ha':'right'}
gl.right_labels = False
gl.top_labels = False
In [ ]:
Copied!