Hi,
When I add a RectangleSelector to an axes, the y-axis range changes.
There's a simple workaround to just call get_ylim before and set_ylim
after, but I wanted to understand the why there is a change at all.
Jovan
Hi all,
We are pleased to announce the release of 3.3.0.
Pre-built wheels are available for most major platforms, and can be
installed using `pip install matplotlib==3.3.0`. Other packages may also
be available already; please check with your preferred source.
The 3.3.0 release represents the work of 144 authors over 1066 pull
requests, and we thank them for their contributions.
Some highlights of this release include:
* Provisional API for composing semantic axes layouts from text or
nested lists
* New Axes.sharex, Axes.sharey methods
* Turbo colormap
* colors.BoundaryNorm supports extend keyword argument
* Text color for legend labels
* Pcolor and Pcolormesh now accept shading='nearest' and 'auto'
* Allow tick formatters to be set with str or function inputs
* New Axes.axline method
* Dates use a modern epoch
* Improved font weight detection
* Axes3D no longer distorts the 3D plot to match the 2D aspect ratio
* More consistent toolbar behavior across backends
* Toolbar icons are now styled for dark themes
* Cursor text now uses a number of significant digits matching
pointing precision
* Functions to compute a Path's size
* savefig() gained a backend keyword argument
* Saving SVG now supports adding metadata
* Saving PDF metadata via PGF now consistent with PDF backend
* NbAgg and WebAgg no longer use jQuery & jQuery UI
For further details, please see the What's new in Matplotlib 3.3.0 page:
https://matplotlib.org/3.3.0/users/whats_new.html
<https://matplotlib.org/3.3.0/users/whats_new.html>
and the milestone on GitHub:
https://github.com/matplotlib/matplotlib/milestone/48?closed=1
<https://github.com/matplotlib/matplotlib/milestone/48?closed=1>
For packagers, this release contains some changes to dependencies:
* Pillow is now required.
* jQuery and jQuery-UI are no longer used, nor downloaded as part of
the build.
* Compiled extensions are built with LTO if the compiler supports it.
This release is signed by my GPG key. The fingerprint is:
23CA B59E 3332 F94D 26BE F037 8D86 E7FA E5EB 0C10
and it is also used to sign this message.
All-
I'm trying to do something similar to this example:
https://matplotlib.org/examples/axes_grid/parasite_simple2.html
However, instead of the parasite axes being overlaid with the primary one,
I'd like it to be a separate subplot that I can put different data on.
(Also, I'm trying to do this with a pair of y-axes, in case that's
relevant. It's not immediately obvious how to adjust the example to do this
with y instead of x.) Ultimately I want the second y-axis to set its range
to some multiple of the first. So, for example, if I set one axis to have a
y range of [0,64], I'd like the second subplot to automatically adjust its
range to [0,32]. (I'd also like to be able to link the x axes to adjust
together as normally done with the sharex keyword.)
My first thought was to modify the lines:
ax = SubplotHost(fig, 1, 1, 1)
...
ax_pm = ax_kms.twin(aux_trans)
to be:
ax = SubplotHost(fig, 2, 1, 1)
...
ax_pm = fig.add_subplot(212, transform=aux_trans)
but the result is a TypeError: unhashable type: 'Affine2D'.
Perhaps I'm getting transforms confused, and the transform keyword to
add_subplot is used to define its location on the figure instead of how
"twin" uses it to apparently scale the axes. The API just lists the keyword
as expecting a type "Transform", and mentions that it's passed along to the
Axes base class, which also just lists it as being of type "Transform".
(aside: is there documentation for the "SubplotHost" class? I don't see it
listed here:
https://matplotlib.org/3.1.1/api/_as_gen/mpl_toolkits.axes_grid1.parasite_a…
I went looking for the documentation of the "twin" function to see if I
could understand how it used the transform, but was unable to find it in
about 5 minutes of looking.)
To make it a little clearer what I'm after, here's some base code to set up
an example:
import matplotlib.pyplot as plt
xdata = [1, 2, 3, 4, 5, 6]
ydata = [2, 4, 8, 16, 32, 64]
ydata2 = [y/2 for y in ydata]
fig = plt.figure()
ax1 = fig.add_subplot(2, 1, 1)
ax2 = fig.add_subplot(2, 1, 2, sharex=ax1)
ax1.plot(xdata, ydata)
ax2.plot(xdata, ydata2)
# <somehow link the two y axes>
ax1.set_ylim([0, 64])
# ax2.set_ylim([0, 32]) # happens automagically with the previous line
It would be super convenient if one could simply pass a transform as the
argument to sharey in the call to add_subplot...
Thanks for any help you might provide,
--Chad