Skip to content

Another bug plotting geographic data with 2D longitude/latitude #54

Closed
@lukelbd

Description

@lukelbd

This file with 2D longitude/latitude arrays causes a weird streaking issue when you do a pcolormesh plot.

import os
import xarray as xr
file = os.path.expanduser('~/Downloads/data.for.luke.nc')
data = xr.open_dataset(file)

# proplot
levels = plot.arange(0, 0.012, 0.001)
import proplot as plot
f, ax = plot.subplots(proj='cyl', width=5)
ax.pcolormesh(data.ULONG, co2.ULAT, data.PH_ALT_CO2, levels=levels, cmap='Fire', colorbar='b')
ax.format(facecolor='gray')

# pyplot
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
f, ax = plt.subplots(figsize=(5,3.5), subplot_kw={'projection':ccrs.PlateCarree()})
c = ax.pcolormesh(data.ULONG, co2.ULAT, data.PH_ALT_CO2, # levels=levels,
                vmin=min(levels), vmax=max(levels),
                cmap='Fire', transform=ccrs.PlateCarree())
f.colorbar(c, ax=ax, orientation='horizontal')
ax.patch.set_facecolor('gray')
f.subplots_adjust(0.02, 0.02, 0.98, 0.98)

example pyplot
example proplot

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions