Definitively, if I remove theplt.subplots_adjust and try to rely onplt.tight_layout instead, I get this traceback (with Python 2.7 in a conda env, Linux, mpl 2.0.0b3.post1796+gd527799): QGtkStyle could not resolve GTK. Make sure you have installed the proper libraries./home/adrien/matplotlib/lib/matplotlib/transforms.py:380: RuntimeWarning: invalid value encountered in double_scalars return points[1, 0] - points[0, 0]/home/adrien/matplotlib/lib/matplotlib/tight_layout.py:199: RuntimeWarning: invalid value encountered in double_scalars kwargs["wspace"] = hspace / h_axes/home/adrien/matplotlib/lib/matplotlib/axis.py:1008: UserWarning: Unable to find pixel distance along axis for interval padding of ticks; assuming no interval padding needed. warnings.warn("Unable to find pixel distance along axis "/home/adrien/matplotlib/lib/matplotlib/axis.py:1018: UserWarning: Unable to find pixel distance along axis for interval padding of ticks; assuming no interval padding needed. warnings.warn("Unable to find pixel distance along axis "Traceback (most recent call last): File "/home/adrien/matplotlib/lib/matplotlib/backends/backend_qt5agg.py", line 182, in __draw_idle_agg FigureCanvasAgg.draw(self) File "/home/adrien/matplotlib/lib/matplotlib/backends/backend_agg.py", line 464, in draw self.figure.draw(self.renderer) File "/home/adrien/matplotlib/lib/matplotlib/artist.py", line 68, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/home/adrien/matplotlib/lib/matplotlib/figure.py", line 1262, in draw renderer, self, dsu, self.suppressComposite) File "/home/adrien/matplotlib/lib/matplotlib/image.py", line 139, in _draw_list_compositing_images a.draw(renderer) File "/home/adrien/matplotlib/lib/matplotlib/artist.py", line 68, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/home/adrien/matplotlib/lib/matplotlib/axes/_base.py", line 2383, in draw mimage._draw_list_compositing_images(renderer, self, dsu) File "/home/adrien/matplotlib/lib/matplotlib/image.py", line 139, in _draw_list_compositing_images a.draw(renderer) File "/home/adrien/matplotlib/lib/matplotlib/artist.py", line 68, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/home/adrien/matplotlib/lib/matplotlib/axis.py", line 1109, in draw ticks_to_draw = self._update_ticks(renderer) File "/home/adrien/matplotlib/lib/matplotlib/axis.py", line 942, in _update_ticks tick_tups = [t for t in self.iter_ticks()] File "/home/adrien/matplotlib/lib/matplotlib/axis.py", line 885, in iter_ticks majorLocs = self.major.locator() File "/home/adrien/matplotlib/lib/matplotlib/ticker.py", line 1721, in __call__ return self.tick_values(vmin, vmax) File "/home/adrien/matplotlib/lib/matplotlib/ticker.py", line 1726, in tick_values locs = self._raw_ticks(vmin, vmax) File "/home/adrien/matplotlib/lib/matplotlib/ticker.py", line 1674, in _raw_ticks nbins = max(min(self.axis.get_tick_space(), 9), File "/home/adrien/matplotlib/lib/matplotlib/axis.py", line 2008, in get_tick_space return int(np.floor(length / size))ValueError: cannot convert float NaN to integer
I don't understand everything, but it looks likeplt.tight_layout has difficulties to place some ticks. |
Fix#6775.
The issue reports among other things a poor choice of x-ticks. However, this seems to be OK in the devdocs version (http://matplotlib.org/devdocs/users/pyplot_tutorial.html)
I suppressed the minor y tick labels in the case of the logit scale, to keep only the major ones. To do so, I used a
NullFormatter
:is it OK for a pyplot tutorial? First I wanted to simply useplt.minorticks_off
but it hides the nice feature of the logit scale, which is to be log in some range and linear in another range.Furthermore, I slightly tweaked the
linthreshy
value in the case of the symlog case, to avoid overlapping some of the y tick labels.The current PR should produce things similar to

I precise “similar” because depending on the random samples, the tick range of the axes may be different.
PS: I got weird crashes when trying to use
plt.tight_layout
to adjust the subplots. I'll see if it comes from my machine or is a real issue, and I will open report another issue in the latter case. And for the moment, I have simply defined by hand some correct values inplt.subplots_adjust
.