QWT:日志刻度和十年的每10个

发布于 2025-01-28 04:58:09 字数 238 浏览 5 评论 0原文

我制作了一个带有X日志刻度和AY线性比例的QWTPLOT。 X轴范围从10到1000固定,即30年。一个添加了一个带有主要和小部门的网格。

问题:小滴答落在某些自动计算的位置上。

我想要的是:十年的10年(20,30,...,200,300,...)。

我试图在这里和那里找到各种示例,试图玩耍。但是我尝试的任何事情都没有改变任何事情。我敢肯定我错过了QWT文档中的某些内容...

QWT版本:6.1.4

I made a QwtPlot with an x log scale and a y linear scale. The x axis range is fixed from 10 to 1000, i.e. 3 decades. A added a grid with major and minor divisions.

The problem : the minor ticks fall at some automatically calculated positions.

What I want : a minor tick every 10th of a decade (20, 30, ..., 200, 300, ...).

I tried to play around, following various examples found here and there. But anything I tried didn't change a thing. I'm sure I missed something in Qwt's documentation...

Qwt version : 6.1.4

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

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

发布评论

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

评论(1

裂开嘴轻声笑有多痛 2025-02-04 04:58:10

我发现了。在QWTPLOT的子类中:

setAxisAutoScale(QwtPlot::xBottom, false);
xlogScale = new QwtLogScaleEngine();
QwtScaleDiv xDiv = xlogScale->divideScale(10.0, 1000.0, 2, 10, 1.0);
setAxisScaleEngine(QwtPlot::xBottom, xlogScale);
setAxisScaleDiv(QwtPlot::xBottom, xDiv);

键是第三行,该线设置了X轴刻度。
由于某种原因,我很难理解该函数期望的参数:

  • 从10到1000
  • 2主要步骤
  • ,每十年10个小步骤
  • 尺寸= 1个十年= 1个十年

,而且,请勿调用qwtplot :: SetaxissCale()< /代码>!它重置所有默认设置。

希望它有帮助!

I figured it out. In a subclass of QwtPlot :

setAxisAutoScale(QwtPlot::xBottom, false);
xlogScale = new QwtLogScaleEngine();
QwtScaleDiv xDiv = xlogScale->divideScale(10.0, 1000.0, 2, 10, 1.0);
setAxisScaleEngine(QwtPlot::xBottom, xlogScale);
setAxisScaleDiv(QwtPlot::xBottom, xDiv);

The key is the 3rd line, which sets the x axis scale.
For some reason, I had trouble to understand what arguments the function expects :

  • from 10 to 1000
  • 2 major steps
  • 10 minor steps per decade
  • major step size = 1 decade

And also, don't call QwtPlot::setAxisScale() ! It resets everything to default.

Hope it helps !

enter image description here

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