QCustomPlot Discussion and Comments

How to do Subplot?Return to overview

How do I do subplot to achieve the following layout.

First I will partition my GUI window into 3 rows (top, mid, bottom) with equal height.
Top row will occupy 100% of the width for graph #1
Mid row will be further divided into left & right column for graph #2 and #3 respectively.
Bottom row will also be divided into left & right column for graph #4 and #5 respectively.

Thanks

Did you have a look at the documentation
http://www.qcustomplot.com/documentation/thelayoutsystem.html
and the example code of the "Advanced Axes Demo"? They both explain how to use QCustomPlot's layout system.

Juding from your other post and your saying "I will partition my GUI window into 3 rows" I'd like to say a word of warning: Don't confuse QCustomPlot's layout system with Qt's layout system. They are similar to use but not identical and especially not interchangeable. One is QLayout-based for QWidgets, the other is QCPLayout-based for QCPLayoutElements. Accordingly, If you read the QLayout documentation in order to find out how to use QCPLayout, you will get confused, and the other way around.

Thank you very much ^_^

Hi,

I have tried the example in the *link. It works. However, if I change the axis range of the y axis like following

bottomAxisRect->axes()[1]->setRange(0,1);

,the yAxis of the bottomAxisRect and leftAxisRect do not align anymore, because of the decimal points.

Furthermore, I checked alignment problem with different Tick label formats, for example "e". If upper plot's range is "0 to 10" and lower plot's range is "0 to 0.1" the "+" and "-" signs appearing in the scientific notation ("1e+1" and "1e-1") also destroy alignment of the plots.

It is a small problem but make subplots look extremely ugly.

is there any solution for this axis alignment problem.

*link : http://www.qcustomplot.com/documentation/thelayoutsystem.html

Regards,

Yeah, it's even said on the page you link to.

use
https://www.qcustomplot.com/documentation/classQCPMarginGroup.html#details