matplotlib / matplotlib/basemap

pcolormesh not plotting onto 'ortho' basemap

Open
#357 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
817
Forks
395
PR merge metrics
No merged PRs in 30d

Description

Hi There,

So I'm really new at this and quite out of my depth.

I was wondering if you could tell me why the following code is just giving me a blank sphere and not one with my pcolormesh information on:

----------

from mpl_toolkits.basemap import Basemap
from netCDF4 import Dataset
import matplotlib.pyplot as plt
import numpy as np

convrain_set = Dataset('proxconvrain30.nc')
lats = convrain_set.variables['latitude'][:]
lons = convrain_set.variables['longitude'][:]
convrain = convrain_set.variables['cvrain'][:]
convrain = np.squeeze(convrain)
convrain_mean = np.mean(convrain,0)

map = Basemap(projection='ortho',lat_0=45,lon_0=-100,resolution='l')

map.drawmeridians(np.arange(0,360,30))
map.drawparallels(np.arange(-90,90,30))

lon,lat = np.meshgrid(lons,lats)

map.pcolormesh(lon,lat,convrain_mean)

plt.show()

-------------

I imagine I've just missed something simple and a little silly...

(Sorry if I've pub this question in the wrong place... I figured the people here were the best placed to help...)

All the best,

Neil

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the script in the issue with Basemap, netCDF4, NumPy, and Matplotlib, then inspect the Basemap `pcolormesh` call using the supplied longitude, latitude, and `convrain_mean` arrays with the `ortho` projection. Compare the plotted result with the meridians and parallels; done means the rainfall data appears on the globe rather than showing only a blank sphere.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.