ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 02 Aug 2020 10:36:30 -0500Outputting SVG source of a plothttps://ask.sagemath.org/question/52810/outputting-svg-source-of-a-plot/Given a plot, how do I return the source code of its SVG representation? (Not save the SVG to disk.)
E.g. this saves to disk:
`plot_slope_field(sin(x+y) + cos(x+y), (x,-3,3), (y,-3,3)).save('foo.svg')`
I want something like:
`plot_slope_field(sin(x+y) + cos(x+y), (x,-3,3), (y,-3,3)).svg_source()`
which returns a string containing the source of the SVG.
StevenClontzSun, 02 Aug 2020 10:36:30 -0500https://ask.sagemath.org/question/52810/SageMath Icon?https://ask.sagemath.org/question/42961/sagemath-icon/ Hi. I want to associate .sage files with sage icon. I found this png online:
https://i.imgur.com/6CAzDjb.png
Does anyone have svg of this logo? Are there no other svgs for Sage?o6pThu, 12 Jul 2018 09:03:56 -0500https://ask.sagemath.org/question/42961/ParametrizedSurface3D to epshttps://ask.sagemath.org/question/40420/parametrizedsurface3d-to-eps/Can I convert a ParametrizedSurface3D plot to an eps file? I understand it's not a Graphics object, does this mean there's no hope?jdtj2Mon, 01 Jan 2018 08:55:35 -0600https://ask.sagemath.org/question/40420/MathJax stopped workinghttps://ask.sagemath.org/question/31404/mathjax-stopped-working/I created a couple of commands and realized they produce no output. If typesetting is turned to false, then the output is produced. When I go to the print tab, I get the following error:
File failed to load: localhost:8080/javascript/mathjax/jax/output/SVG/config.js
Why did it suddenly stop working?
I'm using Linux Mint 17.2, used the sagemath-upstream-binary package from the PPA. I'm using the Sage notebook. My commands are
x = var('x')
w = x^4 - (1+3*i)*x^3 - (2-4*i)*x^2 + (6-2*i)*x - 4 - 4*i
p = x^4 + (1-3*i)*x^3 - (4+3*i)*x^2 - (4-2*i)*x + 2*i
solve(w,x)
I tried using Jupyter but I get the following error while creating a notebook in Jupyter:
Failed to retrieve MathJax from '../nbextensions/mathjax/MathJax.js'
although I have MathJax installed locally in /usr/share/javascript/mathjax and in /usr/lib/sagemath/local/share/mathjaxmarmistrzTue, 08 Dec 2015 02:00:37 -0600https://ask.sagemath.org/question/31404/How do I install python modules, or use a different version of python? (with sage)https://ask.sagemath.org/question/8927/how-do-i-install-python-modules-or-use-a-different-version-of-python-with-sage/I have several versions of python, as well as the one included with sage. I want to use the svgwrite module in /Library/Frameworks/Python.framework/Versions/2.7/bin/python , but sage does not have it.
I want to run the following (combined with some output from sage)
import svgwrite
dwg = svgwrite.Drawing('test.svg', profile='tiny')
dwg.add(dwg.line((0, 0), (10, 0), stroke=svgwrite.rgb(10, 10, 16, '%')))
dwg.add(dwg.text('Test', insert=(0, 0.2), fill='red'))
dwg.save()
It runs fine with the calls
python drawT.sage
python2.7 drawT.sage
But when I try to call it directly or with a system call in sage I have problems.
sage: import sys
sage: os.system("python /path/drawT.sage")
Traceback (most recent call last):
File "/path/drawT.sage", line 1, in <module>
import svgwrite
ImportError: No module named svgwrite
256
sage: os.system("which python")
/Applications/sage/local/bin/python
0
Okay fine, sage's installation does not have the module. But now I try to force it to use the installation that does have it:
sage: os.system("which python2.7")
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
0
sage: os.system("python2.7 /path/drawT.sage")
Traceback (most recent call last):
File "/path/drawT.sage", line 1, in <module>
import svgwrite
ImportError: No module named svgwrite
256
How can I install svgwrite, or invoke a given python installation from sage?
alejandroericksonMon, 30 Apr 2012 16:21:41 -0500https://ask.sagemath.org/question/8927/Save file from online notebookhttps://ask.sagemath.org/question/10353/save-file-from-online-notebook/Is it possible to save plot to svg file from online Sage notebook? bakantTue, 16 Jul 2013 03:07:26 -0500https://ask.sagemath.org/question/10353/Save plot in SVG with plain text stringshttps://ask.sagemath.org/question/9261/save-plot-in-svg-with-plain-text-strings/Hi all,
as previously stated I am quite inexpert in using both SAGE and Python. I am trying to create figure for a LaTeX report. I am working on a machine on which I cannot use the package to integrate SAGE in LaTeX.
I am quite able to create plots and save them in SVG files. The real problem is that every caption or text in my plots appears as a embedded font or shape or whatever.
Here is an example:
TestPlot=plot(sin(x),(x,0,2*pi))+text("a stupid comment",(pi,2))
show(TestPlot)
TestPlot.save('TestPlot.svg')
This code generates the plot but when I start looking into the SVG file I can see that the caption "a stupid comment" was exported as:
<g id="text_13">
<!-- a stupid comment -->
<defs>
<path id="BitstreamVeraSans-Roman-20"/>
<path d="
M54.8906 33.0156
L54.8906 0
L45.9062 0
L45.9062 32.7188
Q45.9062 40.4844 42.875 44.3281
Q39.8438 48.1875 33.7969 48.1875
Q26.5156 48.1875 22.3125 43.5469
Q18.1094 38.9219 18.1094 30.9062
L18.1094 0
L9.07812 0
L9.07812 54.6875
L18.1094 54.6875
L18.1094 46.1875
Q21.3438 51.125 25.7031 53.5625
Q30.0781 56 35.7969 56
Q45.2188 56 50.0469 50.1719
Q54.8906 44.3438 54.8906 33.0156" id="BitstreamVeraSans-Roman-6e"/>
...
Q40.5312 48.4844 33.4062 48.4844
Q26.2656 48.4844 22.1875 42.8438
Q18.1094 37.2031 18.1094 27.2969
Q18.1094 17.3906 22.1875 11.75
Q26.2656 6.10938 33.4062 6.10938
Q40.5312 6.10938 44.6094 11.75
Q48.6875 17.3906 48.6875 27.2969" id="BitstreamVeraSans-Roman-70"/>
</defs>
<g style="fill:#0000ff;" transform="translate(241.978030233 60.4907451923)scale(0.1 -0.1)">
<use xlink:href="#BitstreamVeraSans-Roman-61"/>
<use x="61.279296875" xlink:href="#BitstreamVeraSans-Roman-20"/>
<use x="93.06640625" xlink:href="#BitstreamVeraSans-Roman-73"/>
<use x="145.166015625" xlink:href="#BitstreamVeraSans-Roman-74"/>
<use x="184.375" xlink:href="#BitstreamVeraSans-Roman-75"/>
<use x="247.75390625" xlink:href="#BitstreamVeraSans-Roman-70"/>
<use x="311.23046875" xlink:href="#BitstreamVeraSans-Roman-69"/>
<use x="339.013671875" xlink:href="#BitstreamVeraSans-Roman-64"/>
<use x="402.490234375" xlink:href="#BitstreamVeraSans-Roman-20"/>
<use x="434.27734375" xlink:href="#BitstreamVeraSans-Roman-63"/>
<use x="489.2578125" xlink:href="#BitstreamVeraSans-Roman-6f"/>
<use x="550.439453125" xlink:href="#BitstreamVeraSans-Roman-6d"/>
<use x="647.8515625" xlink:href="#BitstreamVeraSans-Roman-6d"/>
<use x="745.263671875" xlink:href="#BitstreamVeraSans-Roman-65"/>
<use x="806.787109375" xlink:href="#BitstreamVeraSans-Roman-6e"/>
<use x="870.166015625" xlink:href="#BitstreamVeraSans-Roman-74"/>
</g>
</g>
</g>
</g>
Here I have eliminated a lot of lines for sake of readability. This renders well in SVG viewers but as I convert it to pdf+LaTeX with inkscape the caption is not, of course, converted in LaTeX and thus the appearance of the report is not consistent. Is there a way to force the export to actually export a text object?
What I'd like to have is something like this:
<text
x="160.75159"
y="209.35091"
id="text2987"
xml:space="preserve"
style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Lucida Sans;-inkscape-font-specification:Lucida Sans"><tspan
x="160.75159"
y="209.35091"
id="tspan2989">\emph{some stupid comment}</tspan></text>
where, as you can see I can also use some LaTeX syntax with no problem.
Best regards,
mcirri
mcirriTue, 21 Aug 2012 22:03:40 -0500https://ask.sagemath.org/question/9261/.svg fileshttps://ask.sagemath.org/question/9137/svg-files/I'm using SAGE remotely and I would like to know how to save .svg files to my computer.yapsterMon, 16 Jul 2012 10:52:46 -0500https://ask.sagemath.org/question/9137/