Hello!
I am trying to set font size to 10 and export resulting image in PGF:
# Change font style
from matplotlib import rc
font = {'family':'serif',
'serif':['Computer Modern Unicode'],
'size': 10, }
rc('font', **font)
# Create and save test plot
file_name = '/tmp/foo.pgf'
p = plot(sin, 0, 2 * pi, axes_labels=('$x$', '$y$'), fontsize=10)
p.save(file_name, fontsize=10)
# Check font size
with open(file_name, 'r') as f:
for line in f:
if 'fontsize' in line:
print line,
And that gives me lines:
\pgftext[x=7.645397in,y=2.795590in,left,base]{\rmfamily*\fontsize{16.000000}*{19.200000}\selectfont
\(\displaystyle x\)}%
\pgftext[x=0.379306in,y=5.602445in,,bottom]{\rmfamily*\fontsize{16.000000}*{19.200000}\selectfont
\(\displaystyle y\)}%
There the size 16 comes from for axes labels?
In case of direct matplotlib usage:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
rc('text', usetex=True)
rc('text.latex',unicode=True)
rc('text.latex',preamble='\usepackage[utf8]{inputenc}')
rc('text.latex',preamble='\usepackage[russian]{babel}')
font = {'family':'serif',
'serif':['Computer Modern Unicode'],
'size': 10, }
rc('font', **font)
x = [1, 2]
plt.plot(x, x)
plt.xlabel('$x$')
plt.ylabel('$y$')
plt.savefig(file_name)
no such thing happens and all fonts are set to 10.
How to alter font size of labels in Sage?
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.