Export to eps, platform dependent?


I’m currently updating the documentation, for a code i’m working on, and I wanted to have the plots generated automatically (to check the code still does what it is supposed to do). This means that i need a way to compare them with a previous version to check they’re consistent (unless i changed something). I came with the idea of dumping everyting in eps, and compare my new plot to a database of reference (with a good old diff, ignoring few key lines).

It’s all working good so far when working on my machine but i tried to change the system (using another linux distribution on another machine) and some plots are not exactly the same anymore (13/14 are ok, 1 is bad).

Taking yet another distribution (and another machine) this rate falls down to 1/14 ok.

Is this known ? Do you know a way to circumvent this ? Or any smarter way to do what I’d like to do ?


Comparing EPS/PS graphics output is not straight forward. A diff with an exiting reference file will always tells you that the files are different if the reference file and the generated file have not been produced on the same machine. Mainly because of different precision and rounding effect… Both pictures will be correct though … and both file will look visually exactly the same. We faced that issue with the $ROOTSYS/test/stressGraphics.cxx program. Instead of comparing the files (with a diff) we compare the size of the generated file with a reference table of sizes. It works well. If the file are different visually then the size will be outside the error margin and we will get a failure.

Thanks for your reply

Another question maybe (even though i’ll test your solution): Is the size changing in the case where i’m moving a legend without changing anything else ? And do you have maybe a suggestion if it were not to be eps files ? (originally I choose eps just because it is text compliant so pretty easy and quick to make a diff, but i’m working with png/pdf)

So far i found this , from imagemagick:

compare -metric MAE plot1.eps plot2.eps null: 2>&1 | awk '{print $1}'

which gives a numerical agreement between two plots, 0 being a perfect match. Over the three system i’m working on, this does the trick (but it is pretty slow… ~1min for 15 plots)

thanks anyway, it’s really helpful to have feedback

Yes any small change might affect by a few few bytes the size of the file. And even the exact same plot produced on two different machines might also produce differences in size. In stressGraphics we produce not only EPS files but also PDF png and jpeg… We compare size for all of them (with some error bar). The size comparison is very fast. Have a look at stressGraphics.cxx.

Thanks again for the very quick reply

Lookng at it, I had a last question on choosing the size of the error bars.

With your experience, what threshold seems reasonable ?

I set it to half a percent (out of nothing, i must admit…)

Thanks again anyway

The errors bar size depends on your data… I the best is to try and see what is the smallest one you can have.
For instance if you draw fixed values it can be quite small. But if your example draws plots generated using random numbers it will obviously be bigger…