QCustomPlot Discussion and Comments

How to create multi channel plot?Return to overview

Hi every one
I Create multi graph and plot sin, cos and one more for test. Now I want to show these graphs below each other. can every one help me?
thanks a lot.

i want to have somthing like these
every graph ploted in below other.

use layout
pls see document

Thanks for answering.
In this page https://www.qcustomplot.com/documentation/thelayoutsystem.html
example 4 can solve part of my problem, but i want to share x axis between every graph, is there a solution to this problem?

yes, use QSharedPointer<QCPAxis*>

Can you please give me an example code?


Thanks for answering.

Can we determine the range of each graph separately?
for example graph1 range is -1 to 1 and graph2 as well. but graphs below each other?

Can anyone help?

Sounds like you want two axis rects underneath each other, with synchronized axes. Check this out:

Make sure to put the axisrects in an according QCPMarginGroup for left and right margins, so they are neatly aligned. (also explained in the page above)

the multi axis demo also shows how to create multiple axis rects, in case you want to have a reference.

Ah I just saw you already know about axis rects. Well to synchronize the axes, you simply connect them. So connect the rangeChanged signal of the lower axis rect xAxis to the setRange slot of the top axis rect xAxis.

You can then also make the top axis rect xAxis invisible (axisRect->setVisible(false)), this way you only see the bottom one.