Clear Filters
Clear Filters

How to preserve colors in histogram2

1 view (last 30 days)
Kostas
Kostas on 21 Nov 2018
Edited: Image Analyst on 21 Nov 2018
Hello all,
i try to plot 5 datasets using histogram2 and hold on. I realize that the colors are not preserved (colors not showing correctly the number of points, see below for a better explanation). It looks like an overlapping issue.
Below is the piece of cde used in a loop to plot all 5 datasets.
for i2=1:5
lonf = data(:,i2);
latf = data1(:,i2);
subplot(ax2), histogram2(lonf,latf,'BinWidth',[10 5],'FaceColor',nco(i2,:),...
'EdgeColor',nco(i2,:));hold(ax2,'on')
end
where: nco=new color order from matlab and
latf and lonf are read each time in the loop
In the attached figure, you see the edges which delimitate different datasets. For example, there is a blue edge in the green bar. The color below the blue edge should have been blue, etc but it's green. I would appreciate any help for solving this issue.
image003.jpg
Thank you in advance
Kostas

Answers (0)

Community Treasure Hunt

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

Start Hunting!