Ask Your Question

How do I adjust the size of axes labels and figure titles in plots?

asked 2015-05-12 07:59:35 -0500

Fusion809 gravatar image

I've been experimenting around with the following code:

from sage.calculus.desolvers import desolve_odeint
y,dy = var('y,dy');
g    = 9.8; 
l    = 1; 
f    = [dy,-g/l*cos(y)];
v    = [y,dy];
t    = srange(0,5,0.01);
ci   = [0,0];
sol  = desolve_odeint(f,ci,t,v,rtol=1e-15, atol=1e-10,h0=1e-4,hmax=1e-2,hmin=1e-6,mxstep=10000)
p    = line(zip(t,sol[:,0]),title=r"$\frac{d^{2}\theta}{dt^2} = -\frac{g}{l} \cos{\theta}$",axes_labels=[r"$t$",r"$\theta$"]);
p2   = line(zip(t,sol[:,1]));
p2  += text(r"$\frac{d\theta}{dt}$",(-0.5,0),fontsize=27);
p2  += text(r"$t(s)$",(5,0.5),fontsize=20);

which gives this plot:image description

As you can see the axes labels and title of the figure are insanely small (or at least in my opinion). I'd like the axes labels to be 20 pt and the figure title to be 30 pt. How do I do this?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2015-05-14 03:27:11 -0500

eric_g gravatar image


The issue of "insanely small" axes labels has been solved in ticket #18004 and integrated in Sage 6.7.beta2. So, if you do not want to wait for the next main Sage release (6.7, in a few weeks probably), you may consider upgrading to the latest Sage 6.7.beta (beta5 at the time of this writing).


edit flag offensive delete link more



Nice! See for the title size.

kcrisman gravatar imagekcrisman ( 2015-05-14 10:00:36 -0500 )edit

Sage 6.7 is out, so you may use it to fix the size of the axes labels. Within Sage 6.7, there is indeed a new option for 2D graphics: axes_labels_size, which sets the relative size of axes labels with respect to tick marks labels. The default value is 1.6, which results in larger axes labels.

eric_g gravatar imageeric_g ( 2015-05-22 09:28:54 -0500 )edit

answered 2015-05-12 09:03:17 -0500

kcrisman gravatar image

You can do


to change the font size for the labels and ticks.

Unfortunately we don't seem to have the title font size set capability exposed from matplotlib, though surely this is possible too.

edit flag offensive delete link more


What about figure titles?

Fusion809 gravatar imageFusion809 ( 2015-05-12 11:07:31 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-05-12 07:59:35 -0500

Seen: 69,620 times

Last updated: May 14 '15