【问题标题】:Adding gridlines onto polar contour plot在极坐标图上添加网格线
【发布时间】:2017-05-26 02:39:27
【问题描述】:

我有以下代码可以生成以下图像。

如何添加极坐标网格线?我想添加 100、200、300 和 400。请注意,半径为 400。它可能看起来不是最好的,但我想添加它们。也许如果这是可能的,有人可以建议另一种可能看起来更好的颜色图。

The function polarcont in FileExchange

close all

data1 = xlsread('C:\carbon.xlsx','Sheet4');
data2 = xlsread('C:\carbon.xlsx','Sheet2');
data3 = xlsread('C:\carbon.xlsx','Sheet3');

t = data1(1,:);
r = data2(:,1);
z = data3(:,:);

figure(1)
polarcont(r,t,z)
myColorMap = colormap;
myColorMap(1,:) = [1 1 1];
colormap(myColorMap);
colorbar;
beta = 0.9;
brighten(beta)
axis off

【问题讨论】:

  • 你能说得更具体点吗?有没有办法在matlab中添加网格线?

标签: matlab matlab-figure polar-coordinates contourf


【解决方案1】:

您可以使用polaraxes 将另一个axes 添加到您的图形并在其上放置网格,如下例所示:

[X,Y,Z] = peaks;
[~,h] = contour(X,Y,Z,20);
axis off
axis equal % this is important for the polar axes to fit the catresian axes
           % when resizing the figure
colorbar;
% get the contour position after adding the colorbar:
cont_pos = h.Parent.Position;
% place a transparent polar axes on top of the contour:
polaraxes(gcf,'Position',cont_pos,'Color','none','Rlim',[0 400]);

所以你只需要在代码末尾添加这个:

axis equal
% get the contour position after adding the colorbar:
cont_pos = get(gca,'Position');
% place a transparent polar axes on top of the contour:
polaraxes(gcf,'Position',cont_pos,'Color','none','Rlim',[0 400]);

您可以看到here 可用颜色图的列表,然后选择您喜欢的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-31
    • 1970-01-01
    • 2019-05-15
    • 1970-01-01
    • 2018-09-23
    相关资源
    最近更新 更多