Reputation: 16089
I have a QwtPlot subclass that draws labels for the left and bottom axes and I would like to add some extra margins to these labels—specifically, between these labels and the tick marks’ numerical labels. Is there any built-in way to add such padding? (I’m using the QwtPlainTextEngine to render the labels now, so I guess I could create my own subclass that adds extra space, but that would be much lower-level than I’d like.)
Upvotes: 0
Views: 1869
Reputation: 213
I had same problem and solved like these methods.
Method 1:
We can give a margin with canvas like this
double margin = 30;
plot->plotLayout()->setCanvasMargin(margin, QwtPlot::yLeft);
plot->plotLayout()->setCanvasMargin(margin, QwtPlot::yRight);
Don't forget #include <qwt_plot_layout.h>
Method 2:
Using axis distance border distance. Here is the example:
double margin = 30;
plot->axisWidget(QwtPlot::xBottom)->setMinBorderDist(margin, margin);
Don't forget #include <qwt_scale_widget.h>
I hope this will be useful.
Upvotes: 1