colorbarの変更に関して
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
宗樹 岡本
am 21 Jan. 2022
Kommentiert: 宗樹 岡本
am 22 Jan. 2022
NDVIでよく見かけるこのような図を作りたいのですが、colorbarの設定にこのような配色はないのですが、どうすればいいですか。
0 Kommentare
Akzeptierte Antwort
Shunichi Kusano
am 21 Jan. 2022
きっかり同じというわけではありませんがjetの上半分が黄緑→黄色→赤の変化ですので、おおむね一致しそうです。下のようにjetのカラーマップの情報から半分抜き出してあげれば実現可能です。
im = peaks; % 適当にダミーデータを読み込む
imagesc(im);colormap(jet);colorbar; % jetで表示
jetCmap = jet;
newCmap = jetCmap(129:end,:);
figure;imagesc(im);colormap(newCmap);colorbar;
こちらはカラーマップのドキュメントです。ご参考までに。
Weitere Antworten (1)
Kojiro Saito
am 21 Jan. 2022
ただ、RGBを設定して独自のカラーマップを作ることができます。例えば赤色→黄色→緑色を256刻みで表すようなカラーマップを作るにはこんな感じです。
redColor = (255:-1:0)' / 255;
blueColor = zeros(1, 256)' / 255;
greenColor = (0:255)' / 255;
colormap([redColor greenColor blueColor])
Siehe auch
Kategorien
Mehr zu Blue finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!