andrea-cuttone / geoplotlib

python toolbox for visualizing geographical data and making maps
MIT License
1.03k stars 175 forks source link

Histogram is not true histogram #28

Open ghost opened 6 years ago

ghost commented 6 years ago

When I use this function is does not do a true histogram for pandas data frames. It works for csv files only. Attached is a picture. Everywhere on the map it shows at each point the length of the data. Is this a color box plot using lat lon and Q(physical measurement)? screenshot_2018-02-07_19-42-13

andrea-cuttone commented 6 years ago

Hi

can you share your code?

ghost commented 6 years ago

@andrea-cuttone

import geoplotlib as glp

    # df is a bigger pandas dataframe and the code for that is not posted here

df2["lon"] = df.lon.values
df2["lat"] = df.lat.values

data = df2

BoundingBox.SFC = BoundingBox(north=38.48, west=-123.3, south=37.32, east=-121)
glp.set_bbox(BoundingBox.SFC)

    # plot save show
glp.hist(data, cmap=cmocean.cm.deep, scalemax=100, alpha=220, colorscale='sqrt', binsize=1.5)
glp.show()
andrea-cuttone commented 6 years ago

you cannot use pandas dataframes directly, you first need to call DataAccessObject.from_dataframe, see https://github.com/andrea-cuttone/geoplotlib/blob/master/geoplotlib/utils.py