0

I have data in x, z, where x is longitude in degrees, and z is an altitude in km.

I'd like to be able to use Cartopy's "intelligent" handling of the longitude axis (namely, the ability to center the data at any chosen point lon0, which handles the data wrapping across the periodic boundary).

if my coordinates were lat, lon, this is easy, and involves sending a projection argument to the axis object, and a transform argument to the plot object:

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

fig = plt.figure()
ax = fig.add_subplot(111, projection=ccrs.PlateCarree())
ax.plot(lat, lon, data, transform=ccrs.PlateCarree())

I think what I need to be able to do is effectively only apply the transform to the x-axis. In other words, I'd like to plot vertical cross sections with the power of Cartopy, rather than the standard use case of horizontal cross sections.

Edit: perhaps all I need to is use a polar transform on the data, where $x$ is interpreted as the angular coordinate. But I would need to do this transformation without doing the associated projection (I still want my plot to be a rectangle, I just want to the data to behave in a period manner)

pretzlstyle
  • 2,774
  • 5
  • 23
  • 40
  • You need to use `Blended transformations` https://matplotlib.org/3.5.0/tutorials/advanced/transforms_tutorial.html . – swatchai Apr 20 '22 at 10:08
  • @swatchai Thanks, this looks promising. It looks like this requires me to create an `x_transform` object to pass to `blended_transform_factory`. It is not yet clear to me how to construct this object. Please post some more info if you have some know-how – pretzlstyle Apr 20 '22 at 22:45
  • Please post small representative data set and sample output plot(s) or sketches that you want as the output. Data will be used in the code. Plots/sketches will help the readers to understand more exactly what the requirements are. – swatchai Apr 21 '22 at 01:42
  • This is another useful link: https://matplotlib.org/3.5.0/gallery/scales/scales.html – swatchai Apr 21 '22 at 01:44
  • @swatchai I actually made a new question that is more precise, and had example code and data, please see here: https://stackoverflow.com/questions/71935036/plotting-in-polar-space-in-matplotlib – pretzlstyle Apr 21 '22 at 06:44

0 Answers0