Hi,

This is probably because the signals are only emitted on manual (user) 
changes of the view region. If you load/add data to the plots then the axes 
limits may change, but not trigger the synchronisation with the linked 
plot. There are other signals 
(http://www.pyqtgraph.org/documentation/_modules/pyqtgraph/graphicsItems/ViewBox/ViewBox.html#ViewBox)
 
like sigXRangeChanged, but if you decide to connect to them instead you'll 
need to be careful not to trigger infinite loops. I have a method which 
resets axes limits and ranges etc which I call after loading data etc to do 
the initial sync of the axes, which would have a similar effect to what you 
have done. Otherwise you could manually call one of your change handlers 
when data is loaded/changes.

Patrick

On Thursday, 13 February 2020 00:52:07 UTC+10:30, Manu wrote:
>
> 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] <javascript:>> 
> 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] <javascript:>.
>> 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/bb42528c-7790-4fd0-9172-32a08ea1f18c%40googlegroups.com.

Reply via email to