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

Center title for px.imshow #4304

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Center title for px.imshow #4304

wants to merge 1 commit into from

Conversation

s2t2
Copy link

@s2t2 s2t2 commented Jul 29, 2023

Possible fix for #4303

  • 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.
  • For a new feature, I have added documentation examples in an existing or
    new tutorial notebook (please see the doc checklist as well).
  • I have added a CHANGELOG entry if fixing/changing/adding anything substantial.
  • For a new feature or a change in behaviour, I have updated the relevant docstrings in the code to describe the feature or behaviour (please see the doc checklist as well).

@empet
Copy link

empet commented Jul 29, 2023

It's not only px.imshow that aligns the plot title at left. The left aligned title is set by default in all plotly templates:
https://github.com/plotly/plotly.py/blob/master/packages/python/plotly/templategen/definitions.py#L120
https://github.com/plotly/plotly.py/blob/master/packages/python/plotly/templategen/definitions.py#L399
https://github.com/plotly/plotly.py/blob/master/packages/python/plotly/templategen/definitions.py#L470
https://github.com/plotly/plotly.py/blob/master/packages/python/plotly/templategen/definitions.py#L551

Starting with plotly.py, version 4.0, when templates were introduced, I set every plot title at 0.5, to get it centered. Only section titles in newpapers, books, journal papers are left aligned. In my opinion the left aligned title was an uninspired choice.
The most convenient would be to set in each plotly template definition, title_x=0.5, and users who want a non-standard alignment to set it manually.

@s2t2
Copy link
Author

s2t2 commented Jul 29, 2023

Sounds good @empet if there's anything you would like me to help with (like providing guidance around testing and passing the build), please let me know.

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.

None yet

2 participants