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

add legend title to px.pie #3508

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lucafs
Copy link

@lucafs lucafs commented Dec 9, 2021

Code PR

  • I have read through the contributing notes and understand the structure of the package. In particular, if my PR modifies code of plotly.graph_objects, my modifications concern the codegen files and not generated files.
  • I have added tests (if submitting a new feature or correcting a bug) or
    modified existing tests.
  • I have added a CHANGELOG entry if fixing/changing/adding anything substantial.

Fixes #2966 issue and adds a new testing file to test changes asserting that the name in the parameter "names" is the same as fig.layout.legend.title.text in the fig variable.

Example

Code:

import plotly.express as px
df = px.data.gapminder().query("year == 2007").query("continent == 'Europe'")
df.loc[df['pop'] < 2.e6, 'country'] = 'Other countries' # Represent only large countries
fig = px.pie(df, values='pop', names='country', title='Population of European continent')
fig.show()

Results

Before:
image

After:
image

@lucafs lucafs force-pushed the fix_px_pie_legend_title branch from 1064a12 to bf1a97a Compare December 9, 2021 16:15
@gvwilson gvwilson self-assigned this Jun 26, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson changed the title Fix Issue 2966 px.pie has no legend title add legend title to px.pie Aug 12, 2024
@gvwilson gvwilson added P2 considered for next cycle community community contribution fix fixes something broken labels Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community community contribution fix fixes something broken P2 considered for next cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

px.pie has no legend title
2 participants