On Monday, 8 June 2015 22:11:08 UTC-3, kcrisman wrote: > > > > On Monday, June 8, 2015 at 8:17:29 PM UTC-4, Fausto A. A. Barbuto wrote: >> >> >> Hello, >> >> Is there a command to save a plot generated by parametric_plot3d()? >> Like, say: >> >> P = >> parametric_plot3d([x,y,z],(u,-10.0,10.0),(v,-10.0,10.0),plot_points=[50,50],frame=False,color=(fc,colormaps.jet)) >> P.save('somename.png') >> >> > It would be helpful to see a 'minimal' example that one can just 'plug > in'. Ordinarily P.save should work fine. > > > My own puttering about led to this unfortunate mess. > > sage: sage: var('u, v') > (u, v) > sage: sage: x = u > sage: sage: y = v > sage: z = u > sage: fc = sin(u) > sage: P = > parametric_plot3d([x,y,z],(u,-10.0,10.0),(v,-10.0,10.0),plot_points=[50,50],frame=False,color=(fc,colormaps.jet))<snip > > expected deprecation warning> > rich_output = self._call_rich_repr(obj, rich_repr_kwds) > /Users/.../sage/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.py:570: > > RichReprWarning: Exception in _rich_repr_ while displaying object: the > number of arguments must be less than or equal to 1 > RichReprWarning, > Graphics3d Object > > the second warning was unexpected, the output REALLY is unexpected. > > Volker (or someone else) what is going on here with the display hook - > shouldn't *some* graphic, even an empty one, show up here, even if my > made-up input makes no sense? Once after trying something like this, > Ctrl-C even led to a segfault, very impressive! This is in beta3; in Sage > 6.5 it's the possibly even worse KeyError: 'text/plain'. >
Hi, Here is an example that works. It plots an image. What I had in mind was to replace P.show(...) by P.save(...) and, instead of displaying the image, saving it. The replacement dDidn't work out though. Needless to say, the script below runs on Sage's notebook. Thanks for your reply. Fausto #---------- Script begins here ----------# from time import time u,v = var('u','v') a = var('a') a = 0.2 a2 = (1.0 - a*a) sa2 = sqrt(a2) print "<html><h3>Breather Surface</h3></html>" def x(u,v) : return -u + (2.0*a2*cosh(a*u)*sinh(a*u))/(a*((a2*(cosh(a*u))^2 + a*a*( sin(sa2*v))^2))) def y(u,v) : return 2.0*sa2*cosh(a*u)*(-sa2*cos(v)*cos(sa2*v) - sin(v)*sin(sa2*v))/(a *((a2*(cosh(a*u))^2 + a*a*(sin(sa2*v))^2))) def z(u,v) : return 2.0*sa2*cosh(a*u)*(-sa2*sin(v)*cos(sa2*v) + cos(v)*sin(sa2*v))/(a *((a2*(cosh(a*u))^2 + a*a*(sin(sa2*v))^2))) def fc(u,v) : # Colour scheme called by parametric_plot3d return abs(u)/30.0 t1 = time() P = parametric_plot3d([x,y,z],(u,-30.0,30.0),(v,-160.0,160.0),plot_points=[ 250,250],frame=False,color=(fc,colormaps.jet)) P.show(viewer='jmol') t2 = time() print "a = ",a print "Execution time: ", t2-t1, " seconds." #---------- Script ends here ----------# -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.