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

Cycle through text_color when overlaying Labels #5888

Merged
merged 4 commits into from
Sep 18, 2023
Merged

Cycle through text_color when overlaying Labels #5888

merged 4 commits into from
Sep 18, 2023

Conversation

ahuang11
Copy link
Collaborator

@ahuang11 ahuang11 commented Sep 15, 2023

Closes #5887

So it's easy to create legends directly in the plot.
image

And if they need the labels to be black, it's still easy:
hv.Labels().opts(text_color="black")

import pandas as pd
import holoviews as hv

df = pd.DataFrame(
    {
        "City": ["Buenos Aires", "Brasilia", "Santiago", "Bogota", "Caracas"],
        "Country": ["Argentina", "Brazil", "Chile", "Colombia", "Venezuela"],
        "Latitude": [-34.58, -15.78, -33.45, 4.60, 10.48],
        "Longitude": [-58.66, -47.91, -70.66, -74.08, -66.86],
    }
)
hv.Dataset(df).to.labels(["Latitude", "Longitude"], ["City"]).overlay().opts("Labels", text_color="black")
image image

Or just use hv.Text()

@ahuang11 ahuang11 changed the title Cycle through text_colors when overlaying Labels Cycle through text_color when overlaying Labels Sep 15, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 15, 2023

Codecov Report

Merging #5888 (80bc964) into main (0b76098) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #5888   +/-   ##
=======================================
  Coverage   88.28%   88.28%           
=======================================
  Files         311      311           
  Lines       64370    64386   +16     
=======================================
+ Hits        56830    56846   +16     
  Misses       7540     7540           
Flag Coverage Δ
ui-tests 23.36% <64.70%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
holoviews/plotting/bokeh/__init__.py 98.05% <100.00%> (ø)
holoviews/plotting/mpl/__init__.py 81.61% <100.00%> (+0.13%) ⬆️
holoviews/plotting/plotly/__init__.py 93.22% <100.00%> (+0.11%) ⬆️
holoviews/tests/plotting/bokeh/test_labels.py 100.00% <100.00%> (ø)
holoviews/tests/plotting/matplotlib/test_labels.py 100.00% <100.00%> (ø)
holoviews/tests/plotting/plotly/test_labelplot.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@hoxbro hoxbro added this to the 1.18.0 milestone Sep 18, 2023
@hoxbro
Copy link
Member

hoxbro commented Sep 18, 2023

Looks good

@hoxbro hoxbro enabled auto-merge (squash) September 18, 2023 07:51
@hoxbro hoxbro merged commit 0dad517 into main Sep 18, 2023
11 checks passed
@hoxbro hoxbro deleted the cycle_labels branch September 18, 2023 08:48
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Labels text_color should also cycle through color when overlaid
3 participants