ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 18 Dec 2015 03:09:09 +0100Kernel dies with matplotlib usetex and PDFhttps://ask.sagemath.org/question/31601/kernel-dies-with-matplotlib-usetex-and-pdf/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")`
Wed, 16 Dec 2015 07:13:26 +0100https://ask.sagemath.org/question/31601/kernel-dies-with-matplotlib-usetex-and-pdf/Comment by tmonteil for <p>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. </p>
<p><code>from matplotlib import rc</code></p>
<p><code>rc('text',usetex=True)</code></p>
<p><code>rc('font',serif='Palatino')</code></p>
<p><code>p = plot(sin(x),x,0,2*pi,axes_labels=['$x$','$\sin x$'])</code></p>
<p><code>save(p,filename="tmp.pdf")</code></p>
https://ask.sagemath.org/question/31601/kernel-dies-with-matplotlib-usetex-and-pdf/?comment=31605#post-id-31605It 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 ?
- ... ?Wed, 16 Dec 2015 11:54:58 +0100https://ask.sagemath.org/question/31601/kernel-dies-with-matplotlib-usetex-and-pdf/?comment=31605#post-id-31605Comment by sswatson for <p>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. </p>
<p><code>from matplotlib import rc</code></p>
<p><code>rc('text',usetex=True)</code></p>
<p><code>rc('font',serif='Palatino')</code></p>
<p><code>p = plot(sin(x),x,0,2*pi,axes_labels=['$x$','$\sin x$'])</code></p>
<p><code>save(p,filename="tmp.pdf")</code></p>
https://ask.sagemath.org/question/31601/kernel-dies-with-matplotlib-usetex-and-pdf/?comment=31612#post-id-31612Thanks 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.Wed, 16 Dec 2015 22:30:25 +0100https://ask.sagemath.org/question/31601/kernel-dies-with-matplotlib-usetex-and-pdf/?comment=31612#post-id-31612Comment by eric_g for <p>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. </p>
<p><code>from matplotlib import rc</code></p>
<p><code>rc('text',usetex=True)</code></p>
<p><code>rc('font',serif='Palatino')</code></p>
<p><code>p = plot(sin(x),x,0,2*pi,axes_labels=['$x$','$\sin x$'])</code></p>
<p><code>save(p,filename="tmp.pdf")</code></p>
https://ask.sagemath.org/question/31601/kernel-dies-with-matplotlib-usetex-and-pdf/?comment=31615#post-id-31615I'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 ?Wed, 16 Dec 2015 23:26:28 +0100https://ask.sagemath.org/question/31601/kernel-dies-with-matplotlib-usetex-and-pdf/?comment=31615#post-id-31615Comment by sswatson for <p>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. </p>
<p><code>from matplotlib import rc</code></p>
<p><code>rc('text',usetex=True)</code></p>
<p><code>rc('font',serif='Palatino')</code></p>
<p><code>p = plot(sin(x),x,0,2*pi,axes_labels=['$x$','$\sin x$'])</code></p>
<p><code>save(p,filename="tmp.pdf")</code></p>
https://ask.sagemath.org/question/31601/kernel-dies-with-matplotlib-usetex-and-pdf/?comment=31668#post-id-31668OK, I upgraded to version 6.9 and everything works fine. Thanks!Fri, 18 Dec 2015 03:09:09 +0100https://ask.sagemath.org/question/31601/kernel-dies-with-matplotlib-usetex-and-pdf/?comment=31668#post-id-31668