Promote it to a GraphicLayout, then add plots to it:
gl = <your graphic layout from a promoted  QGraphicView>

p1 = gl.addPlot(0,0) # it will contain your data
p2 = gl.addPlot(1,0) # it will contain the error

Then you may need to link the axis so that scrolling one scroll also the 
second. You may have to give different heights to the plots, etc. 


Il giorno mercoledì 21 ottobre 2020 alle 22:52:00 UTC+2 [email protected] 
ha scritto:

> Thanks, Ognyan, 
>
> Unfortunatly, I am still puzzled how to make it, even with your seemingly 
> logical example.
>
> I guess my problem comes from the fact that I promoted a QtDesigner's 
> QGraphicsView widget to pyqtgraph PlotWidget().
>
>
> E.g. a minimal example is:
>
>
> """""""""""""""""""""""""""
>     def initialize_plots(self):
>         global p1
>
>         p1  = self.graphicsView_timeseries_RV # which is a PlotWidget
>
> """""""""""""""""""""""""""
>    def update_RV_plots(self):
>         global fit, p1
>
>         p1.plot(clear=True,)
>             
>         model_curve = p1.plot(fit.fit_results.model_jd,y_model, 
>         pen={'color': fit.colors[-1], 'width': 
> self.rv_model_width.value()},enableAutoRange=True, #symbolPen={'color': 
> 0.5, 'width': 0.1}, symbolSize=1,symbol='o',
>         viewRect=True, labels =  {'left':'RV', 'bottom':'JD'}) 
>         
>         model_curve.setZValue(self.RV_model_z.value()) 
>         
>
>         error_list = fit.fit_results.rv_model.rv_err
>
>
>         for i in range(max(fit.filelist.idset)+1):
>             
> p1.plot(fit.fit_results.rv_model.jd[fit.filelist.idset==i],fit.fit_results.rv_model.rvs[fit.filelist.idset==i],
>  
>
>             pen=None, #{'color': colors[i], 'width': 1.1},
>             symbol=fit.pyqt_symbols_rvs[i],
>             symbolPen={'color': 
> fit.colors[i]+"%02x"%int(fit.pyqt_color_alpha_rvs[i])
> , 'width': 1.1},
>             
> symbolSize=fit.pyqt_symbols_size_rvs[i],enableAutoRange=True,viewRect=True,
>             
> symbolBrush=fit.colors[i]+"%02x"%int(fit.pyqt_color_alpha_rvs[i])
>             )
>
>             err1 = 
> pg.ErrorBarItem(x=fit.fit_results.rv_model.jd[fit.filelist.idset==i], 
>                                    
> y=fit.fit_results.rv_model.rvs[fit.filelist.idset==i],symbol='o', 
>             top=error_list[fit.filelist.idset==i],
>             bottom=error_list[fit.filelist.idset==i],
>             beam=0.0, 
> pen=fit.colors[i]+"%02x"%int(fit.pyqt_color_alpha_rvs[i]))  
>
>             p1.addItem(err1)
>  
> """""""""""""""""""""""""""    
>
> On Monday, October 19, 2020 at 8:35:38 PM UTC+2 [email protected] wrote:
>
>> My first try would be to use a GraphicsLayout and add the two plots that 
>> way
>>
>> layout = pg.GraphicsLayout()
>> topPlot = pg.PlotDataItem(*args, **kwargs)
>> bottomPlot = pg.PlotDataItem(*args, **kwargs, axisItems={'bottom', axis})
>> layout.addItem(topPlot, row=0)
>> layout.addItem(bottomPlot, row=1)
>>
>> # layout.layout is QGraphicsGridLayout, which has more sizing methods 
>> that may be handy, like setting fixed heights
>> layout.layout.setRowFixedHeight(1, 200)  # guessing 200 pixels, set the 
>> height to whatever you want
>>
>> Would that accomplish what you're looking for?
>>
>> On Mon, Oct 19, 2020 at 11:05 AM Trifon Trifonov <[email protected]> 
>> wrote:
>>
>>>
>>> Can somebody please advice how to get a plot like this (attached):
>>>
>>> Details are not important, I just need a plot and a residual plot at the 
>>> bottom. Important is also that the x-axis must be one shown at the residual 
>>> plot.
>>>
>>>
>>> I want the same effect for these two plot in the Exo-Striker tool 
>>> (attached 2)
>>>
>>> Thanks a lot!
>>>
>>>
>>> -- 
>>> 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/252f2f18-e4c2-4c38-b00d-3727f9d9bd48n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/pyqtgraph/252f2f18-e4c2-4c38-b00d-3727f9d9bd48n%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/eed3abc1-caae-4733-bc2e-7667af694674n%40googlegroups.com.

Reply via email to