Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Exact same code producing different color scheme MATLAB plot

1 回表示 (過去 30 日間)
Palash Agrawal
Palash Agrawal 2019 年 6 月 25 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hello
When a colleague below runs the code attached, they claim to get a figure 4 with a color scheme that look likes attached image 1. When I run the exact same conde on MATLAB online, I get firgure 4 that looks like attached image 2. I cannot figure why this is and need my code's figure 4 output too look like that in image 1.
  2 件のコメント
Geoff Hayes
Geoff Hayes 2019 年 6 月 26 日
Palash - which version of MATLAB is your colleague using? What is the version of MATLAB online?
Palash Agrawal
Palash Agrawal 2019 年 6 月 26 日
Geoff I am using Matlab 2018b and he is using Matlab 2016 I believe.

回答 (1 件)

Image Analyst
Image Analyst 2019 年 6 月 26 日
You're using imagesc(), which I hate and never use because it applies default colormaps that you never asked for. The one image you had uses the "jet" colormap, which was the default before release 2014b, and the other image uses parula which is the current default colormap. I suggest you use imshow() and/or colormap() and apply whatever colormap YOU want instead of using the default.
See Steve's blog for the reasoning behind the change: Steve on Image Processing
  3 件のコメント
Walter Roberson
Walter Roberson 2019 年 6 月 26 日
imagesc() and image() both apply the current or default colormap, and it is imshow() that imposes colormaps that you never asked for (such as imposing grayscale in some situations.)
Image Analyst
Image Analyst 2019 年 6 月 26 日
I don't think it changed, but you can print it out and check it
jet(256) % No semicolon so it will print to command window.
or however many colors you think there are.

Community Treasure Hunt

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

Start Hunting!

Translated by