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
Geotable plot #844
Geotable plot #844
Conversation
… it's a matplotlib backend
…ut needs paletting to be hooked in
Dani geotable plot
Ahh, good call! I think it's smart to switch to I could probably author the necessary changes over the weekend, but I can review any stuff this week. |
yes, I think all of the refactoring should happen in |
I like the I agree on the API. Not sure how the style of colors matters in the backend, other than what each package expects naturally. Maybe that'll be more apparent as I dig in. |
re. the color style (or unit), I think |
Right, but right now |
Cool, |
Looking into the issue with the brexit map under bokeh that @sjsrey noted, I think the bokeh backend will be limited for complex geometries. To reprise, the issue was that a call to plot the brexit data in #this will crash your notebook
maps.geoplot(db, 'Pct_Leave', k=7, alpha=0.5, classi='fisher_jenks', backend='bk') This is surprising, since there are only ~380 constituencies. In contrast, NAT = ps.pdio.read_files(ps.examples.get_path('NAT.shp'))
maps.geoplot(NAT, 'HR90', alpha=.5, k=7, classi='fisher_jenks', backend='bk') This led me to look at the vertex counts. brexit_verts = db.geometry.apply(lambda x: len(x.vertices))
brexit_verts.unique() The british constituency shapefile has some pretty amazingly detailed polygons, with the Highlands constituency using ~360k points alone. The worst in NAT is under 200 vertices. Thanks mostly to the intense detail with which the Scottish part of the dataset is stored, it takes around 3.5 million points to plot all constituencies, whereas NAT is only 80k points to plot. Extrapolating a bit, it looks like BokehJS or the notebook Javascript chokes at around 2 million points in the |
To help the user, we could warn if the plot "size" is too large and the rendering likely to fail, but I'm not sure if the point limit you can find in the brexit data will hold for other datasets. |
Thanks very much for this @ljwolf. I think this is not necessarily a bug in our side but just a characteristic or rendering on the browser these days at least. I wonder also if this is I'd be inclined not to set any message because: a) it's probably hard to come up with a number as it might depend on browser, machine specs, etc. and b) it's likely to change over time as |
I agree, looks like a JS issue. I'm not sure when matplotlib will fail, but I'm sure if you try to plot some massive number of points, it'll start to seize up in the image display. You're also right that it's not worth it to find that limit & display when we think it might fail. I'm game to consider the concerns we discussed from the dev call answered and this to get merged! |
Yes, I think at some point any visualization approach is bound to fail if it naively tries to plot all of the data. At that point, approaches like +1 on merging as far as I'm concerned, provided executing the guide notebook returns no error. |
Just for future reference, this notebook could be an example on how to plot lines with a lot of points and not get |
Thanks @ljwolf for digging into this and finding the reason why that particular shapefile was raising the problem. I agree this is not a bug on our side and I'm +1 on merging once the issues you mentioned get resolved. This will be really nice to have in the library! |
…to dani_geotable_plot
Dani geotable plot
4 similar comments
I think the only thing left here is decide whether we want to bring in @ljwolf's work to make qualitative palettes automatically set |
That PR is here. I'll take a look at bringing that up to speed. |
Revised PR on that is here. |
add check for k exceeding the number of available palettable colors
OK, that's merged! If tests pass (which they should), are we good to merge? I think so. |
This is a PR to bring into
pysal/dev
work to implement easy plotting forgeotables
. Not to be merged yet but rather to create a place to centralized the discussion around design details and so on. My idea is that, once we're happy with it we merge and, ideally, we have it in by the time @ljwolf's GSoC project gets merged as well so we can have a big splash on simplifying workflows with spatial data.So far, this implements basic machinery to plot
geotables
with both amatplotlib
and abokeh
backend and contains acolor.py
module with palette support that depends onbewer2mpl
. There's a notebook (geotable_plot
) explaining the new functionality.