Closed ResidentMario closed 7 years ago
@ResidentMario are you setting the alpha
value in your mpl plot? It should get translated to fillOpacity
. If not can you put together a SSCCE showing the problem?
Hi @ResidentMario,
As @ocefpaf mentioned, mplleaflet respects the alpha
value from a matplotlib plot. That's done here: https://github.com/jwass/mplleaflet/blob/master/mplleaflet/leaflet_renderer.py#L48.
If you're setting it and it's not working, let us know. I'll close the issue in the meantime.
Yes, I see now that I was actually in error. Thanks!
Hi!, when you pass a plot from geopandas, you can set alpha to 0., but any other value gets rendered with 0.2
f, ax = plt.subplots(1) gdf.plot(column='column_name,alpha=0.9, ax=ax) mplleaflet.display(fig=f, crs=gdf.crs,tiles='cartodb_positron')
Same problem here.
matplotlib:
mplleaflet:
As @alephcero mentions, no matter what I use for alpha=
it still gets rendered with 0.2
After this issue bugged me for a while I think I was able to track the problem down:
The code in this repository is fully functional when it comes to the alpha-value/opacity of patch plots. People experiencing said problem most probably installed mplleaflet via conda or pip.
The corresponding pypi and conda-forge distributions of mplleaflet (https://pypi.org/project/mplleaflet/) are not up to date with this repository. Specifically, they do not include the changes which where introduced in commit 205716786559edeb8342293e59a1e1f26d93227e. Hence, the patch fill opacity will not be set by mplleaflet and therefore defaults to leaflet's standard value which seems to be 0.2 .
@jwass : The easiest way to solve this issue is to update the mplleaflet pypi/conda-forge version, which should not be too much of a hustle.
In the meantime users may work around this problem by cloning the repository recursively (to include mplexplorer) and installing the package manually.
mplleaflet
seems to respect most of the options you can set on amatplotlib
plot, except for one crucial one, which is opacity. That is, at least AFAIK.Am I wrong (in that case, what's the parameter name!)? If not, then I believe that such a control should be made a feature.