Skip to content

Feature Request: Controlling top, bottom, left, and right tick parameters independently of one another #11837

@ghost

Description

matplotlib.axes.Axes.tick_params allows one to control the direction which the ticks along the x and y axes point. Currently this can either be set to in or out which is very useful, but sometimes I want to create a plot that has ticks along the bottom pointing out and ticks along the top pointing in and I was unable to find an easy solution to accomplish this as tick_params for top and bottom are both tied to the x-axis. I am currently able to accomplish what I want by using and ax.twiny():

fig, ax = plt.subplots()

majorLocator = AutoLocator()
minorLocator = AutoMinorLocator()

ax_top = ax.twiny()
ax_top.tick_params(which='both', direction='in')
ax_top.set_xlim(ax.get_xlim())

ax.xaxis.set_minor_locator(minorLocator)
ax.xaxis.set_major_locator(majorLocator)

ax_top.xaxis.set_minor_locator(minorLocator)
ax_top.xaxis.set_major_locator(majorLocator)

ax_top.get_shared_x_axes().join(ax_top, ax)
ax_top.set_xticklabels([])

unknown
but this seems like a messy solution

Metadata

Metadata

Assignees

No one assigned

    Labels

    New featurestatus: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy