Matlab 使用何种绘图软件:具有唯一数据的二维极坐标图

Matlab 使用何种绘图软件:具有唯一数据的二维极坐标图,matlab,colors,plot,gnuplot,polar-coordinates,Matlab,Colors,Plot,Gnuplot,Polar Coordinates,我的(示例)数据格式如下: R_min R_max θ_min θ_min Zones 0 260 0 1.57 114 260 270 0 1.57 106 270 320 0 1.57 107 如您所见,我有从R_min到R_max创建的“区域”(区域),从θ_min到θ_max扫描。每行数据表示一个区域,我希望根据区域编号用相应的颜色绘制该区域。在这个简单的例子中,我上面显示的数据将如下图所示: 我应该使用什么绘图软件来完成此任务?我一

我的(示例)数据格式如下:

R_min  R_max   θ_min   θ_min   Zones

0   260 0   1.57    114
260 270 0   1.57    106
270 320 0   1.57    107
如您所见,我有从R_min到R_max创建的“区域”(区域),从θ_min到θ_max扫描。每行数据表示一个区域,我希望根据区域编号用相应的颜色绘制该区域。在这个简单的例子中,我上面显示的数据将如下图所示:

我应该使用什么绘图软件来完成此任务?我一直在研究以下选项:

  • MATLAB。我很难准确地找到我需要的东西,但是我发现了如下特性

  • 格努普洛特。我对Gnuplot的问题是缺少文档

是否有其他程序或更好的方法来编译我的数据,使我手头的任务可行


我的真实数据集有数千行数据,远没有四分之一圆彩虹那么简单。

使用简单的三角函数和函数,用Matlab实现这一点其实很容易:

% R_min  R_max   θ_min   θ_min   Zones
data = [
    0   260 0   1.57    114
    260 270 0   1.57    106
    270 320 0   1.57    107];

% Define a color table, indexed by the "Zones" column
colors = {};
colors{114} = [1.0 0.0 0.5];
colors{106} = [0.7 0.0 1.0];
colors{107} = [1.0 1.0 0.0];

% Define the resolution of the plot (more points = more round)
nPoints = 100;

clf;
hold on;
for i = 1:size(data, 1)
    % Extract the data from the i'th row. There's no need for this, you
    % could access it directly below, but it makes the code more clean. :)
    r_min = data(i,1);
    r_max = data(i,2);
    theta_min = data(i,3);
    theta_max = data(i,4);
    color = data(i, 5);

    % First, get the sine and cosine between theta_min and theta_max
    sin_theta = sin(linspace(theta_min, theta_max, nPoints));
    cos_theta = cos(linspace(theta_min, theta_max, nPoints));

    % Now, draw a semi-circle with radius = r_min and merge this
    % semi-circle with another with radius = r_max, but reversed, so that
    % it begins where the previous semi-circle ended.
    x = [sin_theta * r_min sin_theta(end:-1:1) * r_max];
    y = [cos_theta * r_min cos_theta(end:-1:1) * r_max];

    % Draw the polygon.
    fill(x,y, colors{color}, 'EdgeColor', colors{color});
end
hold off;
axis equal;
grid;
maxRadius = max(data(:,2));
axis([-maxRadius maxRadius -maxRadius maxRadius]);
结果:


这里有一个可能的gnuplot解决方案。使用
打印样式在原点以指定半径绘制重叠楔体的。这要求您按最大半径降序对数据进行排序,并且没有间隙

下面是一个可能的脚本:

set xrange [0:350]
set yrange [0:350]

set size ratio -1
set style fill solid noborder
set palette defined (106 'blue', 107 'yellow', 114 'magenta')
set cbrange [106:114]
unset colorbox
plot 'test.txt' using (0):(0):2:($3*180/pi):($4*180/pi):5 with circles linecolor palette notitle
结果如下(见第4.6.4节):

还有一些评论:

  • 圆的半径以x轴为单位给出,但y轴没有相应调整。这就是为什么必须同时设置
    xrange
    yrange
    ,甚至使用
    设置大小比率-1
    设置两个轴的比率

  • 使用调色板进行着色是一个选项,其他选项如使用
    linecolor variable
    linecolor rgb variable
    ,如中所述

  • 在Unix系统上,排序也可以通过

    plot '< sort -r test.txt' ...
    
    plot'

还有来自MATLAB的链接:@kebs或@Rafael Monteiro,为什么在上述代码中对y使用rcos(θ),对x使用rsin(θ)?这是MATLAB绘制函数的方式,还是其他原因?