-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CEA projection: plotting all the data works, plotting part of the data fails. #126
Comments
Here is a small workaround for you: from mpl_toolkits import basemap
from matplotlib.lines import Line2D
import matplotlib.pyplot as plt
m1 = basemap.Basemap(projection='cea', lon_0=0)
m1.drawcoastlines()
lon = [-135, -45, 45, 135]
lat = [45, 45, 45, 45]
x, y = m1(lon[:2], lat[:2])
ax = plt.gca()
ax.plot(*m1(lon[:2], lat[:2])) This way (without latlon=True) the problematic function is not called... Probably latlon=True is there only for large arrays, and I suppose ideally even uniform.. Cheers |
Actually this also works fine: from mpl_toolkits import basemap
m1 = basemap.Basemap(projection='cea', lon_0=0)
m1.drawcoastlines()
lon = [-135, -45, 45, 135]
lat = [45, 45, 45, 45]
m1.plot(*m1(lon[:2], lat[:2])) |
I think a good fix would be to check the latlon=True and the length of the arrays and throw an exception if the length is less than 3, with an explanation like: latlon=True is only for uniform grids with lots of points... |
Is |
Actually it is also calling shiftdata and the shiftdata is kind of limited, here is the doc to shiftdata:
It actually might work for nonuniform grids, but I am not sure if it is |
Duplicating the code here, I could not make it highlighted above, probably because I sent it using email... def shiftdata(self,lonsin,datain=None,lon_0=None):
""" Shift longitudes
(and optionally data) so that they match map projection region. Only valid
for cylindrical/pseudo-cylindrical global projections and data on regular
lat/lon grids. longitudes and data can be 1-d or 2-d, if 2-d it is assumed
longitudes are 2nd (rightmost) dimension.
""" |
I am pretty sure that shiftdata is not needed for scatter, so I've created a PR for that, but I am not sure about plot though... |
You need it for plot so that a path drawn around over the pacific doesn't On Thu, Aug 27, 2015 at 3:20 PM, Huziy Oleksandr (Sasha) <
|
We have also encountered issues using |
Using the following setup, Python 2.7/matplotlib 1.2.1/basemap 1.0.6
If I then run the following command, the line plots as expected:
But plotting just the first two points alone gives a failure:
Here's the result:
Edit: here's an error from a similar call, but I believe it's unrelated to the first:
error:
The text was updated successfully, but these errors were encountered: