help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

very narrow imagesc subplots


From: Drew Davidson
Subject: very narrow imagesc subplots
Date: Fri, 20 Jun 2014 13:24:00 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

In the following simple example code, the (sub)plots are coming out much too narrow in width (x-direction) by default; they are unreadable. The default amount of whitespace is truly excessive. When I attempt to widen the 3rd subplot by a factor beta, I get unexpected results. I am expecting the 3rd subplot to remain in position and to simply widen in the x-direction, but instead the subplot seems to move around and stay narrow. This suggests the origin of the subplot is far away, but why would the subplot stay narrow? If someone would please run this brief example code, play with the value of beta, and explain what is happening, I would be grateful. What is a simple way to make these subplots wider?

This code is based on the first web link in the initial comments. I did try "tightfig.m" and "tight_subplot.m" from the Matlab File Exchange on some different code than below (but still imagesc in subplots), and experienced similar frustration.

Using octave 3.8.1 in Ubuntu 14.04.




%http://stackoverflow.com/questions/16064451/reposition-colorbar-or-subplots
%https://www.gnu.org/software/octave/doc/interpreter/Axes-Properties.html
%http://blogs.mathworks.com/pick/2012/12/21/figure-margins-subplot-spacings-and-more/

clear;
close all;

figure(10)
ax(1) = subplot(1,3,1);imagesc(rand(100,1),[0 1]);
ax(2) = subplot(1,3,2);imagesc(rand(100,1),[0 1]);
ax(3) = subplot(1,3,3);imagesc(rand(100,1),[0 1]);

figure(20)
ax2(1) = subplot(1,3,1);imagesc(rand(100,1),[0 1]);
ax2(2) = subplot(1,3,2);imagesc(rand(100,1),[0 1]);
ax2(3) = subplot(1,3,3);imagesc(rand(100,1),[0 1]);

% Get positions of all the subplot
posa = get(ax,'position');
posa2 = get(ax2,'position');
%h    = colorbar;

%attempt to make the 3rd subplot wider in figure 20.  why does this fail???
m=3;
beta=3.0;
posa2{3}(m)=posa2{3}(m)*beta;

set(ax2(3),'position',posa2{3})



reply via email to

[Prev in Thread] Current Thread [Next in Thread]