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

2 次查看(过去 30 天)
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 个评论
ARP
ARP 2018-5-1
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)

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by