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
Closed
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
Prev Previous commit
Resolving tickmark problem in figure 2 ax_b for example demo_axes_rgb
Setting tickmark direction to "in" for both axes
Setting the ticks explicitly to fix the problem with the major ticks in the blue plot
  • Loading branch information
naheld committed Jul 21, 2016
commit d4e27ad56fa1e77a74b0fc74800b84ccadee2bbe
10 changes: 4 additions & 6 deletions examples/axes_grid1/demo_axes_rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,13 @@ def demo_rgb2():
kwargs = dict(origin="lower", interpolation="nearest")
ax.imshow_rgb(r, g, b, **kwargs)

ax.RGB.set_xlim(0., 9.5)
ax.RGB.set_xlim(0., 10.6)
ax.RGB.set_ylim(0.9, 10.6)

for ax1 in [ax.RGB, ax.R, ax.G, ax.B]:
for sp1 in ax1.spines.values():
sp1.set_color("w")
for tick in ax1.xaxis.get_major_ticks() + ax1.yaxis.get_major_ticks():
tick.tick1line.set_mec("w")
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.


return ax

Expand Down