8000 [Bug]: Setting ticks marks on a single spine doesn't work properly · Issue #25117 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
[Bug]: Setting ticks marks on a single spine doesn't work properly #25117
Closed
@WWakker

Description

@WWakker

Bug summary

When setting the tick length on the top spine only, it is also applied to the bottom spine, creating space between the bottom of the chart and the axis labels.

Code for reproduction

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.plot(range(2020, 2025),
        range(-2, 3))

ax.spines['top'].set_position('zero')
ax.spines['bottom'].set_visible(False)
ax.tick_params(labelbottom=True, labeltop=False, bottom=False, top=True)
ax.spines['top'].axis.set_tick_params(length=10)
ax.set_xticks(range(2020, 2025))

plt.show()

Actual outcome

image

Expected outcome

image

Additional information

No response

Operating system

Windows

Matplotlib Version

3.3.4

Matplotlib Backend

TkAgg

Python version

3.6.13

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0