user5276228
user5276228

Reputation: 197

Plot google map as background

I want to display Google map and I use this code :

url = "http://maps.googleapis.com/maps/api/staticmap?center=-30.027489,-51.229248&size=800x800&zoom=14&sensor=false"
im = Image.open(cStringIO.StringIO(urllib2.urlopen(url).read()))
plt.imshow(im)
plt.show()

this gives me:enter image description here

Which I don't understand

Upvotes: 1

Views: 2080

Answers (1)

BlackJack
BlackJack

Reputation: 4679

Take a look at the documentation of imshow() and specifically its origin argument which determines where the [0,0] index of the array is located in the plot.

The line needs to be:

plt.imshow(im, origin='upper')

Upvotes: 2

Related Questions