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

Make states fill_color="none" (transparent) #643

Merged
merged 6 commits into from
May 25, 2023
Merged

Conversation

ahuang11
Copy link
Collaborator

@ahuang11 ahuang11 commented May 24, 2023

Closes #512 (not sure why I closed the previous PR; perhaps because it was stale).

Also not sure if it's a better choice to set fill_alpha vs fill_color. I leaned towards fill_color rather than fill_alpha because I worry users might be confused if they change fill_color and it doesn't show anything.

I would like to skip importing and calling geoviews:

import pandas as pd
import hvplot.pandas
import geoviews as gv

df = pd.read_html(
    "https://mesonet.agron.iastate.edu/sites/networks.php?station=ORD&network=IL_ASOS"
)[1]
# make snake case
df.columns = df.columns.str.lower().str.replace(" ", "_")

map = df.hvplot.points(
    "longitude1",
    "latitude1",
    geo=True,
)

# overlay the map
states = gv.feature.states(fill_color="none")
map * states
image

And instead, do this:

import pandas as pd
import hvplot.pandas

df = pd.read_html(
    "https://mesonet.agron.iastate.edu/sites/networks.php?station=ORD&network=IL_ASOS"
)[1]
# make snake case
df.columns = df.columns.str.lower().str.replace(" ", "_")

map = df.hvplot.points(
    "longitude1",
    "latitude1",
    geo=True,
    features=["states"]
)

# overlay the map
map

At the moment, it shows this:
image

I would like to skip importing and calling geoviews:
```
import pandas as pd
import hvplot.pandas
import geoviews as gv

df = pd.read_html(
    "https://mesonet.agron.iastate.edu/sites/networks.php?station=ORD&network=IL_ASOS"
)[1]
# make snake case
df.columns = df.columns.str.lower().str.replace(" ", "_")

map = df.hvplot.points(
    "longitude1",
    "latitude1",
    geo=True,
)

# overlay the map
states = gv.feature.states(fill_color="none")
map * states
```


And instead do this:
```
import pandas as pd
import hvplot.pandas
import geoviews as gv

df = pd.read_html(
    "https://mesonet.agron.iastate.edu/sites/networks.php?station=ORD&network=IL_ASOS"
)[1]
# make snake case
df.columns = df.columns.str.lower().str.replace(" ", "_")

map = df.hvplot.points(
    "longitude1",
    "latitude1",
    geo=True,
    features=["states"]
)

# overlay the map
map
```
Copy link
Member

@hoxbro hoxbro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you update the CHANGELOG.md and doc/releases.rst with a comment about this PR today, I will add this to the next release. Maybe a small comment about this is a (small) breaking change.

Using color makes sense to me. That will be the first thing coming to mind when wanting a background color, not the alpha.

See here: https://github.com/holoviz/geoviews/pull/637/files

geoviews/plotting/bokeh/__init__.py Outdated Show resolved Hide resolved
ahuang11 and others added 5 commits May 24, 2023 12:39
@ahuang11 ahuang11 requested a review from hoxbro May 24, 2023 19:46
@ahuang11
Copy link
Collaborator Author

Okay done; feel free to make direct edits if needed!

@hoxbro
Copy link
Member

hoxbro commented May 25, 2023

Thank you for the quick turnaround.

@hoxbro hoxbro merged commit 77b568f into main May 25, 2023
@hoxbro hoxbro deleted the make-states-transparent branch May 25, 2023 08:13
@ahuang11
Copy link
Collaborator Author

Thanks for getting this in! Can't wait to use it in hvplot!

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

Successfully merging this pull request may close these issues.

gv.feature.states fill_alpha should default to 0
2 participants