Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Added missing side tick rcParams #6735

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

Merged
merged 2 commits into from
Jul 16, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added major/minor tick visibility params
  • Loading branch information
bcongdon committed Jul 13, 2016
commit fc7c02604ea9e9debb9adea980740bf3319b3b49
25 changes: 20 additions & 5 deletions 25 lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,11 +566,26 @@ def __init__(self, fig, rect,
if self.yaxis is not None:
self._ycid = self.yaxis.callbacks.connect('units finalize',
self.relim)
self.tick_params(top=rcParams['xtick.top'],
bottom=rcParams['xtick.bottom'],
left=rcParams['ytick.left'],
right=rcParams['ytick.right'],
which='both')

self.tick_params(top=rcParams['xtick.top'] and
rcParams['xtick.minor.top'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This alignment is a bit confusing. I'm pretty sure you could put each parameter on its own line with an extra indent, and it should fix within 79 chars.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that is a bit confusing, however they both don't fit on the same line within 79 characters.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bottom is the longest, and should be 79 if moved to its own line. I mean like this:

        self.tick_params(
            top=...
            bottom=...
            ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Thanks!

bottom=rcParams['xtick.bottom'] and
rcParams['xtick.minor.bottom'],
left=rcParams['ytick.left'] and
rcParams['ytick.minor.left'],
right=rcParams['ytick.right'] and
rcParams['ytick.minor.right'],
which='minor')

self.tick_params(top=rcParams['xtick.top'] and
rcParams['xtick.major.top'],
bottom=rcParams['xtick.bottom'] and
rcParams['xtick.major.bottom'],
left=rcParams['ytick.left'] and
rcParams['ytick.major.left'],
right=rcParams['ytick.right'] and
rcParams['ytick.major.right'],
which='major')

def __setstate__(self, state):
self.__dict__ = state
Expand Down
11 changes: 11 additions & 0 deletions 11 lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,12 @@ def validate_animation_writer_path(p):
'xtick.color': ['k', validate_color], # color of the xtick labels
'xtick.minor.visible': [False, validate_bool], # visiablility of the x axis minor ticks

'xtick.minor.top': [True, validate_bool], # visability of the x axis top minor ticks
'xtick.minor.bottom': [True, validate_bool], # visability of the x axis bottom minor ticks
'xtick.major.top': [True, validate_bool], # visability of the x axis top major ticks
'xtick.major.bottom': [True, validate_bool], # visability of the x axis bottom major ticks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra blank line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


# fontsize of the xtick labels
'xtick.labelsize': ['medium', validate_fontsize],
'xtick.direction': ['out', six.text_type], # direction of xticks
Expand All @@ -1190,6 +1196,11 @@ def validate_animation_writer_path(p):
'ytick.color': ['k', validate_color], # color of the ytick labels
'ytick.minor.visible': [False, validate_bool], # visiablility of the y axis minor ticks

'ytick.minor.left': [True, validate_bool], # visability of the y axis top minor ticks
'ytick.minor.right': [True, validate_bool], # visability of the y axis bottom minor ticks
'ytick.major.left': [True, validate_bool], # visability of the y axis top major ticks
'ytick.major.right': [True, validate_bool], # visability of the y axis bottom major ticks

# fontsize of the ytick labels
'ytick.labelsize': ['medium', validate_fontsize],
'ytick.direction': ['out', six.text_type], # direction of yticks
Expand Down
24 changes: 24 additions & 0 deletions 24 lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4128,6 +4128,30 @@ def test_rc_tick():
assert yax._minor_tick_kw['tick2On'] == False


@cleanup
def test_rc_major_minor_tick():
d = {'xtick.top': True, 'ytick.right': True, # Enable all ticks
'xtick.bottom': True, 'ytick.left': True,
# Selectively disable
'xtick.minor.bottom': False, 'xtick.major.bottom': False,
'ytick.major.left': False, 'ytick.minor.left': False}
with plt.rc_context(rc=d):
fig = plt.figure()
ax1 = fig.add_subplot(1, 1, 1)
xax = ax1.xaxis
yax = ax1.yaxis
# tick1On bottom/left
assert xax._major_tick_kw['tick1On'] == False
assert xax._major_tick_kw['tick2On'] == True
assert xax._minor_tick_kw['tick1On'] == False
assert xax._minor_tick_kw['tick2On'] == True

assert yax._major_tick_kw['tick1On'] == False
assert yax._major_tick_kw['tick2On'] == True
assert yax._minor_tick_kw['tick1On'] == False
assert yax._minor_tick_kw['tick2On'] == True


@cleanup
def test_bar_negative_width():
fig, ax = plt.subplots()
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.