app = pg.mkQApp()
layout = pg.GraphicsLayoutWidget(show=True)
layout.setMinimumSize(2*650, 300)
plot = pg.PlotItem()
legend = pg.LegendItem()
legend.setParentItem(plot)
plot.legend = legend
plot2 = pg.PlotItem()
legend2 = pg.LegendItem()
legend2.setParentItem(plot2)
plot2.legend = legend2
x = np.linspace(0, 10, 100)
y = np.sin(x)
y2 = np.cos(x)
plot.plot(x, y, name='sinx')
plot2.plot(x, y2, name='cosx')
layout1 = layout.addLayout(row=0, col=0)
layout1.setMinimumSize(650, 300)
layout1.addItem(legend)
layout1.addItem(plot)
layout2 = layout.addLayout(row=0, col=1)
layout2.setMinimumSize(650, 300)
layout2.addItem(legend2)
layout2.addItem(plot2)
if __name__ == "__main__":
# app.exec()
pg.exec()