Skip to content

[Bug]: get_tick_params on xaxis shows wrong keywords #27416

@StefRe

Description

@StefRe

Bug summary

get_tick_params on xaxis shows yaxis keywords

Code for reproduction

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

print(ax.xaxis.get_tick_params())

Actual outcome

{'left': True, 'right': False, 'labelleft': True, 'labelright': False, 'gridOn': False}

Expected outcome

{'bottom': True, 'top': False, 'labelbottom': True, 'labeltop': False, 'gridOn': False}

Additional information

The current implementation of get_tick_params tries to invert the keymap dict which is impossible because this dict is a 1:n relationship (multiple keys with the same value).
This went unnoticed because the test_axis_get_tick_params didn't actually test anything: the expected value is calculated in the test using the very same algorithm as the function under test.

Operating system

No response

Matplotlib Version

3.8.2

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions