Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extracting (approximate) data from a PostScript file containing plot generated by gnuplot

Suppose that I have a PostScript file containing a plot which was generated using gnuplot. However, I do not have the source data, nor do I have the gnuplot commands that were used to generate the plot.

Do you know of any way to somehow extract data from a graphic representation (i.e., a PostScript file)? Such code would have to literally "read off of the graph" (in particular, I have a smoothed line/scatter XY plot) from the pixel representation, and I know that the results would be approximate at best (but this would still be very highly desirable).

Do you have any experience with this? Thank you for your time!

like image 248
Andrew Avatar asked Oct 08 '22 05:10

Andrew


1 Answers

PostScript is nothing but a programming language to describe pages. A PostScript file is a plain text file containing a program that descbrise a page which gets interpreted by a printer or viewer.

As such it is amendable to programmatic manipulation, albeit in a low-level way.

I would approach this task in the following way.

  1. Learn PostScript. (The reference manual will come in handy.)
  2. Study the output from gnuplot. How does the gnuplot outputs the graph? Is this systematic? etcetera.
  3. Parse and extract the needed information.
like image 180
dvberkel Avatar answered Oct 13 '22 11:10

dvberkel