![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/180391/image.png)
contourf関数を用いた特定の値を特定の色で塗りつぶす方法について
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Shotaro Suzuki
el 24 de Dic. de 2017
Comentada: Shotaro Suzuki
el 26 de Dic. de 2017
ある特定のZdataの時,指定した色で塗りつぶすことはできますでしょうか。
等高線のレベルは400程度で検討しています。
具体的には下記の図においてZdata=0の時,赤色に塗りつぶす方法です。
何かご存知の方がいましたらご教授願います。
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/168071/image.png)
0 comentarios
Respuesta aceptada
Akira Agata
el 25 de Dic. de 2017
もし Zdata = 0 の等高線を重ね書きしたいということであれば、下記のようにして作成することができます。
あるいはご質問の内容は、Zdata <= 0 の領域を塗りつぶしたいということでしょうか??
Zdata = peaks(100);
figure
contourf(Zdata,400,'LineColor','none')
hold on
contour(Zdata,[0 0],'LineColor','r','LineWidth',2)
colorbar
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/180391/image.png)
3 comentarios
Akira Agata
el 26 de Dic. de 2017
Zdataの形状がシンプルであれば、Zdata = -1,1 それぞれについて contour 関数で等高線行列を作成して、その情報をもとに patch で塗りつぶす領域を作成するという方法があります。
もう少し簡単な別の方法としては、 surf 関数で赤色の3次元表面プロットを作成したあと、zlim([-1 1]) として [-1 1] 以外の部分をカットして視点などを調整することで、同様の結果を得ることができます。
Zdata = peaks(100);
figure
surf(Zdata,'EdgeColor','none','FaceColor','r')
zlim([-1 1])
xlim([1 100])
ylim([1 100])
view(2)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/187458/image.png)
Más respuestas (0)
Ver también
Categorías
Más información sobre 3 次元関数プロット en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!