How to link axes on colormap?
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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');
0 comentarios
Respuestas (1)
Parth Saraf
el 25 de Jun. de 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!!
0 comentarios
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!