[Bug]: tick_top and sharex do not work together · Issue #30219 · matplotlib/matplotlib · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

[Bug]: tick_top and sharex do not work together #30219

Open
@carissableker

Description

@carissableker

Bug summary

I expected tick_top to add ticks on the top of the uppermost subplot when using sharex=True. However, it adds ticks to the lower subplot (as it would normally), making it incompatible with shared axes.

Code for reproduction

import matplotlib.pyplot as plt

fig, axes = plt.subplots(
    sharex=True, sharey=True, 
    ncols=2, nrows=2
)
axes = axes.flatten()
for ax in axes:
    sc = ax.scatter(
        x=[0, 1, 5, 3], 
        y=[0, 1, 2, 4], 
    )

    ax.xaxis.tick_top()
    ax.tick_params(axis='x', rotation=55)

Actual outcome

Image

Expected outcome

Image

Additional information

No response

Operating system

Ubuntu

Matplotlib Version

3.8.2

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

conda

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      TMZ Celebrity News – Breaking Stories, Videos & Gossip

      Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

      Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

      🎥 Watch TMZ Live

      TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.