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.Tue, 15 Feb 2022 16:15:27 +0100TeX label and running list-variable simultaneously in a plot legend (or plot title)https://ask.sagemath.org/question/61112/tex-label-and-running-list-variable-simultaneously-in-a-plot-legend-or-plot-title/I want to use a `[... for n in ...]` to generate plots. How can I combine in a legend and/or title, TeX with the variable that runs (here $n$) to generate the list of plots? Minimal example:
some_plots=[plot(x^n,(x,0,1.1),title=r'$x^n$ where $n$ takes the value in the box
(format is not nice, though)',
legend_label=n, rgbcolor=hue(.1*n)) for n in range(0,10)]
sum(some_plots[s] for s in range(0,10))
which shows a box with colors, and, separately the title. How can I add $n$ to the box? If I combine TeX and the variable (like `$x^n$=n`) I get errors. (I cannot upload yet pictures, which would make the question very clear)c.p.Tue, 15 Feb 2022 16:15:27 +0100https://ask.sagemath.org/question/61112/Strange Error Message when Plotting with a LaTeX Legendhttps://ask.sagemath.org/question/52276/strange-error-message-when-plotting-with-a-latex-legend/The following code is from the 1st edition of my textbook, *Sage for Undergraduates*. It is producing some extremely unexpected errors (technically, deprication warnings). Something about an invalid escape sequence, `\i`, which I'm not using.
Can someone explain how I should change my code, so that these warnings do not appear?
Code:
`P1= text('$\int_0^2 \sqrt{x} \, dx$', (0.5, 1.1), fontsize=20)`
`P2= plot( sqrt(x), 0, 2, fill=True)`
`P= P1 + P2`
`P.show()`
Warning:
`<input>:1: DeprecationWarning: invalid escape sequence \i`
Quick Link:
https://sagecell.sagemath.org/?z=eJwVy8EKAiEURuF90Dv8i4FREtELLe87uGgptclIkLHGG0nRu-fszuI7wTMkdVHzFPMiF3cmxPZc5dt_iAbXPs0GytmjgbdeG9zqIi1_EpPT-10gxqNUUdgm1QdwBjRYLoVP6yttiBE8Dgg02rZ7fSv9B0vRIXA=&lang=sage&interacts=eJyLjgUAARUAuQ==Gregory BardWed, 01 Jul 2020 01:28:17 +0200https://ask.sagemath.org/question/52276/