如何使用gnu图获得径向(极坐标)图? [英] How to get a radial(polar) plot using gnu plot?

查看:77
本文介绍了如何使用gnu图获得径向(极坐标)图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want a radial(polar) plot using gnuplot (i.e in circular co-ordinate system(r,theta).

我在这里使用了这些值:

Here I have used the values:

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

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

How to get such a plot using gnu-plot?

推荐答案

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

I tried to recreate the plot of your question and this is what I came up with:

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不在顶部而是在右侧(在数学上是正确的).您可以通过修改绘图中的使用减速度和set_label函数来更改此设置.

As you can see, the major difference is that the angle 0 is not on top but on the right (which is mathematically correct). You can change this however by modifying the using deceleration in the plot and the set_label function.

正如您在脚本中看到的那样,并不是所有的东西都真正的酥脆有光泽.如果有人发现改进之处,请告诉我!

As you can see in the script not everything is really crisp and shiny. If someone finds improvements please let me know!

建议"的最后一部分:尝试使用gnuplot从某些工具再现图并非总是合理的. gnuplot的优势通常在于以最简单的方式绘制数据以使其易于重现.也许您可以从上面的脚本中删除一些代码,但仍然对此感到满意.

One last bit of "advice": It is not always reasonable to try to reproduce a plot from some tool with gnuplot. Often the strength of gnuplot is to plot data in the most simple way to be easily reproducible. Maybe you can kick some lines out of that script above and still be happy with it.

这篇关于如何使用gnu图获得径向(极坐标)图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆