更改x轴比例时,如何更改x轴范围?

huangapple go评论259阅读模式
英文:

gnuplot - How do I change xrange when changing x-axis scale?º

问题

我有以下数据:

100 100.0
500 499.8
1000 999.0
2000 1994.4
3000 2918.8
10000 8233.8
99999 9433.2

我想绘制图表,使得所有x轴标签等间隔。参考此链接,我制作了以下脚本:

set terminal png size 500,500

set output 'throughput.png'
set title 'Connection throughput'

plot 'throughput.txt' using 0:2:xticlabel(1) title "Throughput"

我得到了以下结果。

更改x轴比例时,如何更改x轴范围?

尽管如此,我希望数据点从100到99999的值可见。为了解决这个问题,我尝试使用set xrange [0,110000] 指令。结果如下。

更改x轴比例时,如何更改x轴范围?

如您所见,x轴混乱。

我的问题是,是什么导致了这种情况?还有其他设置x轴范围的方法吗?

谢谢您的帮助。

英文:

I have the following data:

100 100.0
500 499.8
1000 999.0
2000 1994.4
3000 2918.8
10000 8233.8
99999 9433.2

I want to plot this so I have all x-axis labels equally spaced. Taking this link into account, I made the following script:

set terminal png size 500,500

set output 'throughput.png'
set title 'Connection throughput'

plot 'throughput.txt' using 0:2:xticlabel(1) title "Throughput"

I get the following.

更改x轴比例时,如何更改x轴范围?.

Nonetheless, I want the data points from 100 and 99999 values to be visible. To solve it I tried using the set xrange [0,110000] instruction. The result this.

更改x轴比例时,如何更改x轴范围?.

As you can see, x-axis is messed up.

My questions are, what is causing this to happen? Is there any other way to set the x-axis range?

Thanks for any help in advance.

答案1

得分: 1

你的数据点从100到99999可见。这些紫色的“+”标志只是在坐标轴上方,几乎看不见。

两个可能的选择:

  • 更改点类型和颜色以使数据点“可见”

  • 在图表上添加偏移量(或边距)(参考帮助 偏移

还有可能的选项:
设置偏移量 0.5,0.5,0.0,0.0

脚本:

### 更改点类型并添加边距
重置会话

$数据 <<EOD
100 100.0
500 499.8
1000 999.0
2000 1994.4
3000 2918.8
10000 8233.8
99999 9433.2
EOD

设置键左上
设置偏移量图形 0.05,图形 0.05,图形 0.05,图形 0.00   # 左、右、上、下

绘制 $数据 使用 0:2:xtic(1) w points pt 7 lc "red" ti "吞吐量"
### 脚本结束

结果:

更改x轴比例时,如何更改x轴范围?

英文:

Your data points from 100 and 99999 are visible. These violet +s are just on top of the axes and hardly visible.

Two possible options:

  • change the pointtype and color to make the data points "visible"

  • add an offset (or margin) to your graph (check help offsets)

Also possible:
set offsets 0.5, 0.5, 0.0, 0.0

Script:

### change pointtype and add margins
reset session

$Data &lt;&lt;EOD
100 100.0
500 499.8
1000 999.0
2000 1994.4
3000 2918.8
10000 8233.8
99999 9433.2
EOD

set key top left
set offsets graph 0.05, graph 0.05, graph 0.05, graph 0.00   # left, right, top, bottom

plot $Data u 0:2:xtic(1) w points pt 7 lc &quot;red&quot; ti &quot;Throughput&quot;
### end of script

Result:

更改x轴比例时,如何更改x轴范围?

huangapple
  • 本文由 发表于 2023年4月17日 18:45:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76034317.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定