im using root6 on mac and when i try plot data spreadsheet in delimited txt format from excel it only plots one single point. u have used the following lines
on console:
tr ‘\r’ ‘\n’ < /usr/local/Cellar/root/6.10.06/share/root/macros/textfile.txt > unixfile.txt
this is to convert the delimited txt file named ‘textfile.txt’ into a linux type file more compatible for root
and then in root:
g = new TGraph("/usr/local/Cellar/root/6.10.06/share/root/macros/textfile.txt")
i had to enter the entire directory for mac as it would otherwise give error message:
“Error in TGraph::TGraph : Cannot open file: textfile.txt, TGraph is Zombie”
after running, it seemed to output no errors, but when i draw the graph root only shows the first x and y value.
edited: textfile.txt not data.txt
any help?
Attach your “textfile.txt” file.
how do you mean? is there something ive missed?
sbinet
October 6, 2017, 7:37am
4
Could you attach it here or put it somewhere so we can have a look at it?
data1.txt (110 Bytes)
find attached the textfile
the graph draws fine, but only one point is plotted. i have followed the instructions listed. maybe it is to do with the range of the axis? how can i set the range of the x and y axis?
You must run the “sed” command that I gave in another, very similar, thread here. Afterwards you will get all points.
A (simpler?) solution for small files is to use any decent editor and change line endings there.
As an example, in Kate it works the following way:
Just change it to UNIX and save the file.
@Wile_E_Coyote
in attempting your code i receive the following error message:
sed: 1: “{s/\r/\n/g}”: bad flag in substitute command: ‘}’
@behrenhoff this solution worked, Thanks! is there any other (more general) way to change the line endings of txt files to linux on mac, say for larger files??
sbinet
October 6, 2017, 1:42pm
12
there’s dos2unix
:
https://waterlan.home.xs4all.nl/dos2unix.html
(also available from homebrew)
1 Like
system
Closed
October 20, 2017, 1:42pm
13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.