ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 21 Sep 2016 06:29:56 -0500How to include PDF image from Sage into LaTeX document (scale issue)?http://ask.sagemath.org/question/34877/how-to-include-pdf-image-from-sage-into-latex-document-scale-issue/Hello!
I have a PDF illustration prepared in Sage:
p = plot(sin, 0, pi, fontsize=12, axes_labels=('ABCDE', ur'$ABCDE$'))
p.save('/tmp/sage1.pdf')
And the following LaTeX document:
\documentclass[12pt]{article}
\usepackage{graphicx}
\graphicspath{{/}}
\begin{document}
ABCDE $ABCDE$ \\
\includegraphics{sage1.pdf}
\end{document}
The problem is that the font size is inconsistent - is is clearly bigger in the picture than in document. I know about width parameter for includegraphics and other scaling option, but how to select the scale? Or, more generally, how to include PDF graphics to get exactly the same font size?
![font size issue](/upfiles/14744573018217295.png)EugeneWed, 21 Sep 2016 06:29:56 -0500http://ask.sagemath.org/question/34877/previous fontsize settings in plot now produce huge fontshttp://ask.sagemath.org/question/29464/previous-fontsize-settings-in-plot-now-produce-huge-fonts/I have been using p.fontsize(20) a lot, but since the upgrade to 6.8, the same setting now produces HUGE font sizes, making the axes labels exceed the figure sizes. I wonder what happened there and how this could be fixed.
I believe that some of the reason is the introduction of the new option axes_labels_size as mentioned here:
http://ask.sagemath.org/question/26807/how-do-i-adjust-the-size-of-axes-labels-and-figure-titles-in-plots/
Try this in a sage version before 6.7 and after 6.7:
P = plot(x^2, 0,2)
P.axes_labels(['Some value of x', 'Resulting value of y'])
P.fontsize(20)
P
Is there a way to put a one-liner at the start of my worksheets to get back the old behaviour without having to modify all P.fontsize(20) lines?
stanWed, 16 Sep 2015 07:57:35 -0500http://ask.sagemath.org/question/29464/Sage unable to find font on my machine.http://ask.sagemath.org/question/11351/sage-unable-to-find-font-on-my-machine/I was trying to change the font on a plot to Computer Modern Roman. Is there a way I can install the fonts in sage itself so that sage does not have to look all over the disk for the right font. Here is the code for the plot
from matplotlib import rc, rcParams
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
#plt.rc('text', usetex=True)
plt.rc('font',**{'family':'serif','serif':['Computer Modern Roman'],'size':12})
fig = plt.figure(figsize=(4.0,2.8))
ax = fig.add_subplot(111)
plt.ylim(0,20)
plt.xlim(0,20)
a=[0,10,20]
b=[0,10,20]
p1=plt.plot(a, b,'r--')
plt.savefig('test.png')
I get the message
"/Users/shashank/sage/local/lib/python2.7/site-packages/matplotlib/font_manager.py:1224: UserWarning: findfont: Font family ['serif'] not found. Falling back to Bitstream Vera Sans
(prop.get_family(), self.defaultFamily[fontext]))".
Has anyone else encountered this issue and how does one fix it. I am using a Mac if that helps.
Also uncommenting usetex=true leads to the following error, I have installed the latest version of freetype from port on mac.
dyld: Library not loaded: /opt/local/lib/libfreetype.6.dylib
Referenced from: /opt/local/lib/libpoppler.44.dylib
Reason: Incompatible library version: libpoppler.44.dylib requires version 18.0.0 or later, but libfreetype.6.dylib provides version 10.0.0
sh: line 1: 2899 Trace/BPT trap: 5 latex -interaction=nonstopmode 342a49751566a29dab1cfcec0a04bf79.tex > "/Users/shashank/.sage//matplotlib-1.2.1/tex.cache/342a49751566a29dab1cfcec0a04bf79.output"ShashankThu, 10 Apr 2014 11:16:09 -0500http://ask.sagemath.org/question/11351/line3d fonsize option?http://ask.sagemath.org/question/8607/line3d-fonsize-option/Hi!
I need to hide exact values in 3d plot. In case of 2d I can use fontsize option like:
line([(0,0),(1,1)]).show(fontsize=0)
But show + line3d ignores fontsize option.EugeneWed, 04 Jan 2012 09:15:09 -0600http://ask.sagemath.org/question/8607/