gnuplot中的极坐标图

时间:2020-06-05 20:34:17

标签: gnuplot polar-coordinates

我有问题。我正在尝试绘制极坐标图,事实是我想在图中绘制一些理论线作为一些实验数据。但是理论线与实验数据的范围有所不同,因为我必须像这样用gnuplot对其进行绘制。

我有以下脚本:

####
reset
set encoding utf8
set size 1,1
set terminal epslatex
set output "direccionalidad.tex"

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
set grid polar 30 #set the grid to be displayed every 60 degrees
set grid ls 10

set trange[-90:90]

f(t)=27.934*sin(1.81651*t+96.1991) # Theorical line

set xrange[-31:32]
set yrange[-30:30]

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 displayedj

set ytics (0, 6, 12) #make the ytics go from the center (0) to 6000 with incrment of 1000

unset ytics
set xtics ("5" 6, "15" 16.5, "30" 32) 
# 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 rtics (5,15,30)
set rtics format ' ' scale 0


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

eval set_label(0, "0") 

eval set_label(30, "30")

eval set_label(60, "60")

eval set_label(90, "90")

eval set_label(120, "120")

eval set_label(150, "150")

eval set_label(180, "180")

eval set_label(-150, "-150")

eval set_label(-120, "-120")

eval set_label(-90, "-90")

eval set_label(-60, "-60")

eval set_label(-30, "-30")

set size square

#PLOTS
plot "direccionalidaddatos.txt" u 1:3 pointtype 7 ps 2 lt 1 lw 3 lc rgb 'blue' notitle ,\
f(t) dt '-' lc rgb 'blue' notitle 

#ACABAMOS

###

这里有direccionalidaddatos.txt档案中的一些列示例,中间的列只是以弧度表示的角度,但这是无用的,因为我只想要角度以度为单位,所以就忽略它;) >

-90 -1.570796327 0.1

-85 -1.483529864 0.2

-80 -1.396263402 0.4

-75 -1.308996939 0.7

-70 -1.221730476 1.1

-65 -1.134464014 1.7

-60 -1.047197551 2.5

结果是图像Polar plot

正如您在图像中看到的那样,有两个没有点的分支,我希望这些分支不会消失,因为它们并不意味着不在图形中显示。因此,如果有人知道一种使分支消失的形式, ,或者为了改善脚本让我知道嘿嘿。

非常感谢。

1 个答案:

答案 0 :(得分:0)

您能减少第二个绘图分量的采样范围吗?

plot "direccionalidaddatos.txt" u 1:3 pointtype 7 ps 2 lt 1 lw 3 lc rgb 'blue' notitle ,\
     [-52:45] '+' using 1:(f($1)) with lines dt '-' lc rgb 'blue' notitle