Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increasing graphics detail through script in Mathematica

My goal is to generate big graphs and save images of them (PNG, preferably) through a script (that is: without having to interact with them through a notebook).

Example: I generate a complete graph on 100 notes in a Mathematica notebook and saved the graphic. Out comes the wonderfully detailed image below:

Yay! High quality graph:

But when I save it via script as below:

graph = CompleteGraph[100];
Export["mysuperawesomegraph.png", ImageResize[graph, 1000]];

I lose all detail in the edges

Oh no! So much quality is lost! You can't even see the edges anymore...

I've tried changing the number 1000 to numbers up to 15000 in the line:

Export["mysuperawesomegraph.png", ImageResize[graph, 1000]];

The result seems to be that a bigger image is saved, but with the same level of detail.

like image 405
rjkaplan Avatar asked Oct 08 '22 04:10

rjkaplan


2 Answers

You first want to find the good size on screen. This looks good: Show[graph, ImageSize -> 1000]

Then export specifying a proper image resolution:

Export["mysuperawesomegraph.png", 
       Show[graph, ImageSize -> 1000], ImageResolution -> 200]

For more details, check out this question on mathematica.SE

like image 176
Matthias Odisio Avatar answered Oct 13 '22 10:10

Matthias Odisio


Try this:

Export["mysuperawesomegraph.png", CompleteGraph[100, ImageSize -> 1000]]
like image 23
withparadox2 Avatar answered Oct 13 '22 10:10

withparadox2