Skip to content

Plot space that crosses 180 degrees #5450

Closed Answered by rcomer
rebeccaherman1 asked this question in Q&A
Discussion options

You must be logged in to vote

Maybe have a look at Cartopy's gridlines method for axis labels. xticks is a Matplotlib thing, and Matplotlib doesn't know anything about Cartopy's special transforms.

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import numpy as np
import iris
import iris.quickplot as qplt

cube = iris.load_cube("pacific_example.nc")
ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=210))
qplt.pcolormesh(cube, axes=ax)

ax.gridlines(draw_labels=True, linewidth=0, xlocs=[160, 180, -160, -140, -120, -100, -80])

plt.show()

Replies: 13 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by HGWright
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants
Converted from issue

This discussion was converted from issue #5387 on August 30, 2023 09:16.