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

Gnuplot 如何使用gnu绘图获得径向(极坐标)绘图?,gnuplot,Gnuplot,我想要一个使用gnuplot(即圆形坐标系(r,θ))的径向(极性)图 在这里,我使用了以下值: Theta Max-strain 0 3400 60 5300 120 4700 180 3800 240 4100 300 3100 360 3400 如何使用gnu绘图获得这样的绘图?这是一本手册 要得到圆: set grid polar 这是一个演示:我试图重现你问题的情节,这就是我想到的: unset border set polar set angl

我想要一个使用gnuplot(即圆形坐标系(r,θ))的径向(极性)图

在这里,我使用了以下值:

Theta Max-strain
0     3400
60    5300
120   4700
180   3800
240   4100
300   3100
360   3400
如何使用gnu绘图获得这样的绘图?

这是一本手册

要得到圆:

 set grid polar

这是一个演示:

我试图重现你问题的情节,这就是我想到的:

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

如您所见,主要区别在于角度0不在顶部,而是在右侧(这在数学上是正确的)。但是,您可以通过修改绘图中的“使用减速”和“设置标签”功能来改变这一点

正如你在脚本中看到的,并不是所有的东西都是那么的清晰和闪亮。如果有人发现了改进,请告诉我


最后一点“建议”:尝试使用gnuplot从某个工具复制绘图并不总是合理的。gnuplot的优势通常是以最简单的方式绘制数据,以便于复制。也许您可以从上面的脚本中删除一些行,并且仍然对其感到满意。

谢谢。我已经尝试使用set grid polar。但我无法显示角度s,我必须指定x和y,获得的绘图与我想要的不匹配。我现在重新框定了我的问题。希望这次我清楚了。尝试使用线进行
绘图数据…设置网格极坐标30
将每30度添加一条线。您可能希望取消绘图中的360度,因为它是冗余的0°…非常感谢。这非常有用。我尝试使用set_标签,正如您上面提到的那样,但出现了一个错误。没有标签它工作正常。如果有负值,比如-3400,-5300等等,那么在上面的图中,而不是y轴上的6000到0,它应该向内变为0到-6000。与您得到的图类似,In MS Excel。如何获得这样的绘图?@Dolly
set\u label
宏正在我的机器上运行。错误消息是什么?至于负值:在极坐标图中,不能有负值,因为值或多或少是半径,半径不能为负值。如果有负值,可能不应该使用极坐标图或mayb用
exp
log
映射它!当我使用set\u标签时,绘图不会被创建。当我不使用set\u标签时,绘图就会被创建。该选项在旧的gnu绘图版本中不可用吗?我在哪里可以下载新版本?@Dolly我不知道要使宏工作,你必须拥有哪个版本的gnuplot。但这总是一个问题我希望有最新版本。您可以从@Dolly替换
“-”
,使用值所在的文件名。例如:
plot“Data.dat”u 1:2…
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