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

Feedback: Mapping in Jupyter #3

Open
iandow opened this Issue Jun 28, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@iandow
Owner

iandow commented Jun 28, 2017

No description provided.

@iandow iandow changed the title from Feedback: Mapping in Jupiter to Feedback: Mapping in Jupyter Jun 28, 2017

@chriddyp

This comment has been minimized.

chriddyp commented Jun 28, 2017

Looks great! You might want to also try out an example using scattermapbox in plotly. Here are the docs: https://plot.ly/python/scattermapbox/

@iandow

This comment has been minimized.

Owner

iandow commented Jun 28, 2017

Scattermapbox looks great! Thanks for the fyi.

@dharasty

This comment has been minimized.

dharasty commented Sep 13, 2017

THANK YOU for this excellent introduction.
Trying to recreate your examples; can you point us to "california.jpg"? Likewise for any other media assets in your demos. Maybe put a link directly in the notebook. Thanks...

@iandow iandow added the feedback label Mar 13, 2018

@filipposebastio

This comment has been minimized.

filipposebastio commented Jun 29, 2018

Hi there!

I was trying to use a png map of HK to pinpoint the values of airbnb apartment, but I can only get the map (HK map), not the points! Any idea why? Providing the code and the data here, thanks!


import numpy as np
import matplotlib.image as mpimg
hk_img=mpimg.imread('C:\\Users\\Filippo Sebastio\\Desktop\\hk.png')
ax = df.plot(kind="scatter", x="longitude", y="latitude", figsize=(10,7),
                       s=df.accommodates*10, label="population",
                       c=df.price, cmap=plt.get_cmap("jet"),
                       colorbar=False, vmin=0, vmax=10000,
                      )
plt.imshow(hk_img, extent=[-113.94, -114.32, 22.22, 22.37], alpha=0.2)
plt.ylabel("Latitude", fontsize=14)
plt.xlabel("Longitude", fontsize=14)

prices = df.price
tick_values = np.linspace(prices.min(), prices.max(), 11)
cbar = plt.colorbar()
cbar.ax.set_yticklabels(["$%dk"%(round(v/100)) for v in tick_values], fontsize=14)
cbar.set_label('Price', fontsize=16)

plt.legend(fontsize=16)

the data


    id   latitude   longitude property_type   price  accommodates  \

0 69074 22.283516 114.150177 Apartment 1413.0 3
1 101765 22.200224 114.134608 Townhouse 432.0 1
2 103760 22.284074 114.155696 Apartment 856.0 6
3 132773 22.288679 114.144944 Apartment 1060.0 6
4 133390 22.283435 114.155392 Apartment 942.0 2
5 163664 22.286511 114.148743 Apartment 699.0 6
6 163742 22.286944 114.148551 Apartment 777.0 6
7 174574 22.303882 114.008875 Apartment 1578.0 8
8 228510 22.309835 114.169112 Apartment 699.0 2
9 248140 22.282905 114.151365 Apartment 1091.0 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment