matlab - 将向量(或弧)绘制到玫瑰图上。 MATLAB

标签 matlab plot rose-plot

我有两个数据集。其中详细列出了 angles 的列表(我正在绘制玫瑰图):

angles
-0.8481065519
0.0367932161
2.6273740453
...
n

另一个,从这组角度详细说明方向统计:

angle,error
-0.848106563,0.8452778824

哪里angle本质上定义了方向平均值,并且 error圆形方差,本质上是 angle 两侧的误差条

到目前为止,我已经使用一组角度绘制了玫瑰直方图,如下所示:

h = rose(angles,36)

我想创建方向统计图 angle (它不需要长度/大小 - 只需到圆形图的边缘)与 error周围。 举个例子:

An example of what I want to do.

我在 Matlab 中手动添加了这些行。如果可能的话,最好在弧线内也有阴影。或者,(可能是首选)是在玫瑰图箱上方有一 strip 中心线的条子(因此它不会覆盖数据)(显示 angleerror 的阴影周围。

提前致谢。

最佳答案

这个怎么样?

%// Data
angles = 2*pi*.8*randn(1,1e4);
angle = -0.848106563;
error = 0.8452778824;

%// Plot rose
rose(angles, 36);
axis image %// make axis square
hold on

%// Plot mean
a = axis;
a = a(2); %// size of axis
plot([0 cos(angle)*a], [0 sin(angle)*a], 'r')

%// Plot error as many shaded triangles that compose a circular wedge
t = linspace(-error/2+angle,error/2+angle,100); %// increase "100" if needed
for k = 1:numel(t)-1
    h = patch([0 cos(t(k))*a cos(t(k+1))*a 0], ...
        [0 sin(t(k))*a sin(t(k+1))*a 0], [.5 0 0], 'edgecolor', 'none');
        %// change color [.5 0 0] to something else if desired. Note also alpha
    set(h,'Facealpha',.3) %// make transparent
end     

%// Place rose on top by rearranging order of axis children
ch = get(gca,'children');
set(gca,'children',[ch(2:end); ch(1)]);

enter image description here

为此,您需要使用具有透明度的图形渲染器。因此您可能需要调整图窗的 renderer 属性。

关于matlab - 将向量(或弧)绘制到玫瑰图上。 MATLAB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23660867/

相关文章:

matlab - 如何在 MATLAB 编辑器中重新格式化代码?

r - 后验地更改 ggplot geom 的颜色(在指定了另一种颜色之后)

r - ggplot,在条形组之间添加网格线

r - ggplot 风玫瑰图

r - 如何使用 R 中的包 'circular' 在玫瑰图中移动容器

matlab - 在 MATLAB 中使用 ROI

matlab - 在 Matlab 中读写二进制文件

algorithm - 减少关闭点

r - 使用R在GGPLOT2散点图上绘制两个数据向量

python - 使用 Windrose 模块绘制不同的子图