help-octave
[Top][All Lists]
Advanced

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

Re: Subplot draws ylabels out of range


From: Ben Abbott
Subject: Re: Subplot draws ylabels out of range
Date: Thu, 13 Jun 2013 00:32:51 +0000 (GMT)

On Jun 12, 2013, at 02:31 PM, Tobal <address@hidden> wrote:

Hi, I'm drawing plots with subplots but ylabels are drawn in the incorrect
place. It always plots ylabels inside the other subplot. The code

function [] = pfijo(g,f,a,b,a1,b1,x1,tol,maxiter)
filename = 'puntofijo.txt';
fid = fopen(filename,'w');
fprintf(fid,'k\t\tx (k)\t\t\t\t\t\t\tError\n');

t = a:0.01:b;
t1 = a1:0.01:b1;
fx = inline(f);
gx = inline(g);
func = fx(t);
func1 = fx(t1);
iter = 1;
x = x1;
incr = tol+1;
errores = incr;
imagenes = [ ];
while incr > tol && iter <= maxiter
x(iter+1) = feval(gx,x(iter));
incr = abs(x(iter+1)-x(iter));
errores =[errores,incr];
iter++;
end

iter2 = 1:1:iter;
fc1 = feval(fx,x);
imagenes = [imagenes,fc1];
if incr > tol
sol = [ ];
disp('Insuficientes iteraciones');
else
sol = x(end);
for k=1:iter
fprintf(fid,'%.0f\t\t%.15f\t\t%.15f\n',iter2(k),x(k),errores(k));
end
fprintf (fid,'\nLa soluciĆ³n es %.15f.\nSe ha alcanzado en %d
iteraciones.\nCon un error de %e',sol,iter,errores(end));
fclose(fid);
printf ('La solucion es %.15f, y se ha alcanzado en %d iteraciones.\n',
sol, iter);
end
clf();
subplot(1,3,1);
plot(t1,func1)
set (gca, 'xaxislocation', 'zero');
set (gca, 'yaxislocation', 'zero');
set(gca, 'box', 'off');
grid;
title('La Funcion');
legend({f},'location', 'southoutside');
legend boxon;
xlabel('y');
ylabel('x');
set (get (gca, 'ylabel'), 'rotation', 360);
subplot(1,3,2);
plot(t,func,x,imagenes,'*r')
set (gca, 'xaxislocation', 'zero');
set (gca, 'yaxislocation', 'left');
set(gca, 'box', 'off');
grid;
title('Metodo Punto Fijo');
legend({f,'Aproximaciones'},'location','southoutside');
legend boxon;
xlabel('y');
ylabel('x');
%drawLabels (-5, 0, 'label');
set (get (gca, 'ylabel'), 'rotation', 360);
subplot(1,3,3);
plot(iter2,errores)
set (gca, 'xaxislocation', 'bottom');
set (gca, 'yaxislocation', 'left');
set(gca, 'box', 'on');
grid;
title('Tendencia de errores en Regula Falsi');
legend('Errores','location','southoutside');
legend boxon;
xlabel('Numero Iteraciones');
ylabel('Errores');
set (get (gca, 'ylabel'), 'rotation', 360);
end

Executing this

pfijo('cos(x)','x-cos(x)',0,1,-pi,pi,1,0.001,100)

I see this image:

octave.png <http://octave.1599824.n4.nabble.com/file/n4654111/octave.png>
 
That is because Gnuplot controls the placement of the axes labels, and Octave controls the placement of the axes box.  We haven't found a reliable way for Gnuplot to take control of the axes labels.

The simplest work around is the use the fltk graphics_toolkit.

Ben


reply via email to

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