如何使用 GNUplot 绘制等边三角形?
我正在尝试使用 GNUplot 将数据绘制成二维重心等边三角形。
我正在使用以下命令:
unset border
unset xtics
unset ytics
set arrow 1 from 0,0 to .5,sqrt(3)/2 nohead front lt -1 lw 1
set arrow 2 from 0,0 to 1,0 nohead front lt -1 lw 1
set arrow 3 from 1,0 to .5,sqrt(3)/2 nohead front lt -1 lw 1
set label 1 "1" at 0.5,sqrt(3)/2+.05
set label 2 "2" at 1+.05,0
set label 3 "3" at -.05,0
plot 'data.file'
上述命令不会创建等边三角形,而是创建等腰三角形。
请帮我!
谨致问候, 斯瓦蒂
I'm trying to plot my data into two-dimensional barycentric equilateral triangle using GNUplot.
I'm using the following commands:
unset border
unset xtics
unset ytics
set arrow 1 from 0,0 to .5,sqrt(3)/2 nohead front lt -1 lw 1
set arrow 2 from 0,0 to 1,0 nohead front lt -1 lw 1
set arrow 3 from 1,0 to .5,sqrt(3)/2 nohead front lt -1 lw 1
set label 1 "1" at 0.5,sqrt(3)/2+.05
set label 2 "2" at 1+.05,0
set label 3 "3" at -.05,0
plot 'data.file'
The above mentioned commands does not create an equilateral triangle instead its making Isosceles triangle.
Please help me!
With Regards,
Swati
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的图形可能是通过不均匀的 X/Y 缩放生成的,三角形的内部坐标是正确的,但输出是等腰的。
尝试添加命令
有关详细信息,请查看此常见问题解答。
It's possible that your figure is being produced with uneven X/Y scaling, with the internal coordinates of your triangle being correct, but the output, being isosceles.
Try adding a command
For more information check this FAQ.
我最近遇到了这个问题。我创建了一个名为triangle.dat 的文件。它包含 1 条线,指示在何处绘制三角形。
然后在我的“myplot.gnu”中,
这将在点 1.0、1.0 处绘制一个黑色等边三角形。更改点大小以更改大小。
如果您已经绘制了其他一些点,请使用 replot 而不是plot。
I recently had this problem. I created a file called triangle.dat. It contains 1 line indicating where to draw the triangle.
Then in my "myplot.gnu"
This will plot a black equilateral triangle at point 1.0, 1.0. Change pointsize to change the size.
If you have already plotted some other points, then use replot instead of plot.