How can I print the heatmap as grayscale?

19 次查看(过去 30 天)
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 个评论

请先登录,再进行评论。

更多回答(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