Skip to content

fixed example axes_grid demo_axes_rgb.py figure 1 #6759

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

Closed
wants to merge 5 commits into from

Conversation

naheld
Copy link

@naheld naheld commented Jul 16, 2016

made axes ticks invisible by setting tick_params for figure 1

made axes ticks invisible by setting tick_params for figure 1
@tacaswell tacaswell modified the milestone: 2.0 (style change major release) Jul 16, 2016
@WeatherGod
Copy link
Member

Travis failure is the fixed PEP8 error in test svg.

@WeatherGod
Copy link
Member

Is this still a work in progress? I would also make a tiny tweak to the comment that we are making the tick_mark_ invisible. A tick is a location in matplotlib parlance.

@@ -49,6 +49,13 @@ def demo_rgb():
r, g, b = get_rgb()
im_r, im_g, im_b, im_rgb = make_cube(r, g, b)
kwargs = dict(origin="lower", interpolation="nearest")

#make ticks invisible
Copy link
Member

Choose a reason for hiding this comment

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

Missing space after #.

@naheld
Copy link
Author

naheld commented Jul 19, 2016

OK fixing the typo and description in the comment line. The tickmarks in Fig 2 still look a little strange- I haven't found an easy fix but will take another look.

@tacaswell
Copy link
Member

As part of the tests we check the code with the tool formerly known as pep8. While this is sometimes annoying, it helps to keep the style in the codebase consistent (which is a big help for a large project with lots of contributors).

It looks like you have a line someplace which is empty but has white space in it

======================================================================
FAIL: matplotlib.tests.test_coding_standards.test_pep8_conformance_examples
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/matplotlib/matplotlib/venv/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/travis/build/matplotlib/matplotlib/lib/matplotlib/tests/test_coding_standards.py", line 274, in test_pep8_conformance_examples
    expected_bad_files=expected_bad_files)
  File "/home/travis/build/matplotlib/matplotlib/lib/matplotlib/tests/test_coding_standards.py", line 143, in assert_pep8_conformance
    assert_equal(result.total_errors, 0, msg)
AssertionError: 1 != 0 : Found code syntax errors (and warnings):
/home/travis/build/matplotlib/matplotlib/examples/axes_grid1/demo_axes_rgb.py:58:1: W293 blank line contains whitespace

Can you post an image of what it looks like now?

@naheld
Copy link
Author

naheld commented Jul 20, 2016

I see the problem. Thanks for your patience as I get the process down! Here's what Fig 1 looks like in 2.0 with the edits:

screen shot 2016-07-19 at 9 31 16 pm

Fig 2, which is the same as Fig 1 but with white tickmarks on all four plots, is still having tickmark issues:
screen shot 2016-07-19 at 9 32 43 pm

@tacaswell
Copy link
Member

I think you need to change the tick direction via http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.tick_params

@WeatherGod
Copy link
Member

Why does the blue channel only have two ticks, though?

On Tue, Jul 19, 2016 at 9:46 PM, Thomas A Caswell notifications@github.com
wrote:

I think you need to change the tick direction via
http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.tick_params


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#6759 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AARy-LQFk1dL2qu95i8VHdQSVmga_XRmks5qXX3cgaJpZM4JOEB2
.

Setting tickmark direction to "in" for both axes
Setting the ticks explicitly to fix the problem with the major ticks in the blue plot
@naheld
Copy link
Author

naheld commented Jul 21, 2016

Setting the tickmark direction to 'in' fixed some of the problems, but the problem with the blue plot persists (only two ticks). Any idea why? Setting the ticks explicitly fixed the problem, though it's not the most satisfying. Here's what it looks like with the changes:
screen shot 2016-07-21 at 5 10 27 pm

#fig.add_axes(ax_b)
# fig.add_axes(ax_r)
# fig.add_axes(ax_g)
# fig.add_axes(ax_b)
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason to leave these commented lines in?

@efiring
Copy link
Member

efiring commented Aug 8, 2016

The problem with the ticks is revealing an underlying problem in axes_grid1. I suspect a stale flag is missing somewhere. In demo_rgb2, if one comments out the lines setting the ticks, all of the ticks become synchronized among the axes if one triggers a draw by resizing the figure, for example. Even executing ax.RGB.get_xticks() is enough to cause synchronization.

tick.tick2line.set_mec("w")
ax1.tick_params(axis='both', direction='in')
ax1.xaxis.set_ticks(np.arange(0, 12, 2))
ax1.yaxis.set_ticks(np.arange(0, 12, 2))
Copy link
Member

Choose a reason for hiding this comment

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

You can take the two tick-setters outside the loop and apply them to ax.RGB (or any one of the 4). There is no telling how long it will take before the underlying bug is found and fixed, so this is a reasonable workaround in the interim. In addition, once the bug is fixed, the automatically-located ticks will be based on the small ax.B so there will be fewer of them than you want.

@NelleV NelleV modified the milestones: 2.0.1 (next bug fix release), 2.0 (style change major release) Oct 31, 2016
@NelleV
Copy link
Member

NelleV commented Oct 31, 2016

I've bumped this to 2.0.1, but reading the discussion I see it may underline a more profound problems with the ticks.
@naheld do you still see the issues, now that we've fixed a bunch of problems with ticks?

@naheld
Copy link
Author

naheld commented Nov 8, 2016

I'm still seeing the uneven spacing issue in the tick marks in the blue plot:

screen shot 2016-11-08 at 10 04 55 am

It looks like an inconsistency in get_major_ticks(), but I don't know what is underlying it.

@QuLogic QuLogic modified the milestones: 2.0.1 (next bug fix release), 2.0.2 (next bug fix release) May 3, 2017
@tacaswell tacaswell modified the milestones: 2.1.1 (next bug fix release), 2.2 (next feature release) Oct 9, 2017
@dstansby
Copy link
Member

dstansby commented Nov 2, 2018

I think I fixed this in #12685 - if I've missed anything that this PR did, feel free to leave a comment here and I can reopen it. Thanks @naheld for the original PR!

@dstansby dstansby closed this Nov 2, 2018
@story645 story645 removed this from the future releases milestone Oct 6, 2022
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.

9 participants