5

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!

Andrew
  • 1,499
  • 9
  • 25
  • 37
  • 1
    It's really a shame that gnuplot changes the coordinates when it could use the original values adding a simple transformation in the PostScript code. I guess it's so for uniformity with other drivers. – lhf Jul 17 '12 at 02:32

2 Answers2

4

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.
dvberkel
  • 663
  • 4
  • 16
  • 2
    PostScript is even **more** than '*nothing but* a programming language to describe pages'. It's even a Turing-complete programming language (in other words: it can do *everything*, not just describe pages). And now something for Young Grashoppers to think long about: *How easy is it in your experience to take the program code of any **other** language and manipulate it programmatically so that it still is functional?!?!* -- So while it may be possible, it could turn out to be a really daunting task. Depends on the real-world PS code which you may need to manipulate... – Kurt Pfeifle Jul 19 '12 at 18:06
  • 1
    The postscript generated by the gnuplot driver is clean/simple enough that anyone with even a little programming knowlege should be able to handle this without really learning postscipt to any depth. If there is interest I could post a few pointers, but seeing as this is an old question I wont take the time if there is no interest. – agentp Aug 30 '12 at 21:31
0

g3data, available here, looks like a possibility. It runs on Linux.

Andrew
  • 1,499
  • 9
  • 25
  • 37