# How to digitize the following plot?

Consider the following figure in .pdf format. For convenience, please find it in .png format below:

Could you please tell me how to digitize it, i.e. extract the grid $$\cos(\theta_{K^{\pm}}), P_{K^{\pm}}$$, density?

The approach from this question works for .png figures. I tried it for the given figure, but it was inaccurate for the boundaries, as well as did not distinguish colors in the histogram bar carefully. The .pdf should be easier and more accurate for extracting the data, given that it is a vector figure.

• What have you tried so far? I see two possible implementations: (1) Make a calibrated grid on the raster image, extract pixel values at grid points, then compare each color to the colorbar. (2) Extract little rectangles from the vector image (PDF) ... Mar 17, 2023 at 14:52
• @Domen : previously, I worked with .png files using this approach: mathematica.stackexchange.com/questions/149473/… . However, given the example, it is interesting how the vector nature of the image may simplify the task. Mar 17, 2023 at 15:06
• Simplify in what way? Is that solution not working for you? Is it too slow? Too inaccurate? Then you should mention this in the question ... Mar 17, 2023 at 15:33
• You can begin with pdf = Import["https://www.dropbox.com/s/paowbmpc43m9yil/kaon_spectrum.pdf?dl=1", "PageGraphics"]; data = Cases[pdf, Style[{FilledCurve[_, {pts__}]}, __, FaceForm[color_]] :> {Mean /@ Transpose[pts], color}, All] which will give you all colored strips in the plot (visualize with Graphics[{#2, Point[#1]} & @@@ data]). Mar 17, 2023 at 17:00
• Oh, right, change "PageGraphics" to "Pages" to use my code in version <= 12.2. Mar 17, 2023 at 18:28