Gianx
Gianx

Reputation: 243

Bokeh for presenting data on Italy map

I need to use Bokeh to plot datas on Italian map.

To explain, something similar with:

http://docs.bokeh.org/en/latest/docs/gallery/texas.html

... but using italian provinces instead of Texas counties.

Can you help me pointing in the right direction? Other tools suggested?

Thanks in advance, Gianluca

Upvotes: 2

Views: 1764

Answers (3)

stefano gelli
stefano gelli

Reputation: 105

The best way to do this is with shape files from ISTAT.

If you want you can use my library for geo analysis within ITALY in easier way (here you can find the github link).

You just need to download the whl, install (you can see the readme part) and use it.

Here an example:

Suppose you have a dataframe (df) like this

enter image description here

then you can run this code

from geo_ita.plot import plot_choropleth_map_provinciale_interactive
plot_choropleth_map_provinciale_interactive(df, province_tag='provincia', value_tag='valore')

Upvotes: 0

yami
yami

Reputation: 33

I managed to create a plot with an Italian map. I downloaded the borders of Italy from github (region borders or province borders). Then I created a dataframe containing 3 columns: [Province (or region), x_bord, y_bord]. In the end I used it as a ColumnDataSource and create a Figure with patches.

Suggestion: if you want to improve your render, you can add a hover tool creating a new column with desired values (e.g. number of inhabitants). Moreover you can create new column containing rgb values (RGB(r,g,b)) if you want different colors for each province or region.

source= ColumnDataSource(dict(x=italy.x_bord,y=italy.y_bord,prov=italy.prov,val=italy.val,colors=italy.colors))
f = figure(...)
f.patches(xs='x',ys='y',source=source, fill_color='colors')

Upvotes: 0

yami
yami

Reputation: 33

I don't know if it can still help, but at http://www.istat.it/it/archivio/209722 (istat italian website) you can find numerous free detailed and updated borders of Italian provinces and regions in .shp format.

Let me know if you manage to obtain your map and if yes, how, ty.

Upvotes: 1

Related Questions