Kernel dies with matplotlib usetex and PDF

asked 2015-12-16 07:13:26 +0100

sswatson gravatar image

I'm looking to save my Sage figures with matplotlib's usetex option, so that I can match the fonts to my document's fonts. The following code works to do this if I switch the filename extension in the last line to png, but for some reason when I try to save a pdf instead, the kernel dies. I would be grateful for any suggestions.

from matplotlib import rc

rc('text',usetex=True)

rc('font',serif='Palatino')

p = plot(sin(x),x,0,2*pi,axes_labels=['$x$','$\sin x$'])

save(p,filename="tmp.pdf")

edit retag flag offensive close merge delete

Comments

It works for me (Sage 6.10.rc1 complied on Debian jessie 64bit, run from the command line). Could you please give us some informations so that someone can try to reproduce your problem:

  • which version of Sage did you use ?
  • which OS ?
  • did you install Sage from the binaries, and which ones ?
  • did you compile Sage ?
  • which notebook did you use (Sage notebook or jupyter notebook) ?
  • did you use the command line ?
  • which error message did you get ?
  • ... ?
tmonteil gravatar imagetmonteil ( 2015-12-16 11:54:58 +0100 )edit

Thanks for the reply! It's good to know this problem is not universal. I'm using Sage 6.8, installed on OS X (10.10.5) using binaries (not sure which ones -- I went to the downloads page and did what seemed natural; not sure if that helps). I was using Jupyter notebook, but I just checked that the error also occurs in the Sage notebook. I get no error message in Jupyter (kernel just dies), but in the Sage notebook I get a generic 'Unhandled SIGABRT' message.

sswatson gravatar imagesswatson ( 2015-12-16 22:30:25 +0100 )edit

I've tried with the same version of Sage as yours (6.8) in a Jupyter notebook under Ubuntu 14.04: it works fine. So maybe there is a problem with your Sage install. Could you install a more recent version (i.e. Sage 6.9) and try again ?

eric_g gravatar imageeric_g ( 2015-12-16 23:26:28 +0100 )edit

OK, I upgraded to version 6.9 and everything works fine. Thanks!

sswatson gravatar imagesswatson ( 2015-12-18 03:09:09 +0100 )edit