GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add support for overriding x tick with non arithmetic progression values by robertoffmoura · Pull Request #5262 · plotly/plotly.py

Conversation

@robertoffmoura

@robertoffmoura robertoffmoura commented Jul 3, 2025

Copy link
Copy Markdown
Contributor

Hi,
This change adds support for specifying tickvals and ticktext when the values don't follow an arithmetic progression, i.e., they're not evenly spaced.

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 code generator and not the generated files.
  • I have added tests or modified existing tests.
  • For a new feature, I have added documentation examples (please see the doc checklist as well).
  • I have added a CHANGELOG entry if changing anything substantial.
  • For a new feature or a change in behavior, I have updated the relevant docstrings in the code.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gvwilson
gvwilson requested a review from emilykl July 3, 2025 14:54
@gvwilson gvwilson assigned emilykl Jul 3, 2025
@gvwilson gvwilson added P1 needed for current cycle community community contribution fix fixes something broken labels Jul 3, 2025
@robertoffmoura
robertoffmoura force-pushed the rm/support-non-ap-xticks branch 2 times, most recently from 00a6f11 to 128dd25 Compare August 12, 2025 09:31
@robertoffmoura
robertoffmoura force-pushed the rm/support-non-ap-xticks branch from 128dd25 to 85745d7 Compare October 9, 2025 15:42
@robertoffmoura
robertoffmoura force-pushed the rm/support-non-ap-xticks branch from 85745d7 to 7701120 Compare July 31, 2026 17:18
@robertoffmoura

robertoffmoura commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Hi @emilykl,
This adds support for x ticks that don't follow an arithmetic progression when converting matplotlib figures to plotly.

Currently, the conversion ignores custom x tick values specified in the matplotlib figure.

See the snippet below, which prints None before this change:

import warnings
import matplotlib.pyplot as plt
import plotly.tools as tls

xticks = [0.01, 0.53, 0.75]  # non-arithmetic progression

fig = plt.figure()
plt.plot([0, 1], [0, 1])
plt.xticks(xticks)
fig.savefig("matplotlib.png")

p = tls.mpl_to_plotly(plt.gcf())
print(p.layout.xaxis.tickvals) # (0.01, 0.53, 0.75)
p.write_image("plotly.png")

Here's a screenshot of the matplotlib figure with custom x tick values:
matplotlib

Before this change, the plotly conversion ignores the 0.75 x tick value.
plotly_before

After this change, the converted plot correctly shows the 0.75 x tick value.
plotly_after

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robertoffmoura
robertoffmoura force-pushed the rm/support-non-ap-xticks branch from b446bfd to 266aae9 Compare August 10, 2026 19:47
@robertclaus
robertclaus requested review from camdecoster and removed request for emilykl August 13, 2026 19:55
@robertclaus robertclaus assigned camdecoster and unassigned emilykl Aug 13, 2026
@robertoffmoura
robertoffmoura force-pushed the rm/support-non-ap-xticks branch from 266aae9 to 1ea1d90 Compare August 21, 2026 18:33
camdecoster
camdecoster requested changes Aug 28, 2026
View reviewed changes

@camdecoster camdecoster left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for the PR! Could you please review my comments and add a CHANGELOG entry?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread plotly/matplotlylib/mpltools.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread plotly/matplotlylib/mpltools.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread plotly/matplotlylib/mpltools.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread plotly/matplotlylib/mpltools.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread plotly/matplotlylib/tests/test_renderer.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread plotly/matplotlylib/tests/test_renderer.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@robertoffmoura
robertoffmoura force-pushed the rm/support-non-ap-xticks branch from 1ea1d90 to 0b1611a Compare August 31, 2026 17:38
@robertoffmoura
robertoffmoura requested a review from camdecoster August 31, 2026 20:59
camdecoster
camdecoster reviewed Aug 31, 2026
View reviewed changes

@camdecoster camdecoster left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Looks good. Before I approve, could you please address the merge conflict?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@robertoffmoura
robertoffmoura force-pushed the rm/support-non-ap-xticks branch from c2a7f0b to 8e7df2f Compare September 1, 2026 05:29
@robertoffmoura

robertoffmoura commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I rebased and addressed the merge conflict.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robertoffmoura
robertoffmoura requested a review from camdecoster September 1, 2026 05:32
robertoffmoura added 7 commits September 2, 2026 22:18
@robertoffmoura
Add support for overriding x tick with non arithmetic progression values
37aedc1
@robertoffmoura
Remove dtick and tickmode when overriding ticks with custom values
aa6e32a
@robertoffmoura
Use fig, ax = plt.subplots() in tests
c96ca87
@robertoffmoura
Convert custom tick values for date axes
e541091
@robertoffmoura
Add tests for custom tick values on date axes
bb38731
@robertoffmoura
Update uneven tick spacing warning to reflect explicit tickvals export
d06b992
@robertoffmoura
Export tick text for FixedFormatter tick labels
894e4d5
robertoffmoura added 2 commits September 2, 2026 22:18
@robertoffmoura
Add yticks test
f48430c
@robertoffmoura
Add changelog entry
c5787d1
@robertoffmoura
robertoffmoura force-pushed the rm/support-non-ap-xticks branch from 8e7df2f to c5787d1 Compare September 2, 2026 21:19
camdecoster
camdecoster approved these changes Sep 2, 2026
View reviewed changes

@camdecoster camdecoster left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for the update!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@camdecoster
camdecoster merged commit d3105d4 into plotly:main Sep 2, 2026
25 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@camdecoster camdecoster camdecoster approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@camdecoster camdecoster

Labels

community community contribution fix fixes something broken P1 needed for current cycle

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@robertoffmoura @camdecoster @gvwilson @emilykl
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.