Re: Graphics and DisplayFunction
- To: mathgroup at smc.vnet.net
- Subject: [mg98273] Re: Graphics and DisplayFunction
- From: replicatorzed at gmail.com
- Date: Fri, 3 Apr 2009 20:12:56 -0500 (EST)
- References: <gqsn9m$3tr$1@smc.vnet.net> <gr21l6$lq8$1@smc.vnet.net>
Of course one can forget about DisplayFunction and use Print, but for me a more elaborate function does the job: Since I have plotting functions deeply embedded in code and in packages (and for other reasons), I actually have to maintain a DisplayFunction, which - through user-defined switches - redirects results to various outputs, possibly not just to the actual notebook, but simultaneously to notebook AND multiple files as well. Also a problem with your method is that by Printing a Graphics, you end up with something that is NOT a Graphics object, but in my case (I don't want to get to the complex details) I definitely need something in return that is a Graphics object. I have everything working for years now, just this bit (the topic, i.e. Graphics are not affected by DisplayFunction) caused some malfunctions in the previous days. Thanks for the answers anyway. Istvan On Apr 3, 11:11 am, David Bailey <d... at removedbailey.co.uk> wrote: > > I would forget about the DisplayFunction option - it is more or less > obsolete. Just think of graphics as output - just like numbers or equatio= ns. > > If you do a calculation, and then as the last step generate a graphical > output (either explicitly with Graphics, or indirectly using Plot (say), > then providing you don't terminate that command with a semicolon, you > will get your graphical output, for example: > > xx = 10; > yy = 20; > Graphics[{Line[{{-xx/2, 0}, {xx/2, 0}}], > Line[{{0, -yy/2}, {0, yy/2}}]}] > > If, however, you want to go on and calculate something else (or make > another graph), simply print your graphical output (again, exactly as > you would for text): > > xx = 10; > yy = 20; > Print[Graphics[{Line[{{-xx/2, 0}, {xx/2, 0}}], > Line[{{0, -yy/2}, {0, yy/2}}]}]]; > Print["Something else ",Sqrt[xx]];