Babakak
Posts: 3
Joined: Thu Jan 15, 2015 4:47 pm

Save plots in Mathematica-Command line

Thu Jan 15, 2015 5:19 pm

Hello
Would you please tell me how can I save plots by using mathemtica in command line
for example in .jpg format . I used for example :Export["test.jpg",Plot[Sin[x],{x,0,10}]] for saving.
But it couldnt make it.error ....xserver... and front end is not avalilable;...
You know it is important to run it in command line.

szhorvat
Posts: 27
Joined: Wed Jun 04, 2014 2:07 am

Re: Save plots in Mathematica-Command line

Sat Feb 07, 2015 3:27 am

Certain operations, such as exporting graphics, require the Mathematica "Front End". The Front End is the program that shows Mathematica's GUI. If you run Mathematica in command line mode, and try to export graphics, it will automatically start up the Front End for you without any visible windows, so it can render the graphics. Even though it does not have visible windows, it still requires an X server on Linux.

So, to make it short, exporting graphics always requires an X server. The usual workaround we use is to run Xvfb, as described here:

http://mathematica.stackexchange.com/a/58007/12

Return to “Wolfram Language”