如何使用gnu图获得径向(极坐标)图?

时间:2011-07-21 06:32:06

标签: gnuplot

我想要一个使用gnuplot的径向(极坐标)图(即在圆坐标系(r,theta)中。

我在这里使用了值:

Theta Max-strain
0     3400
60    5300
120   4700
180   3800
240   4100
300   3100
360   3400

如何使用gnu-plot获得这样的情节?

2 个答案:

答案 0 :(得分:27)

我试图重新创建你问题的情节,这就是我想出的:

unset border
set polar
set angles degrees #set gnuplot on degrees instead of radians

set style line 10 lt 1 lc 0 lw 0.3 #redefine a new line style for the grid

set grid polar 60 #set the grid to be displayed every 60 degrees
set grid ls 10

set xrange [-6000:6000] #make gnuplot to go until 6000
set yrange [-6000:6000]

set xtics axis #disply the xtics on the axis instead of on the border
set ytics axis

set xtics scale 0 #"remove" the tics so that only the y tics are displayed
set xtics ("" 1000, "" 2000, "" 3000, "" 4000, "" 5000, "" 6000) #set the xtics only go from 0 to 6000 with increment of1000 but do not display anything. This has to be done otherwise the grid will not be displayed correctly.
set ytics 0, 1000, 6000 #make the ytics go from the center (0) to 6000 with incrment of 1000

set size square 

set key lmargin

set_label(x, text) = sprintf("set label '%s' at (6500*cos(%f)), (6500*sin(%f))     center", text, x, x) #this places a label on the outside

#here all labels are created
eval set_label(0, "0")
eval set_label(60, "60")
eval set_label(120, "120")
eval set_label(180, "180")
eval set_label(240, "240")
eval set_label(300, "300")


set style line 11 lt 1 lw 2 pt 2 ps 2 #set the line style for the plot

#and finally the plot
plot "-" u 1:2 t "Max strain" w lp ls 11
0 3400
60 5300
120 4700
180 3800
240 4100
300 3100
360 3400
e

Plot of the script above

如您所见,主要区别在于角度0不在顶部而在右侧(在数学上是正确的)。但是,您可以通过修改绘图中的使用减速度和set_label函数来更改此值。

正如你在剧本中看到的那样,并非一切都非常清晰闪亮。如果有人找到改进,请告诉我!

最后一点“建议”:尝试使用gnuplot从某个工具重现绘图并不总是合理的。 gnuplot的强度通常是以最简单的方式绘制数据以便于重现。也许你可以从上面的那个剧本中踢出一些内容,但仍然对它很满意。

答案 1 :(得分:5)

这是一本手册http://t16web.lanl.gov/Kawano/gnuplot/polar-e.html

 set polar
 set angles degrees

并获得圈子:

 set grid polar

以下是演示:http://gnuplot.sourceforge.net/demo/polar.html

相关问题