Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implemeted get_ticks_direction() #5290

Merged
merged 1 commit into from Oct 22, 2015
Merged

Conversation

pizzathief
Copy link
Contributor

adresses #5277 .

example usage:

>>>import numpy as np
>>>import matplotlib.pyplot as plt

>>>x = np.linspace(0, 2 * np.pi, 100)
>>>y = 2 * np.sin(x)

>>>fig, (ax0, ax1) = plt.subplots(nrows=2)

>>>ax0.plot(x, y)
[<matplotlib.lines.Line2D object at 0x7f4217d5bb00>]
>>>ax0.set_title('normal spines')
<matplotlib.text.Text object at 0x7f4217dee828>

>>>ax1.plot(x, y)
[<matplotlib.lines.Line2D object at 0x7f4217d5bd30>]
>>>ax1.set_title('bottom-left spines')
<matplotlib.text.Text object at 0x7f4217dab518>

# Hide the right and top spines
>>>ax1.spines['right'].set_visible(False)
>>>ax1.spines['top'].set_visible(False)
# Only show ticks on the left and bottom spines
>>>ax1.yaxis.set_ticks_position('left')
>>>ax1.xaxis.set_ticks_position('bottom')

# Tweak spacing between subplots to prevent labels from overlapping
>>>plt.subplots_adjust(hspace=0.5)

>>>plt.show()
>>>ax1.yaxis.get_ticks_direction(False)
array(['in', 'in', 'in', 'in', 'in', 'in', 'in', 'in', 'in'], dtype='<U2')
>>>ax1.xaxis.get_ticks_direction(False)
array(['in', 'in', 'in', 'in', 'in', 'in', 'in', 'in'], dtype='<U2')
>>>ax1.xaxis.get_ticks_direction(True)
array([], dtype=float64)
>>>ax1.tick_params(axis='y', direction='out')
>>>ax1.yaxis.get_ticks_direction(False)
array(['out', 'out', 'out', 'out', 'out', 'out', 'out', 'out', 'out'], dtype='<U3')

edit: python prompt in markdown gets mangled, fixed

@mdboom
Copy link
Member

mdboom commented Oct 22, 2015

Looks fine to me.

mdboom added a commit that referenced this pull request Oct 22, 2015
implemeted get_ticks_direction()
@mdboom mdboom merged commit 8379d78 into matplotlib:master Oct 22, 2015
@nschloe nschloe mentioned this pull request Oct 24, 2015
@QuLogic QuLogic added this to the proposed next point release (2.1) milestone Oct 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants