Filter löschen
Filter löschen

How to link axes on colormap?

17 Ansichten (letzte 30 Tage)
Emilia Butters
Emilia Butters am 25 Jun. 2023
Beantwortet: Parth Saraf am 25 Jun. 2023
Hi,
I am trying to link the axes so that the two subplots share the same colourbar, I have tried using linkaxes(hAxis, 'x'), linkaxes(hAxis.CurrentAxis, 'x'). Can anyone help me please? The code is below:
hFig = gcf;
set(gcf,'Color','w','Units','Normalized');
for i = 1:nSubplot
subplot(1,nSubplot,i);
if isempty(xmin)
[hAxis, hPatch, hColorbar] = DOTHUB_plotSurfaceImage(rmap.gmSurfaceMesh,img(i,:),viewAng,shadingtype,varInputs.colormap);
else
[hAxis, hPatch, hColorbar] = DOTHUB_plotSurfaceImage(rmap.gmSurfaceMesh,img(i,:),viewAng,shadingtype,varInputs.colormap, xmin, xmax);
end
set(hAxis,'FontSize',16);
hColorbar.Location = 'South';
tmp = hColorbar.Position;
hColorbar.Position = [tmp(1) tmp(2) tmp(3) tmp(4)];
hColorbar.AxisLocation = 'out';
ylabel(hColorbar,subplotLabels{1,i})
end
% [~,fname,~] = fileparts(dotimg.fileName);
fname = filename;
linkaxes(axes,'x');

Antworten (1)

Parth Saraf
Parth Saraf am 25 Jun. 2023
Hello Emilia,
I understood from your question that you are unable to link the axes. You may use the gca for current axes or chart
hAxis = gca;
linkaxes(gca, "xy", "color");
You may look at this documentation for further details:
Hope it helps!!

Kategorien

Mehr zu Graphics Objects 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