How to maintain the colormap of two different figures when using GUI

1 view (last 30 days)
Hi there,
I have the problem that my GUI is not able to maintain the original colormap that I ask. I have two different figures, one in gray and another in jet. Plotting in sequence trough independent push-buttons, first the gray displays correctly. When I plot the jet, displays correctly as jet, but also the one that was all fine as gray, turns into jet.
At the beginning I was programming so that both images display using the same push button. Hopping that using independent buttons, did not improve.
It should be a simple fix. Any help please?
Thanks
%The code for OpeningFcn
axes(handles.Axis_1)
ylabel('Distance (mm)')
xlabel('Distance (mm)')
axes(handles.Axis_2)
ylabel('Distance (mm)')
xlabel('Distance (mm)')
% Code for figures
axes(handles.Axis_1)
grayscale1 = mat2gray(log_scale, [-45 -5]);
imagesc(x_axis,axial_distance_water,grayscale1);
colormap(gray);
colorbar;
axis image
xlabel('Lateral length (mm)')
ylabel('Depth (mm)')
axes(handles.Axis_2)
imagesc(x_axis,distance_subset,(slope4(20:end,:)));
colormap(jet);
colorbar;
axis image
xlabel('Lateral length (mm)')
ylabel('Depth (mm)')
  1 Comment
ARP
ARP on 1 May 2018
Case solved,
Just needed to add more info on colormap, referring to the figure handle and cmap
cmap1=(gray);
colormap(handles.Axis_1,cmap1)
cmap2=(jet);
colormap(handles.Axis_2,cmap2)

Sign in to comment.

Answers (0)

Categories

Find more on Colormaps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!