How to hide grid and show only zeroline in QCustomPlot?

3.6k views Asked by At

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.

3

There are 3 answers

0
DerManu On BEST ANSWER

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

0
Sayan Bera On
//grid handling
bool isGridLineVisible() const;
void setGridLineVisible(bool visible = true);
0
Mounir Madjour On
Current->xAxis->grid()->setSubGridVisible(false); 
Current->yAxis->grid()->setSubGridVisible(false);