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 ...
I'm not familiar with svg's, but have you considered exporting it as a pdf? That will render nicely in a lot of LaTeX situations... maybe not appropriate for yours?