Gnuplot: weird every behaviour
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I would like to plot a file like the following:
this is some header
that is written by the measurement software
for example it contains the date: 2018/1/1
column 1 column 2 column 3 column 4
1 12 13 13 14
2 15 15 15 15
3 10 12 13 15
4 9 9 8 8
5 7 9 10 11
6 6 6 6 6
So there is a multi-line header separated to the data by a blank line. Well easy enough just use the every
command I thought. But there are some Problems (MWE):
reset
$testdata << EOD
this is some header
that is written by the measurement software
for example it contains the date: 2018/1/1
column 1 column 2 column 3 column 4
1 12 13 13 14
2 15 15 15 15
3 10 12 13 15
4 9 9 8 8
5 7 9 10 11
6 6 6 6 6
EOD
# set datafile separator "t"
# set key autotitle columnhead
# set datafile commentschars "abcdefghijklmnopqrstuvwxyz"
# errors: bad data on line X:
# plot $testdata
# plot $testdata every ::1
# plot $testdata every ::2
# plot $testdata every ::3
plot $testdata every ::4
If I plot just the file without every
I get a bad data
error (as expected). My understanding is that I need to ignore the first 4 lines because they are just text and hence have to use plot $testdata every ::4
, but this also ignores the first 3 data points and the plot starts at x=4.
Using every ::3
is possible, the plot then starts at x=3.
Using every ::1
or every ::2
yields a bad data
error again.
If I uncomment set key autotitle columnhead
the title just changes to "is" or "this is some Header" (depending on datafile separator
), so the head is not ignored at all. Also while now every ::2
works (..and the plot starts at x=2), every ::1
still yields the error.
My goal is to get a plot that includes every datapoint obviously + using the columnheaders as title. My current workaround is set datafile commentschars "abcdefghijklmnopqrstuvwxyz"
, but this prevents me from using the columnhead-titles. Is there a gnuplot-only way to handle this? I can NOT change the file formatting as it is the output of a measurement device. Also, I am aware of tools like awk, but I'm not the admin and cannot install Software. This should also be avoided to allow running the script on different machines.
Any help is greatly appreciated!
Thanks a lot
header gnuplot head
add a comment |
I would like to plot a file like the following:
this is some header
that is written by the measurement software
for example it contains the date: 2018/1/1
column 1 column 2 column 3 column 4
1 12 13 13 14
2 15 15 15 15
3 10 12 13 15
4 9 9 8 8
5 7 9 10 11
6 6 6 6 6
So there is a multi-line header separated to the data by a blank line. Well easy enough just use the every
command I thought. But there are some Problems (MWE):
reset
$testdata << EOD
this is some header
that is written by the measurement software
for example it contains the date: 2018/1/1
column 1 column 2 column 3 column 4
1 12 13 13 14
2 15 15 15 15
3 10 12 13 15
4 9 9 8 8
5 7 9 10 11
6 6 6 6 6
EOD
# set datafile separator "t"
# set key autotitle columnhead
# set datafile commentschars "abcdefghijklmnopqrstuvwxyz"
# errors: bad data on line X:
# plot $testdata
# plot $testdata every ::1
# plot $testdata every ::2
# plot $testdata every ::3
plot $testdata every ::4
If I plot just the file without every
I get a bad data
error (as expected). My understanding is that I need to ignore the first 4 lines because they are just text and hence have to use plot $testdata every ::4
, but this also ignores the first 3 data points and the plot starts at x=4.
Using every ::3
is possible, the plot then starts at x=3.
Using every ::1
or every ::2
yields a bad data
error again.
If I uncomment set key autotitle columnhead
the title just changes to "is" or "this is some Header" (depending on datafile separator
), so the head is not ignored at all. Also while now every ::2
works (..and the plot starts at x=2), every ::1
still yields the error.
My goal is to get a plot that includes every datapoint obviously + using the columnheaders as title. My current workaround is set datafile commentschars "abcdefghijklmnopqrstuvwxyz"
, but this prevents me from using the columnhead-titles. Is there a gnuplot-only way to handle this? I can NOT change the file formatting as it is the output of a measurement device. Also, I am aware of tools like awk, but I'm not the admin and cannot install Software. This should also be avoided to allow running the script on different machines.
Any help is greatly appreciated!
Thanks a lot
header gnuplot head
3
Use theskip
keyword to avoid interpretation of the first few line, likeplot $testdata skip 4
. The selection of data withevery
is only done after the full data was already parsed and interpreted.
– Christoph
Nov 23 '18 at 16:07
add a comment |
I would like to plot a file like the following:
this is some header
that is written by the measurement software
for example it contains the date: 2018/1/1
column 1 column 2 column 3 column 4
1 12 13 13 14
2 15 15 15 15
3 10 12 13 15
4 9 9 8 8
5 7 9 10 11
6 6 6 6 6
So there is a multi-line header separated to the data by a blank line. Well easy enough just use the every
command I thought. But there are some Problems (MWE):
reset
$testdata << EOD
this is some header
that is written by the measurement software
for example it contains the date: 2018/1/1
column 1 column 2 column 3 column 4
1 12 13 13 14
2 15 15 15 15
3 10 12 13 15
4 9 9 8 8
5 7 9 10 11
6 6 6 6 6
EOD
# set datafile separator "t"
# set key autotitle columnhead
# set datafile commentschars "abcdefghijklmnopqrstuvwxyz"
# errors: bad data on line X:
# plot $testdata
# plot $testdata every ::1
# plot $testdata every ::2
# plot $testdata every ::3
plot $testdata every ::4
If I plot just the file without every
I get a bad data
error (as expected). My understanding is that I need to ignore the first 4 lines because they are just text and hence have to use plot $testdata every ::4
, but this also ignores the first 3 data points and the plot starts at x=4.
Using every ::3
is possible, the plot then starts at x=3.
Using every ::1
or every ::2
yields a bad data
error again.
If I uncomment set key autotitle columnhead
the title just changes to "is" or "this is some Header" (depending on datafile separator
), so the head is not ignored at all. Also while now every ::2
works (..and the plot starts at x=2), every ::1
still yields the error.
My goal is to get a plot that includes every datapoint obviously + using the columnheaders as title. My current workaround is set datafile commentschars "abcdefghijklmnopqrstuvwxyz"
, but this prevents me from using the columnhead-titles. Is there a gnuplot-only way to handle this? I can NOT change the file formatting as it is the output of a measurement device. Also, I am aware of tools like awk, but I'm not the admin and cannot install Software. This should also be avoided to allow running the script on different machines.
Any help is greatly appreciated!
Thanks a lot
header gnuplot head
I would like to plot a file like the following:
this is some header
that is written by the measurement software
for example it contains the date: 2018/1/1
column 1 column 2 column 3 column 4
1 12 13 13 14
2 15 15 15 15
3 10 12 13 15
4 9 9 8 8
5 7 9 10 11
6 6 6 6 6
So there is a multi-line header separated to the data by a blank line. Well easy enough just use the every
command I thought. But there are some Problems (MWE):
reset
$testdata << EOD
this is some header
that is written by the measurement software
for example it contains the date: 2018/1/1
column 1 column 2 column 3 column 4
1 12 13 13 14
2 15 15 15 15
3 10 12 13 15
4 9 9 8 8
5 7 9 10 11
6 6 6 6 6
EOD
# set datafile separator "t"
# set key autotitle columnhead
# set datafile commentschars "abcdefghijklmnopqrstuvwxyz"
# errors: bad data on line X:
# plot $testdata
# plot $testdata every ::1
# plot $testdata every ::2
# plot $testdata every ::3
plot $testdata every ::4
If I plot just the file without every
I get a bad data
error (as expected). My understanding is that I need to ignore the first 4 lines because they are just text and hence have to use plot $testdata every ::4
, but this also ignores the first 3 data points and the plot starts at x=4.
Using every ::3
is possible, the plot then starts at x=3.
Using every ::1
or every ::2
yields a bad data
error again.
If I uncomment set key autotitle columnhead
the title just changes to "is" or "this is some Header" (depending on datafile separator
), so the head is not ignored at all. Also while now every ::2
works (..and the plot starts at x=2), every ::1
still yields the error.
My goal is to get a plot that includes every datapoint obviously + using the columnheaders as title. My current workaround is set datafile commentschars "abcdefghijklmnopqrstuvwxyz"
, but this prevents me from using the columnhead-titles. Is there a gnuplot-only way to handle this? I can NOT change the file formatting as it is the output of a measurement device. Also, I am aware of tools like awk, but I'm not the admin and cannot install Software. This should also be avoided to allow running the script on different machines.
Any help is greatly appreciated!
Thanks a lot
header gnuplot head
header gnuplot head
edited Nov 23 '18 at 20:20
Artemis Fowl
1,68641328
1,68641328
asked Nov 23 '18 at 15:21
randomguyrandomguy
183
183
3
Use theskip
keyword to avoid interpretation of the first few line, likeplot $testdata skip 4
. The selection of data withevery
is only done after the full data was already parsed and interpreted.
– Christoph
Nov 23 '18 at 16:07
add a comment |
3
Use theskip
keyword to avoid interpretation of the first few line, likeplot $testdata skip 4
. The selection of data withevery
is only done after the full data was already parsed and interpreted.
– Christoph
Nov 23 '18 at 16:07
3
3
Use the
skip
keyword to avoid interpretation of the first few line, like plot $testdata skip 4
. The selection of data with every
is only done after the full data was already parsed and interpreted.– Christoph
Nov 23 '18 at 16:07
Use the
skip
keyword to avoid interpretation of the first few line, like plot $testdata skip 4
. The selection of data with every
is only done after the full data was already parsed and interpreted.– Christoph
Nov 23 '18 at 16:07
add a comment |
1 Answer
1
active
oldest
votes
Data filtering with every
is done only after the whole data was parsed. That's why you get warning and errors, because the first line cannot be parsed correctly.
To skip some line before the actual parsing starts, use the skip
keyword:
$testdata <<EOD
this is some header
that is written by the measurement software
for example it contains the date: 2018/1/1
"column 1" "column 2" "column 3" "column 4"
1 12 13 13 14
2 15 15 15 15
3 10 12 13 15
4 9 9 8 8
5 7 9 10 11
6 6 6 6 6
EOD
set key autotitle columnheader
plot $testdata skip 4 using 1:2 w lp
Never knew theskip
command existed. Thanks a lot, that did the trick!
– randomguy
Nov 26 '18 at 11:13
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449219%2fgnuplot-weird-every-behaviour%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Data filtering with every
is done only after the whole data was parsed. That's why you get warning and errors, because the first line cannot be parsed correctly.
To skip some line before the actual parsing starts, use the skip
keyword:
$testdata <<EOD
this is some header
that is written by the measurement software
for example it contains the date: 2018/1/1
"column 1" "column 2" "column 3" "column 4"
1 12 13 13 14
2 15 15 15 15
3 10 12 13 15
4 9 9 8 8
5 7 9 10 11
6 6 6 6 6
EOD
set key autotitle columnheader
plot $testdata skip 4 using 1:2 w lp
Never knew theskip
command existed. Thanks a lot, that did the trick!
– randomguy
Nov 26 '18 at 11:13
add a comment |
Data filtering with every
is done only after the whole data was parsed. That's why you get warning and errors, because the first line cannot be parsed correctly.
To skip some line before the actual parsing starts, use the skip
keyword:
$testdata <<EOD
this is some header
that is written by the measurement software
for example it contains the date: 2018/1/1
"column 1" "column 2" "column 3" "column 4"
1 12 13 13 14
2 15 15 15 15
3 10 12 13 15
4 9 9 8 8
5 7 9 10 11
6 6 6 6 6
EOD
set key autotitle columnheader
plot $testdata skip 4 using 1:2 w lp
Never knew theskip
command existed. Thanks a lot, that did the trick!
– randomguy
Nov 26 '18 at 11:13
add a comment |
Data filtering with every
is done only after the whole data was parsed. That's why you get warning and errors, because the first line cannot be parsed correctly.
To skip some line before the actual parsing starts, use the skip
keyword:
$testdata <<EOD
this is some header
that is written by the measurement software
for example it contains the date: 2018/1/1
"column 1" "column 2" "column 3" "column 4"
1 12 13 13 14
2 15 15 15 15
3 10 12 13 15
4 9 9 8 8
5 7 9 10 11
6 6 6 6 6
EOD
set key autotitle columnheader
plot $testdata skip 4 using 1:2 w lp
Data filtering with every
is done only after the whole data was parsed. That's why you get warning and errors, because the first line cannot be parsed correctly.
To skip some line before the actual parsing starts, use the skip
keyword:
$testdata <<EOD
this is some header
that is written by the measurement software
for example it contains the date: 2018/1/1
"column 1" "column 2" "column 3" "column 4"
1 12 13 13 14
2 15 15 15 15
3 10 12 13 15
4 9 9 8 8
5 7 9 10 11
6 6 6 6 6
EOD
set key autotitle columnheader
plot $testdata skip 4 using 1:2 w lp
answered Nov 25 '18 at 9:59
ChristophChristoph
39.2k848124
39.2k848124
Never knew theskip
command existed. Thanks a lot, that did the trick!
– randomguy
Nov 26 '18 at 11:13
add a comment |
Never knew theskip
command existed. Thanks a lot, that did the trick!
– randomguy
Nov 26 '18 at 11:13
Never knew the
skip
command existed. Thanks a lot, that did the trick!– randomguy
Nov 26 '18 at 11:13
Never knew the
skip
command existed. Thanks a lot, that did the trick!– randomguy
Nov 26 '18 at 11:13
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449219%2fgnuplot-weird-every-behaviour%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Use the
skip
keyword to avoid interpretation of the first few line, likeplot $testdata skip 4
. The selection of data withevery
is only done after the full data was already parsed and interpreted.– Christoph
Nov 23 '18 at 16:07