matlab 用patch画彩色的线

您所在的位置:网站首页 matlab灰色线条 matlab 用patch画彩色的线

matlab 用patch画彩色的线

2024-04-01 08:44| 来源: 网络整理| 查看: 265

Create a multicolored line with markers at each vertex. Interpolate the colors and use a colorbar to show how the values map to the colormap.

Create the data. Set the last entry of y to NaN so that patch creates a line instead of a closed polygon. Define a color for each vertex using the y values. The values in c map to colors in the colormap.

x = linspace(1,10,15); y = sin(x); y(end) = NaN; c = y;

Create the line. Show markers at each vertex and set the EdgeColor to 'interp' to interpolate the colors between vertices. Add a colorbar.

figure patch(x,y,c,'EdgeColor','interp','Marker','o','MarkerFaceColor','flat'); colorbar;

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3