Hi! I’ve a data file (see attachment data2.txt) first culomun is a mean energy of primary particle of cosmic ray, culomn 2 is the error of the energy, from culomn 3 to culomn 10 I’ve density of particles (photons, electrons, muons and hadrons) @10m and @100 m.

I need

To plot the data in 4 canvas(so I’ll copy the macro 4 times), each canvas will have 2 graph , where on x-axis
there there is the energy (culomn a) and y-axis the particle density (in one graph @10m and other @100m); for example in the first canvas I need to plot culomn a with culomns c and d, in the second canvas I’ve to plot culomn a with culomns e and f etc.

To fit the 2 graphs;

To print in the statistical box on the canvas the fit result parameters and chi square value.

I wrote the macro (see multigraph.c) but

I don’t know how to set that culomn 2 is the energy error;

the macro doens’t work because
a) this is the plot (I dont’have the graphs, the fit, the tiles, and the statistical box)

I suggest to reduce the problem to the parsing of the input and the creation of a single graph. Once this is achieved, we can move to the multigraph.
A good set of hints and concrete code showing how to parse ascii files can be found here: linuxquestions.org/questions … -c-422806/

Hi Bertrand and thanks! I saw your code, I tried it and it works! I modified somthings to have the title, axis titles and the fit in the legend (See attachment test.c), this is the result

i just don’t know how to set error bars from the file…
thanks test.c (2.81 KB)