QCustomPlot Discussion and Comments

axis overlayReturn to overview

Hello.
How can I remove the distance (impose axes on each other) between two right axes, for example https://www.qcustomplot.com/index.php/tutorials/specialcases/axistags
offset on each right axis is 0
qDebug() << "offset =" << m_customPlot->axisRect(0)->axis(QCPAxis::atRight, 0)->offset(); // offset = 0
qDebug() << "offset =" << m_customPlot->axisRect(0)->axis(QCPAxis::atRight, 1)->offset(); // offset = 0

From the setOffset documentation:

Sets the offset the axis has to its axis rect side.

If an axis rect side has multiple axes and automatic margin calculation is enabled for that side,
only the offset of the inner most axis has meaning (even if it is set to be invisible). The
offset of the other, outer axes is controlled automatically, to place them at appropriate
positions.

So if you want to control axis offsets by hand, you need to turn off automatic margin calculation on the parent axis rect (at least for that specific axis rect side).