How can I print the heatmap as grayscale?

조회 수: 24 (최근 30일)
도현 김
도현 김 2021년 4월 12일
답변: Richard Quist 2021년 12월 6일
A = rand(5)
heatmap(A, option)
I want to see heatmap in grayscale.
OR
Can I use 'saveas' to save in grayscale?

채택된 답변

J Chen
J Chen 2021년 4월 12일
heatmap(A)
colormap(gray)
  댓글 수: 4
Sean de Wolski
Sean de Wolski 2021년 4월 12일
colormap(flip(gray))
도현 김
도현 김 2021년 4월 15일
Thank you sir !!!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Richard Quist
Richard Quist 2021년 12월 6일
As of R2021a the exportgraphics function supports a Colorspace option for both image and vector formats that you can use to generate grayscale output:
exportgraphics(gca, 'output.jpg', 'colorspace', 'gray');
exportgraphics(gca, 'output.pdf', 'colorspace', 'gray');

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by