How can I change the color gradient when using interpolated shading in MATLAB 7.0.4 (R14SP2)?
4 ビュー (過去 30 日間)
古いコメントを表示
The following code creates a sphere and colors it using interpolated shading:
sphere(30)
axis equal
shading interp
I want to change the rate of shading within the sphere. For example,to make most of the sphere grey while coloring the rest of the sphere using interpolated shading.
採用された回答
MathWorks Support Team
2009 年 6 月 27 日
The ability to change the interpolation method for the shading rate or color gradient is not available in MATLAB 7.0.4.
To work around this issue, manually adjust the extent to which a figure is shaded with a certain color by changing the colormap of the figure. For example, the following code will first color a sphere using the default colormap. It will then modify the figures's colormap to achieve a different color gradient.
sphere(30)
axis equal
colormap bone
a=colormap;
a(1:30,1:3)=.5;
colormap(a)
This displays a sphere with most of the sphere shaded from grey to white instead of from black to white. By appropriately changing the values of the colormap matrix (each element takes values between 0 and 1), it is possible to implement a desired shading scheme. You can also influence color gradients by specifying lighting characteristics, such as light position and the ratio of ambient and diffuse components.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!