qwt 绘图曲线轴不可见

发布于 2024-12-23 06:57:07 字数 78 浏览 1 评论 0原文

我正在使用 qwt 绘图曲线来绘制曲线。 x 轴和 y 轴不可见,只有曲线可见。 如何显示轴并显示一些第一个、最后一个和中间值 轴的刻度间隔

I am using qwt plot curve to draw curve.
the x axis and the y axis are not visible, only the curve is visible.
How to show the axis with showing some first, last and middle values in
the scale interval of the axis

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

滴情不沾 2024-12-30 06:57:07

我给你举一个小例子:

   // xBottom - x-axis yBottom - y-axis

    plot->setAxisMaxMinor(QwtPlot::xBottom, 2);
    plot->setAxisScale(QwtPlot::xBottom, 0, MAX_X_VALUE, 2);
    plot->setAxisMaxMinor(QwtPlot::yLeft, 2);
    plot->setAxisScale(QwtPlot::yLeft, 0, 1, 1);
    plot->setAxisMaxMinor(QwtPlot::yLeft, 1);
    plot->setAxisScale(QwtPlot::yLeft, -1, 1, 1);

I give you a small example:

   // xBottom - x-axis yBottom - y-axis

    plot->setAxisMaxMinor(QwtPlot::xBottom, 2);
    plot->setAxisScale(QwtPlot::xBottom, 0, MAX_X_VALUE, 2);
    plot->setAxisMaxMinor(QwtPlot::yLeft, 2);
    plot->setAxisScale(QwtPlot::yLeft, 0, 1, 1);
    plot->setAxisMaxMinor(QwtPlot::yLeft, 1);
    plot->setAxisScale(QwtPlot::yLeft, -1, 1, 1);
北笙凉宸 2024-12-30 06:57:07

1)你应该有一些 QwtPlot 对象。我假设您想绘制 xBottom 和 yLeft 轴。

QwtPlot *plot=new QwtPlot(this);
//following 4 lines may not be required because
//QwtPlot defaults are to show xBottom and yLeft axes
//and you use autoscaling for these axes
plot->enableAxis(QwtPlot::xBottom);
plot->enableAxis(QwtPlot::yLeft);
plot->setAxisAutoScale(QwtPlot::xBottom,true);
plot->setAxisAutoScale(QwtPlot::yLeft,true);

如果您使用 QtDesigner 和 QwtPlot 小部件,那么您已经拥有它了。您可以使用 ui->plot 访问它

2) 您应该有

QwtPlotCurve * curve = new QwtPlotCurve();
//.... attach some data to curve
curve->attach(plot);

3) 也许您想调用 replot

plot->replot();

1) You should have some QwtPlot object. I assume you want to draw xBottom and yLeft axes.

QwtPlot *plot=new QwtPlot(this);
//following 4 lines may not be required because
//QwtPlot defaults are to show xBottom and yLeft axes
//and you use autoscaling for these axes
plot->enableAxis(QwtPlot::xBottom);
plot->enableAxis(QwtPlot::yLeft);
plot->setAxisAutoScale(QwtPlot::xBottom,true);
plot->setAxisAutoScale(QwtPlot::yLeft,true);

You already have it if you were using QtDesigner and QwtPlot widget with it. You can access it with ui->plot

2) You should have

QwtPlotCurve * curve = new QwtPlotCurve();
//.... attach some data to curve
curve->attach(plot);

3) Probably you want to call replot

plot->replot();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文