question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

invert_axes, invert_xaxis, and invert_yaxis are named and documented in a misleading way

See original GitHub issue

The invert_xaxis and invert_yaxes options, as expected, flip the axes when set to True, so that they go from large to small left to right and down to up, opposite of the conventional bottom left small-number origin.

invert_axes, however, does something different, and for me unexpected – it swaps the x and y axes. The docstrings make it sound like setting invert_axes=True is the same as setting invert_xaxis=True and invert_yaxis=True at the same time:

invert_axes = param.Boolean(default=False, doc="""
    Whether to invert the x- and y-axis""")

invert_xaxis = param.Boolean(default=False, doc="""
    Whether to invert the plot x-axis.""")

invert_yaxis = param.Boolean(default=False, doc="""
    Whether to invert the plot y-axis.""")

(holoviews/plotting/plot.py line 585 to 592)

At a minimum, the docstring for invert_axes should be changed to “Whether to swap the x- and y- axes.” Even clearer would be to rename invert_axes to swap_axes, but I realize this could be a hassle given backwards compatibility requirements.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jbednarcommented, Jun 6, 2018

I vote for changing invert_axes to swap_axes to avoid confusion, and for not changing invert_xaxis and invert_yaxis, again to avoid confusion (as once we have swap_axes there’s less chance of confusion.

0reactions
jlstevenscommented, Jun 6, 2018

Personally, I do like flip a bit more but it is such a mild preference I’m not sure it is worth the confusion that would result from changing it. For holoviews 2.0, I would be very happy for such an API change though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - How to invert the x or y axis
DisplacedAussie's answer is correct, but usually a shorter method is just to reverse the single axis in question: plt.scatter(x_arr, y_arr) ax = plt.gca() ......
Read more >
Invert Axes — Matplotlib 3.6.2 documentation
Invert Axes #. You can use decreasing axes by flipping the normal order of the axis limits. Should be growing... import matplotlib.pyplot as...
Read more >
How to Reverse Axes in Matplotlib?
To invert X-axis and Y-axis, we can use invert_xaxis() and ... xlim() and ylim() can also be used to invert axes of a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found