[SOLVED] How to hide grid and show only zeroline in QCustomPlot?

Issue

Is there any way of showing zeroline in QCustomPlot while hiding grid? I have tried hiding grid with following line:

ui->customPlot->xAxis->grid()->setVisible(false);
ui->customPlot->yAxis->grid()->setVisible(false);

But this also hides the zerolines. I need to keep zerolines visible.

Solution

Set Qt::NoPen to QCPGrid::setPen/setSubGridPen, but not setZeroLinePen.

Answered By – DerManu

Answer Checked By – Pedro (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *