QCustomPlot Discussion and Comments

QCustomPlot with multiple QCPAxisRect - "graph area" height with one bottom axisReturn to overview

I have a layout/margin question when having one QCustomPlot with multiple QCPAxisRect:s. I have tried to search for the answer in the support forum but not found the answer.

In my case the QCPAxisRect:s are stacked vertically and to save screen space I use no bottom axis label and the bottom axis tick labels are only enabled / visible for the bottom QCPAxisRect. This works fine but the height of the "graph area" of the last QCPAxisRect then gets a little bit smaller than the other. Whats the best way to automatically make sure that the "graph area" of all the QCPAxisRect:s have the same height?

I assume the issue is that the height of the tick labels (and also axis label if used) is added and thus decrease the available space for the rest.

I'm thinking about how to solve this:
1) Use axisrect->axis(QCPAxis::atBottom)->setTickLabelSide(QCPAxis::LabelSide::lsInside) - i.e. place the tick labels on the inside - this is what I currently do
2) Somehow manually add the tick labels as a separate layout item so that they are not part of the QCPAxisRect
3) Manually set margins or heights
4) ?

Here is an example - https://imgur.com/a/blVtMCK

Best regards
// Stefan

You could use an empty axisRect with no graph just to display the xAxis, and then add for each graph a new axisRect with only yAxis visibleā€¦