basemap icon indicating copy to clipboard operation
basemap copied to clipboard

Mollweide projection centered in eastern hemisphere reverses X axis

Open d-chambers opened this issue 6 years ago • 4 comments
trafficstars

When creating a Mollweide projection map with a positive lon_0 the x axis of the plot reverses.

I am using basemap version 1.1.0, matplotlib version 3.0.2, python 3.6, and Ubuntu 18.04.


import matplotlib.pyplot as plt
import numpy as np

from mpl_toolkits.basemap import Basemap

lons = [ 20, 20]
lats = [ 40, 20]
map = Basemap(projection='moll', resolution='l',
              lon_0=np.mean(lons))

map.drawcoastlines(color='0.4')
map.drawcountries(color="0.75")

map.fillcontinents(color='coral',lake_color='aqua')
map.drawcoastlines()

x, y = map(lons, lats)
map.scatter(x, y, marker='D',color='m')
plt.show()

The code above produces this image:

image

d-chambers avatar Nov 25 '18 05:11 d-chambers

wow... that's uhm... special. Not exactly sure how that is happening. What is your version of pyproj and the proj4 library (hopefully installed via conda?)

WeatherGod avatar Nov 26 '18 17:11 WeatherGod

I can confirm that this happens with latest proj4 5.2.0 but not with proj4 4.9.3.

ocefpaf avatar Nov 26 '18 18:11 ocefpaf

Yes installed with Anaconda.

pyproj: '1.9.5.1' proj4: '5.2.0'

d-chambers avatar Nov 27 '18 05:11 d-chambers

@d-chambers I wanted to see if proj4 v6 fixes the problem but now I can't reproduce it anymore. Would you mind checking if we can use proj4 v6 safely?

megies avatar May 22 '19 09:05 megies

A fix was provided by @YilongWang for issue #463, which is essentially a duplicate this issue. Since the fix is included in the upcoming hotfix release 1.3.9, I will close this issue.

molinav avatar Nov 21 '23 21:11 molinav