gnuplot - 如何使用 gnuplot 获取径向(极坐标)图?

标签 gnuplot

我想要使用 gnuplot 绘制径向(极坐标)图(即在圆形坐标系(r,theta)中。

这里我使用了这些值:

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

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

最佳答案

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

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 函数来更改此设置。

正如您在脚本中看到的那样,并非所有内容都非常清晰和 Shiny 。如果有人发现改进,请告诉我!

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

关于gnuplot - 如何使用 gnuplot 获取径向(极坐标)图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6772135/

相关文章:

Gnuplot设置数据标签的背景颜色

gnuplot - 在 GNUPlot 中绘制一个环形段

gnuplot - 使用条件绘制直方图

gnuplot - 如何使网格虚线相交,在 gnuplot 中制作十字线?

graph - 带有 xtics 月份和年份的折线图

string - 来自字符串的 gnuplot 图

gnuplot - 在 gnuplot 中使用图像作为点

latex - Gnuplot - EPS 终端产生额外的字符

matlab - 如何在 Octave 中绘制和显示正方形?

gnuplot - 条形重叠框区域 gnuplot