Thanks very much, I can now link X axis of ViewBox1 to Y axis of ViewBox2.
Also, thanks for your quick response!

However I noticed following bug: I have to quickly zoom in/out in each
ViewBox to "initialize" the linking. Else when zooming (or translating) in
ViewBox1, there is a strange wiggling in ViewBow2 (instead of also zooming
in). The wiggling is like a very fast zoom in / zoom out.
As a workaround, when initalizing my widget I do:

self.ViewBox1.scaleBy(1)
self.ViewBox2.scaleBy(1)

Which simulates the quick zoom in/out I had to do with the mouse. Now
everything works as intended. But I find it strange that I had to do this
to achieve desired behaviour. Did someone had a similar issue or can shed
some light?





Le mer. 12 févr. 2020 à 04:59, Patrick <[email protected]> a écrit :

> Hi,
>
> Connect to the signals of the plot's ViewBox and then sync the range
> changes manually. I have done this in the past for a four-panel display of
> a "3D cube" of data and it works well (see screenshot). Important parts of
> code looks like this:
>
>     def __init__(self):
>         # ...
>         # overview, t1slice, t2slice, spectrum are pyqtgraph plots
>         # ...
>         self.overview.setYLink(self.t1slice)
>         self.overview.setXLink(self.t2slice)
>         self.t1slice.getViewBox().sigRangeChangedManually.connect(self.
> _link_waxes_t1slice)
>         self.t2slice.getViewBox().sigRangeChangedManually.connect(self.
> _link_waxes_t2slice)
>         self.spectrum.getViewBox().sigRangeChangedManually.connect(self.
> _link_waxes_spectrum)
>
>     def _link_waxes_t1slice(self, something):
>         self.t2slice.setYRange(*self.t1slice.getViewBox().viewRange()[0])
>         self.spectrum.setXRange(*self.t1slice.getViewBox().viewRange()[0])
>
>     def _link_waxes_t2slice(self, something):
>         self.t1slice.setXRange(*self.t2slice.getViewBox().viewRange()[1])
>         self.spectrum.setXRange(*self.t2slice.getViewBox().viewRange()[1])
>
>     def _link_waxes_spectrum(self, something):
>         self.t1slice.setXRange(*self.spectrum.getViewBox().viewRange()[0])
>         self.t2slice.setYRange(*self.spectrum.getViewBox().viewRange()[0])
>
> Patrick
>
>
> On Wednesday, 12 February 2020 00:55:34 UTC+10:30, Manu wrote:
>>
>> Hi, I've got the same question. Any advice?
>>
> --
> You received this message because you are subscribed to the Google Groups
> "pyqtgraph" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pyqtgraph/f29d02ed-1a3d-425c-9966-4892b0c5207c%40googlegroups.com
> <https://groups.google.com/d/msgid/pyqtgraph/f29d02ed-1a3d-425c-9966-4892b0c5207c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/CAM40y_Z6VdaBuUsWbOGafAJk4pvrB%3DcfWs08Kp7gqnUG%3DOjJJQ%40mail.gmail.com.

Reply via email to