Closed janitor9 closed 6 years ago
Thanks for raising this, and thanks for your kind words.
I can't reproduce your issue. Running:
from ipywidgets.embed import embed_minimal_html
import gmaps
import gmaps.datasets
df = gmaps.datasets.load_dataset_as_df("starbucks_kfc_uk")
starbucks_df = df[df["chain_name"] == "starbucks"]
starbucks_df = starbucks_df[["latitude', 'longitude"]]
fig = gmaps.Map()
starbucks_layer = gmaps.symbol_layer(
starbucks_df, fill_color="green",
stroke_color="green", scale=2, fill_opacity=0.5,
stroke_opacity=0.5)
fig.add_layer(starbucks_layer)
embed_minimal_html('export.html', views=[fig])
... seems to behave as expected:
Can you post a minimal example that reproduces the problem?
Hi @pbugnion
Thanks for the example, that's very useful.
That code works for me but if I change the fill_opacity to 1 then I get the same issue. No problem on stroke_opacity.
I can reproduce it now, thanks. Will take a look at what's broken in the next few days.
In the meantime, setting a fill opacity of 0.99 seems to produce the right results?
This is caused by misaligned default values between this package (where we default fill opacity to 1.0) and Google Maps, which defaults to 0.0. When the user sets fill_opacity = 1.0
, we don't save that to the exported figure, assuming we can just rely on the Google Maps default.
I've made a PR that I'll hopefully push through in the next few days.
Yes fill opacity = 0.99 is more than enough for my needs. Thanks again, the whole package has made my life so much easier and got me a lot of kudos from the bosses!
PR 276 is now merged and included in gmaps 0.8.2 (currently available on pypi ; conda-forge will probably take a few more hours).
I've posted this in ipywidgets too https://github.com/jupyter-widgets/ipywidgets/issues/2235 but I'm not sure where the issue is originating so apologies if it's not the correct place here.
Firstly this is great and really help with some visualisations I'm producing.
The problem I've got is that I'm creating using gmaps to create a symbol_layer with different colours for the stroke colours and fill colours and an info box. The map renders perfectly in Jupyter Notebook but when exported (using embed_minimal_html or a html template), the fill colours are not rendering in the browser so the symbol looks like a doughnut
Using the developer tools I can see "fill_color" in the HTML script and everything else in there appears to be working correctly.
I've tried both solutions under the "Python Interface" section on https://ipywidgets.readthedocs.io/en/latest/embedding.html#python-interface
Hopefully that makes sense. I'm not a HTML or Python expert so apologies if this is something obvious!