GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Tick.set_pad does not work · Issue #88 · matplotlib/matplotlib

Tick.set_pad does not work #88

New issue
Copy link
New issue
Copy link
Closed
Closed
Tick.set_pad does not work#88
Copy link
Assignees
mdboom
Milestone
v1.0.x

Description

@leejjoon
leejjoon
opened on Apr 21, 2011
Issue body actions

The documentation of Tick.set_pad says

Set the tick label pad in points

but it does not seem to have any effect.
This was reported by NotBrianCox [email protected] in the user mailing list and here is his original message.

On Tue, Mar 15, 2011 at 10:43 AM, NotBrianCox [email protected] wrote:

I'm plotting a series of sub plots within a figure, where most are small sub
plots, but the last one spans the width of the figure. For the final subplot
only, I want to set the xtick pad to 20. Something like:

import matplotlib.pyplot as plt

fig = plt.figure()
ax1 = fig.add_subplot(2,2,1)
ax2 = fig.add_subplot(2,2,2)
ax3 = fig.add_subplot(2,1,3)

plt.setp(ax3.xaxis.get_major_ticks(), pad=20)
plt.show()

But this doesn't have any effect on the final plot. I've also tried getting
the ticks individually and calling set_pad(20) i.e.:

for tick in ax3.xaxis.get_major_ticks():
tick.set_pad(20)

But this does't work either. Anyone have an ideas?

Apparently, set_pad only sets Tick._pad and I believe it does not have any effect unless the transform property is also updated. Also, _pad attribute is overwritten by apply_tickdir method.

I feel that the set_pad method should set "_base_pad" attribute and update the transform. Or change the documentation to state these explicitly.

Just in case, pads can be changed using the tick_params method.

ax3.tick_params(pad=20)

This sets _base_pad property and update the transform.

-JJ

Activity

  1. ghost assigned
    mdboom
    on Jun 15, 2011
  2. efiring
    added a commit that references this issue on Jun 15, 2011

    axis.py: make Tick.set_pad effective as advertised; closes Issue matp…

    53cc944
  3. efiring commented on Jun 16, 2011

    @efiring
    efiring
    on Jun 16, 2011
    Member
    More actions

    See pull request #144. I changed _pad to _base_pad in a couple other places as well as having set_pad use the existing machinery for updating the pad. Review of whether those changes make sense, or whether I missed something, is welcome.

  4. leejjoon commented on Jun 16, 2011

    @leejjoon
    leejjoon
    on Jun 16, 2011
    ContributorAuthor
    More actions

    #144 fixes the problem. I quickly went through the patch and the source code of axis.py and everything seems to be addressed. Thanks.

  5. ddale
    closed this as completedon Jun 16, 2011
  6. magnunor
    added a commit that references this issue on Dec 5, 2013

    Merge pull request matplotlib#88 from francisco-dlp/FIX-align2D

    0367463
  7. fariza
    added a commit that references this issue on Sep 22, 2016

    Merge pull request matplotlib#88 from fgoudreault/report_doc

    232b658
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @mdboom
    mdboom

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    • v1.0.x

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.