【问题标题】:Fill color inside a shape on 3d plot matlab在 3d plot matlab 上填充形状内的颜色
【发布时间】:2017-01-17 07:11:26
【问题描述】:

我在 matlab 中创建了一个形状,看起来像这样 .

npts = 14;
z = linspace(-1,1,npts);
omz = sqrt(1-z.^2);

xyz=[2 3 1 0.5 2 5 10 15 20 29 32 34  10 2;1 3 8 12 20 25 27 25 23 26  26 23   5 1;z];
plot3(xyz(1,:),xyz(2,:),xyz(3,:),'ro','LineWidth',2);

box on
hold on
fnplt(cscvn(xyz(:,[1:end 1])),'r',2)
hold off

我需要在这个形状中填充不同的颜色。我该怎么做?

【问题讨论】:

  • “不同的颜色”。有何不同?纯单色还是您想要更高级的东西?另外,你需要填充曲线函数,还是只填充点?换句话说,你需要填充二次曲率还是可以用直线连接它?
  • @AnderBiguri 我想用灰色阴影来支撑曲线。色调由用户决定。

标签: matlab plot matlab-figure


【解决方案1】:
  1. 获取fnplt的输出。
  2. 将颜色图更改为gray
  3. 使用fill3 为补丁着色。

大家一起:

c = fnplt(cscvn(xyz(:,[1:end 1])),'r',2);
colormap gray
fill3(c(1,:),c(2,:),c(3,:),1:size(c,2))

结果:

【讨论】:

  • @swapnil gandhi,这能回答你的问题吗?
  • 部分是因为用户决定在形状的哪个部分涂上哪种颜色?
  • @swapnilgandhi,我需要一个例子来说明用户的输入和形状上的请求输出。
猜你喜欢
  • 2014-05-26
  • 2014-10-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-01
  • 1970-01-01
  • 2016-01-13
  • 1970-01-01
相关资源
最近更新 更多