Re: Export graphics without notebook ( using .m file)
- To: mathgroup at smc.vnet.net
- Subject: [mg129216] Re: Export graphics without notebook ( using .m file)
- From: awnl <awnl at gmx-topmail.de>
- Date: Fri, 21 Dec 2012 05:42:07 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <kajode$ilu$1@smc.vnet.net>
Hi, > It is example from help: > --------------- > div[{vx_, vy_}] := D[vx, x] + D[vy, y]; > vf = {Cos[x + y^3], Sin[y + x^3]}; > fig = StreamDensityPlot[Evaluate[{vf, div[vf]}], {x, -3, 3}, > {y, -3, 3}, StreamPoints -> Fine, StreamScale -> Large, > ColorFunction -> "Rainbow", MaxRecursion -> 2, > LightingAngle -> Automatic, StreamStyle -> Black]; > Export["tt.jpg", fig]; > --------------- > > The question is: > > Why this works fine inside Mathematica notebook > and doesnt work as a script ? > > math < example.m > > generates tt.jpg file but not identical as from notebook ? > I think rendering graphics and exporting needs a frontend. >From a batch job you can use the function UsingFrontEnd to run these functions. See the reference page in the help browser for more details: ref/UsingFrontEnd Depending on how you start your job you might need to provide some prerequisites: on a linux machine you typically need an X-server running for the frontend. Here: <http://reference.wolfram.com/legacy/v8/webMathematica/tutoria/InstallationXWindows.html#3537196> is some documentation how to set this up for WebMathematica with e.g. Xvnc or vncserver which you basically can also use for a batch job started from a terminal session or a cron job... hth, albert