0
$\begingroup$

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

enter image description here

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.

$\endgroup$
7
  • $\begingroup$ 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) ... $\endgroup$
    – Domen
    Mar 17, 2023 at 14:52
  • $\begingroup$ @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. $\endgroup$ Mar 17, 2023 at 15:06
  • $\begingroup$ 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 ... $\endgroup$
    – Domen
    Mar 17, 2023 at 15:33
  • 2
    $\begingroup$ 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]). $\endgroup$
    – Domen
    Mar 17, 2023 at 17:00
  • 1
    $\begingroup$ Oh, right, change "PageGraphics" to "Pages" to use my code in version <= 12.2. $\endgroup$
    – Domen
    Mar 17, 2023 at 18:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.