在 x 轴上绘制含有太多零的数据
我有这个 data1.dat 数据,我将使用 gnuplot 绘制它。
x y
0.007 3.09216
0.008 3.60607
0.009 5.86643
然后我尝试用这个绘图脚本绘制它
set terminal svg size 400,300 enhanced fname 'arial'
set output 'out2.png'
set xlabel 'diameter'
set ylabel 'number density'
set title 'density number plot'
plot "data1.dat" using 3:4 title "" with lines
如何转换 x 轴上的数字数据,使其仅显示 7 或 8 的示例?这是一个例子,可能我的数据会变得更大,所以我无法在x列中一一更改data1.dat上的数据,提前致谢
I have this data1.dat data that I'd plot using gnuplot.
x y
0.007 3.09216
0.008 3.60607
0.009 5.86643
then I tried to plot this with this plot script
set terminal svg size 400,300 enhanced fname 'arial'
set output 'out2.png'
set xlabel 'diameter'
set ylabel 'number density'
set title 'density number plot'
plot "data1.dat" using 3:4 title "" with lines
and the output in the x axis was like this
how to convert the number data on the x axis so it only shows only for example 7 or 8 only? this is an example and probably my data would getting bigger, so i can't change the data on data1.dat one by one in the x column, thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然,gnuplot 的 tic 算法没有考虑 ticlabel 的长度。这就是数字重叠的原因。
您可以执行以下操作:
手动设置 xtic 增量以避免重叠,例如
set xtic 0.0005
将您的值乘以一个系数,例如 1000,特别是如果您有可以显示毫米的米,即
($1* 1000)
与(column(1)*1000)
相同。代码:
结果:
Apparently, gnuplot's tic algorithm doesn't take the length of the ticlabels into account. That's why the numbers are overlapping.
You can do the following:
set the xtic increment manually to avoid overlap, e.g.
set xtic 0.0005
multiply your values by a factor, e.g. 1000, especially if you have meters you can display millimeters, i.e.
($1*1000)
which is identical to(column(1)*1000)
.Code:
Result: