Skip to content

Enable legends when configuring legend options - #49

Open
floze-the-genius wants to merge 1 commit into
y-sunflower:mainfrom
floze-the-genius:fix/48-optional-legend
Open

Enable legends when configuring legend options#49
floze-the-genius wants to merge 1 commit into
y-sunflower:mainfrom
floze-the-genius:fix/48-optional-legend

Conversation

@floze-the-genius

Copy link
Copy Markdown

Closes #48.

Summary

  • enable the legend automatically when another legend option is provided
  • preserve explicit legend=False as an override
  • cover numeric and categorical legend options and document the behavior
  • normalize automatic numeric labels to text for the current Pyrefly annotation contract

Testing

  • uv run pytest (199 passed)
  • uv run ty check
  • uv run pyrefly check
  • ruff 0.9.10 format --check .
  • ruff 0.9.10 check .
  • uv run zensical build --clean
  • uv build

Comment thread tests/test_main.py
calendar(dates, values, ax=ax, **legend_kwargs)

assert ax.get_legend() is not None
plt.close("all")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is that test required? maybe let's just move assert ax.get_legend() is not None in the above test

@JosephBARBIERDARNAL

Copy link
Copy Markdown
Collaborator

Hey @floze-the-genius thanks for the PR!

Would you mind make the following changes:

  • update usage in documentation with an unecessary usage of legend=True
  • raise a UserWarning when any of legend args is specified and legend=True. The warning should explicit that it's not required to use the legend argument in this case.

Thanks again!

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.

feat: make legend argument optional when specifying other legend arguments

2 participants