change colormap of histogram2

51 Ansichten (letzte 30 Tage)
arnold
arnold am 13 Mai 2019
Bearbeitet: arnold am 13 Mai 2019
Hi,
I was looking for a way to change the colormap for histogram2 from parula to something else. Couldn't find it.
x = randn(5000);
y = randn(5000);
h = histogram2(test1, test2, 'DisplayStyle','tile');
again: I couldn't find any handle or option to change the colormap.I'd appreciate a hint.
kind regards
Arnold

Akzeptierte Antwort

Steven Lord
Steven Lord am 13 Mai 2019
Use the colormap function. First let's make the histogram2 plot.
x = randn(5000);
y = randn(5000);
h = histogram2(x, y, 'DisplayStyle','tile');
Next, I'll enable the colorbar (so we can see the color scale.)
colorbar
Finally I'll change the colormap. I'll use jet but you can use one of the ones on the colormap documentation page or one of your own design.
colormap(jet)
  1 Kommentar
arnold
arnold am 13 Mai 2019
ok, I should have guessed that. thanks

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Colormaps 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!

Translated by