Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
ARP
ARP am 1 Mai 2018
Kommentiert: ARP am 1 Mai 2018
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 Kommentar
ARP
ARP am 1 Mai 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)

Melden Sie sich an, um zu kommentieren.

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