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.Sat, 16 Jan 2021 14:32:42 +0100How show vector or matrix in legend label of plot in latex?https://ask.sagemath.org/question/55304/how-show-vector-or-matrix-in-legend-label-of-plot-in-latex/We can insert latex in legend labels by surrounding the text with '$'. But it doesn't work for a vector (matrix, array), e.g.
\left[\begin{array}{r} 1 \\ 0 \end{array}\right]
Is there any way to display vector in latex in legend label?robSat, 16 Jan 2021 14:32:42 +0100https://ask.sagemath.org/question/55304/How to include PDF image from Sage into LaTeX document (scale issue)?https://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 13:29:56 +0200https://ask.sagemath.org/question/34877/Set LaTeX fontsize in labels?https://ask.sagemath.org/question/26273/set-latex-fontsize-in-labels/The size of the text:
plot(sin, 0, pi, legend_label='$sin(x)$', fontsize=28)
plot(sin, 0, pi, legend_label='$sin(x)$').show(fontsize=28)
differs for the parts rendered using LaTeX (i.e. they are not affected by the fontsize size, $sin(x)$ is still a small text). How can I specify font for the LaTeX parts of the labels?EugeneFri, 20 Mar 2015 21:54:59 +0100https://ask.sagemath.org/question/26273/LaTeX in plot not showing Greek letterhttps://ask.sagemath.org/question/25209/latex-in-plot-not-showing-greek-letter/ Hello. I'm using the following code to generate an image of a triangle for a trigonometry quiz.
p = polygon2d([[0,0], [0,3], [4,0]], fill = False, axes = False)
p += text("$\theta$", (3, 0.2), fontsize = 22)
show(p)
The issue is that Sage doesn't seem to recognise $\theta$ as LaTeX, even though it's in dollar signs. In the corner of the triangle, it puts "heta". Why isn't this typesetting correctly? How can I fix it?
Thank you.mathochistWed, 10 Dec 2014 20:22:46 +0100https://ask.sagemath.org/question/25209/Plotting a latex matrix using text()https://ask.sagemath.org/question/9155/plotting-a-latex-matrix-using-text/I would like to plot a latex'd matrix at a location in a 2d plot. I tried this:
text('$\\left( \\begin{array}{ll} 2 & 3 \\\\ 4 & 5 \\end{array} \\right)$', (1,0) )
and various variations to do with the backslashes being escaped or not. But every time I get an error:
matplotlib.pyparsing.ParseFatalException: Expected end of math '$'
$\left( \begin{array}{ll} 2 & 3 \\ 4 & 5 \end{array} \right)$ (at char 0), (line:1, col:1)
It appears that matplotlib doesn't want to parse an array or a pmatrix etc. Is there a workaround?Kate StangeSat, 14 Jul 2012 09:04:17 +0200https://ask.sagemath.org/question/9155/Can I add mathematical formulas to a plot?https://ask.sagemath.org/question/8595/can-i-add-mathematical-formulas-to-a-plot/I know that using
text("Sage is really neat!!",(1,2))
one can easily add text to a plot in Sage. But searching the documentation I couldn't find a way to add a formula, say $\frac{1}{\sqrt{x^2-1}}$.
>So is there a way to add a formula to a plot?
Ideally using LaTeX to enter the formula.MichaelMon, 26 Dec 2011 17:11:26 +0100https://ask.sagemath.org/question/8595/Font size for edge labelhttps://ask.sagemath.org/question/8233/font-size-for-edge-label/Simple example:
d = DiGraph()
d.add_edge(1, 2, '$a_0$')
d.plot(edge_labels=True)
gives me extremely small edge label 'a0', is it possible to increase font size for all edge labels?EugeneSun, 17 Jul 2011 09:44:41 +0200https://ask.sagemath.org/question/8233/