Azzera filtri
Azzera filtri

Issue with inconsistent colorbar label position (2014b)

2 visualizzazioni (ultimi 30 giorni)
Hi all,
I've been setting up a 4-subplot graph with colorbars on their outsides. For readability/symmetry I've been messing around with the label position so that it's actually defined as equal (relative to the colorbar) in all 4 in the code. However, for some reason in my bottom left subplot (3) the x position of the colorbar label is significantly more left (negative) than in the top left subplot (1). As far as I know I'm setting the values of the label position equal between subplot 3 and subplot 1. (It works for subplots 2 and 4 (not included in the code below for brevity), in which I set the c.Label.Position to [-c_titlepos(1) c_titlepos(2) c_titlepos(3)] and in both subplots the label is at the expected (and identical) position relative to the colorbar (though flipped, of course))
I'm a bit at a loss; maybe there's some way that c.Label.Position treats inputs that I'm missing. Would appreciate any help!
(Note: the resulting figure looks v jank with the colorbars bleeding over the figures, but the problem I'm looking at should be illustrated - with the second colorbar label almost off the screen to the left)
figure1 = figure;
ColorLabel = 'units go here';
%First subplot
subplot1 = subplot('position',[0.06,0.55,0.44,0.4],'Visible','off','Parent',figure1);
sub1data = rand(100); %some data
c.Position = [0.06 0.568 0.0165 0.365];
c.Label.Units = 'normalized'; %setting units so they're general b/w subplots
c_titlepos = c.Label.Position; %saving the (relative) position of the label
%2nd/4th subplot taken out for clarity's sake
%Third subplot
subplot3 = subplot('position',[0.06,0.10,0.44,0.4],'Visible','off','Parent',figure1);
sub2data = rand(100);
c.Position = [0.06 0.118 0.0165 0.365]; %x position/x size same as colorbar above)
c.Label.Units = 'normalized'; %make sure units are same
c.Label.Position = [c_titlepos(1) c_titlepos(2) c_titlepos(3)]; %just replicating the position from subplot1

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by