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.Thu, 13 Dec 2018 18:57:55 +0100another 'how to save a plot' questionhttps://ask.sagemath.org/question/44662/another-how-to-save-a-plot-question/ I use SageMath in CoCalc to generate images for worksheets, handouts, exams, etc. I am able to save simple plots to image files, but more complex plots like the one below vex me. Can someone tell me how to save the plot to an image file?
<pre>
plot1 = plot(-(x-1)^2+3, x, -3, 2.98)
plot2 = plot(-abs(2*(x-5))+2, x, 3,5.95)
plot3 = plot((x-7)^2-1,x,6.05,10)
pt1 = circle((6, 0),.1, edgecolor='black')
pt2 = point((6, 3), rgbcolor='black', pointsize=30)
pt3 = point((1, 2), rgbcolor='black', pointsize=30)
pt4 = circle((3, -1),.1, edgecolor='black')
pt3 = point((3, -2), rgbcolor='black', pointsize=30)
g3=(plot1+plot2+plot3+pt1+pt2+pt3+pt4).show(xmin=-2, xmax=10, ymin=-4, ymax=6,gridlines="minor").save('diagram2-finalexam01.png')
g3.save('diagram2-exam02.png')
</pre>
The last line throws the following error and no image file is saved:
<pre>
Error in lines 9-9
Traceback (most recent call last):
File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute
flags=compile_flags) in namespace, locals
File "", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'save
</pre>
I've resorted to just taking a screenshot of the plot and using it, but I'd much rather do this in a pythonistic way. Can someone point me in the right direction?
jasonemillerThu, 13 Dec 2018 18:57:55 +0100https://ask.sagemath.org/question/44662/Washed out colors when saving plots to filehttps://ask.sagemath.org/question/33540/washed-out-colors-when-saving-plots-to-file/I try to use the `save` command with a view of a 3d plot, like
mypic = implicit_plot3d(x^2 + y^2 + z^2 == distance, (x, -10, 10), (y, -10, 10), (z, -10, 10), opacity = 0.5) + point3d(vector([0, 0, 0]), color = 'red', size = 10)
mypic.save('mypic.png', compress = false)
but the colors (in particular, the opacities) are washed out.
There is no problem right-clicking to save as png from the notebook, but I want to save a bunch of pngs.
TumericTJTue, 24 May 2016 18:41:57 +0200https://ask.sagemath.org/question/33540/Graph theory exporting problemshttps://ask.sagemath.org/question/10549/graph-theory-exporting-problems/I type in the following SAGE code and get the graph on the screen that I would expect to get.
g = Graph({0,[1,2,2]}); g
g.plot(graph_border = True)
When I try to export this to a file with the following code I get an "AssertionError" message.
g = Graph({0,[1,2,2]}); g
g.plot(graph_border = True).save('graph.pdf')
How can I fix this so that I can output this graph as a pdf file. I love how easy I can make nice looking graphs in SAGE, but it is useless if I can't export them to use in Latex.
Nick.BThu, 19 Sep 2013 20:20:10 +0200https://ask.sagemath.org/question/10549/.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 17:52:46 +0200https://ask.sagemath.org/question/9137/