Skip to content

Help with weird uxarray, matplotlib, and orthographic plot #1489

Description

@erogluorhan

Today I was trying out different things with uxarray and some data and found an...oddity. With the bokeh backend, I get a nice pretty image with an Orthographic projection:

bokeh_ortho_plot

but when I try and use the matplotlib backend:

Screenshot 2026-04-13 at 10 56 38 AM

Does anyone know what I might be doing wrong? My "relevant" code is:

import uxarray as ux
import geoviews as gv
import geoviews.feature as gf
import cartopy
import cartopy.feature as cf
import cartopy.crs as ccrs
import holoviews as hv

graticules = cf.NaturalEarthFeature(
    category='physical',
    name='graticules_15',
    scale='50m')

ofeatures = gf.coastline(
    projection=ccrs.Orthographic(), line_width=1, scale="50m"
) * gf.borders(
    projection=ccrs.Orthographic(), line_width=1, scale="50m"
) * gv.Feature(graticules, group='Lines')

ortho_plot = uxds['SLP'][0].plot.polygons(
    rasterize=True, 
    cmap='viridis', 
    backend='matplotlib', 
    projection=ccrs.Orthographic(),
).opts(
    global_extent=True,
    xaxis=None,
    yaxis=None 
) * ofeatures

Just the backend change in ortho_plot is the differences between these two. Note: This is a mix of uxarray examples and Gemini/ChatGPT/whatever so I freely admit I probably did something stupid!

Originally posted by @mathomp4 in #1488

Metadata

Metadata

Assignees

Labels

fix upstreamTo be fixed upstream, or awaiting a fix to be merged upstream; fixing it here is not the solution.visualizationPlotting or other visualizations

Type

No type

Projects

Status
On Pause

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions