Mathematica中文论坛-非官方

标题: 豆粑粑,matlab 同一条线,不同的color [打印本页]

作者: meatball1982    时间: 2016-7-15 11:44
标题: 豆粑粑,matlab 同一条线,不同的color

虽然是画线,但其实是通过surface 来实现的。
在3D空间中画一个很细的面。
例子是y=sin(x)
效果还是相当华丽的。

  1. x = 0:.05:2*pi;
  2. y = sin(x);
  3. z = zeros(size(x));
  4. col =y+rand(size(y))*0.02;  % This is the color, vary with x in this case.
  5. surface([x;x],[y;y],[z;z],[col;col],...
  6.         'facecol','no',...
  7.         'edgecol','interp',...
  8.         'linew',4);      
  9. colormap(cool)   
复制代码



diff_color_line_surf.jpg (56.46 KB, 下载次数: 955)

diff_color_line_surf.jpg





欢迎光临 Mathematica中文论坛-非官方 (http://ilovemathematica.com/) Powered by Discuz! X3.2