Skip to content
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

mplleaflet is showing blank when points / features > 1000[Python Notebook] #79

Open
ashutoshsoni891 opened this issue Sep 3, 2021 · 1 comment

Comments

@ashutoshsoni891
Copy link

I have kml file with 1000+ features and I am trying to plot via matplotlib and mplleaflet . When I tried to plot the GeoSeries with 1000+ features it shows blank whereas it works perfect when features < 1000

I am using mplleaflet inside Python Notebook

Here is the code :

import mplleaflet
import maptplotlib.pyplot as plt
import geopandas as gpd

df= gpd.read_file('xyz.kml')

ax_wfs = df['geometry'][:1000].plot(figsize = (15,10) , color = 'black'  )
mplleaflet.display(fig=ax_wfs.figure , tiles='osm' )

I have also tried some stackoverflow hacks like
%%capture
%matplotlib inline
changing alpha value to 0.1

but unfortunately it didnt work at all . @jwass could you please help me out ? This seems like a bug

Thanks in advance!
Ash

@DmitrySerg
Copy link

I'm experiencing the same issue. Seems like 1000 points is a magic threshold for Jupyter Notebook. The only workaround I found is opening the plot in a separate window. In that case the number of points does not seem to cause any issues

import matplotlib.pyplot as plt
import mplleaflet
%matplotlib qt

fig = plt.figure(figsize=(10, 8))
plt.scatter(
    latlong[:, 1][:1500],
    latlong[:, 0][:1500], 
    alpha=0.5
)
mplleaflet.show(fig=fig)

Cheers,
Dima

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants