QCustomPlot Discussion and Comments

Stacked plots with aligned x axesReturn to overview


I'm drawing several plots displaying different kinds of real-time data, placed in QVBoxLayout. They have different ranges on yAxis, but I'd like them to share xAxis, which in my case is time.

Plots should either use the same xAxis (stacked plots in the same QCustomPlot widget), or be aligned (vertical line crossing all plots should point to the same time value on all plots).

Is it possible?

Why you are not using multi-axis feature? You can have all of your plots into one plot but with one axis for every graph and they all have their own axis and there is one y-axis(time) for all of them.

Could you show me a screenshot how it could look like?

Sorry, I've missed this one: http://www.qcustomplot.com/images/examples/advancedaxesdemo.png

Let's say, I have several plots in vertical orientation but each plot is a separate widget consisting of single plot, how would I go about trying to keep the vertical ticks aligned?

I think QCPMarginGroup will solve your problem :)


see http://www.qcustomplot.com/documentation/classQCPMarginGroup.html

It appears the QCPMarginGroup is not part of 1.0 release?

Is it possible to use QCPMarginGroup with separate QCustomPlot widgets?

Yes, I've tested it and it works like a charm :)

Thank you very much, now my plots are finally arranged in a way described in the opening post!


What version of the library are you using? I have downloaded 1.0 version and it does not appear to include QCPMarginGroup.


QCPMarginGroup is part of release 1.0.0 (in the beta already, actually).

Hi, I know this thread is very old, but it helped me solve my problem. I'm using QCPMarginGroup to align three QCPAxisRects on three rows. I've set the left and right axes to be aligned, which worked wonderfully (see image: https://drive.google.com/file/d/1-3FXKtiy9_OKjGr3jdWwmWn2GzoszZg6/view?usp=sharing).

Now, I am facing a problem where the left y-axis labels are not aligned (due to the different ranges on the y-axes pushing the labels to different places).

Is there any way to fix this?

Sorry, seems my question was already asked here: https://www.qcustomplot.com/index.php/support/forum/1893 . However, it is still unanswered. The only reply there suggested using QCPMarginGroup, but as far as I can tell, that does not solve the issue (I'm already using QCPMarginGroup).