不绘制QWT绘图轴 [英] Not Drawing QWT Plot Axis
问题描述
我试图使用QWT绘制一个绘图,没有任何标题或轴标签。没有绘制标题似乎很容易,所有你要做的是不将它传递到标题,或者如果已经有一个,只是给它一个空字符串(如下):
I'm trying to draw a plot using QWT without any title or axis labels. Not drawing the title seems easy, all you have to do is not pass it in a title, or if there already is one, just give it an empty string (like this):
ui->plot->setAxisTitle(QwtPlot::xBottom, "");
ui->plot->setAxisTitle(QwtPlot::yLeft, "");
但是默认情况下绘制实际的标签(在axisScale属性内)(从0到1000 x和y)。但是,即使我可以改变它的外观,我不能删除它的完全。
But the actual labels (inside the axisScale property) are drawn by default (going from 0 to 1000 in both x and y). However even though I can change the way it looks, I can't remove it altogether.
因此有任何方法来绘制一个qwt图没有任何轴标签或标题?
So is there any way to draw a qwt plot without any axis labels or titles?
推荐答案
如果您不想使用比例或标签,则会有效:
If you don't want the scale or the labels, this will work:
ui->plot->enableAxis(QwtPlot::xBottom, false);
ui->plot->enableAxis(QwtPlot::yLeft, false);
如果你想显示没有标签的scale,你可以实现你自己的 QwtScaleDraw
对象,它为所有标签返回一个空的 QwtText
对象:
If you want to show the scales with no labels, you can implement your own QwtScaleDraw
object that returns an empty QwtText
object for all of the labels:
class MyScaleDraw : public QwtScaleDraw
{
public:
MyScaleDraw() : QwtScaleDraw() { }
virtual ~MyScaleDraw() { }
virtual QwtText label(double) const
{
return QwtText();
}
};
//...
ui->plot->setAxisScaleDraw(Qwt::xBottom, new MyScaleDraw);
ui->plot->setAxisScaleDraw(Qwt::yLeft, new MyScaleDraw);
可能有更好的方法,但这是我想到的。
There may be a better way, but this is one I could think of.
这篇关于不绘制QWT绘图轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!