Why does gnuplot complain about empty x range (and ruin the graph) when I apply missing data cutoff?
gnuplot 5.2.5 / centos7
Basically, I've configured a plot that I like but now I want to introduce a "cut off" in the lines when the data is missing. I've looked around a lot and there are easy solutions, if I only have 2 columns... However, I have a lot of columns. So, I am using a loop and can't just do ($2)
.
I've found solution to cut lines where there is no data in a loop but they don't work:
Warning: empty x range [2018:2018], adjusting to [1997.82:2038.18]
The configuration that caused the above:
set datafile separator ","
set xdata time
set timefmt "%Y-%m-%d.%H:%M:%S"
set datafile missing
set ylabel "% CPU"
set xlabel "Time Point"
set grid
set xtics rotate
set key autotitle columnheader
set terminal pngcairo
set output 'graph.png'
plot for [i=2:5] "data.csv" using ($1):(column(i)) with linespoints
And here's my data (notice the missing value on second row, second col):
col1,col2,col3,col4
2018-11-21.04:23:03,1,2,2,5
2018-11-21.04:24:03,,4,4,6
2018-11-21.04:25:03,3,6,8,7
2018-11-21.04:26:03,4,8,16,8
What should my plot command look like?
Update: I tried working around it with:
plot "data.csv" using 1:($2) with linespoints,
plot "data.csv" using 1:($3) with linespoints,
But it just plots the first line... This workaround is feasible for me but I don't know how to add more lines? Again, I cannot use the for [i=2:5] trick because that breaks my x range.
plot graph gnuplot
add a comment |
gnuplot 5.2.5 / centos7
Basically, I've configured a plot that I like but now I want to introduce a "cut off" in the lines when the data is missing. I've looked around a lot and there are easy solutions, if I only have 2 columns... However, I have a lot of columns. So, I am using a loop and can't just do ($2)
.
I've found solution to cut lines where there is no data in a loop but they don't work:
Warning: empty x range [2018:2018], adjusting to [1997.82:2038.18]
The configuration that caused the above:
set datafile separator ","
set xdata time
set timefmt "%Y-%m-%d.%H:%M:%S"
set datafile missing
set ylabel "% CPU"
set xlabel "Time Point"
set grid
set xtics rotate
set key autotitle columnheader
set terminal pngcairo
set output 'graph.png'
plot for [i=2:5] "data.csv" using ($1):(column(i)) with linespoints
And here's my data (notice the missing value on second row, second col):
col1,col2,col3,col4
2018-11-21.04:23:03,1,2,2,5
2018-11-21.04:24:03,,4,4,6
2018-11-21.04:25:03,3,6,8,7
2018-11-21.04:26:03,4,8,16,8
What should my plot command look like?
Update: I tried working around it with:
plot "data.csv" using 1:($2) with linespoints,
plot "data.csv" using 1:($3) with linespoints,
But it just plots the first line... This workaround is feasible for me but I don't know how to add more lines? Again, I cannot use the for [i=2:5] trick because that breaks my x range.
plot graph gnuplot
Instead of($1)
, just use1
. Same with($2)
etc.
– Michael O.
Nov 21 '18 at 18:11
Simply usingplot for [i=2:5] "data.csv" using 1:i with linespoints
works fine for me with 5.2.2, i.stack.imgur.com/zftPw.png
– Christoph
Nov 21 '18 at 18:36
add a comment |
gnuplot 5.2.5 / centos7
Basically, I've configured a plot that I like but now I want to introduce a "cut off" in the lines when the data is missing. I've looked around a lot and there are easy solutions, if I only have 2 columns... However, I have a lot of columns. So, I am using a loop and can't just do ($2)
.
I've found solution to cut lines where there is no data in a loop but they don't work:
Warning: empty x range [2018:2018], adjusting to [1997.82:2038.18]
The configuration that caused the above:
set datafile separator ","
set xdata time
set timefmt "%Y-%m-%d.%H:%M:%S"
set datafile missing
set ylabel "% CPU"
set xlabel "Time Point"
set grid
set xtics rotate
set key autotitle columnheader
set terminal pngcairo
set output 'graph.png'
plot for [i=2:5] "data.csv" using ($1):(column(i)) with linespoints
And here's my data (notice the missing value on second row, second col):
col1,col2,col3,col4
2018-11-21.04:23:03,1,2,2,5
2018-11-21.04:24:03,,4,4,6
2018-11-21.04:25:03,3,6,8,7
2018-11-21.04:26:03,4,8,16,8
What should my plot command look like?
Update: I tried working around it with:
plot "data.csv" using 1:($2) with linespoints,
plot "data.csv" using 1:($3) with linespoints,
But it just plots the first line... This workaround is feasible for me but I don't know how to add more lines? Again, I cannot use the for [i=2:5] trick because that breaks my x range.
plot graph gnuplot
gnuplot 5.2.5 / centos7
Basically, I've configured a plot that I like but now I want to introduce a "cut off" in the lines when the data is missing. I've looked around a lot and there are easy solutions, if I only have 2 columns... However, I have a lot of columns. So, I am using a loop and can't just do ($2)
.
I've found solution to cut lines where there is no data in a loop but they don't work:
Warning: empty x range [2018:2018], adjusting to [1997.82:2038.18]
The configuration that caused the above:
set datafile separator ","
set xdata time
set timefmt "%Y-%m-%d.%H:%M:%S"
set datafile missing
set ylabel "% CPU"
set xlabel "Time Point"
set grid
set xtics rotate
set key autotitle columnheader
set terminal pngcairo
set output 'graph.png'
plot for [i=2:5] "data.csv" using ($1):(column(i)) with linespoints
And here's my data (notice the missing value on second row, second col):
col1,col2,col3,col4
2018-11-21.04:23:03,1,2,2,5
2018-11-21.04:24:03,,4,4,6
2018-11-21.04:25:03,3,6,8,7
2018-11-21.04:26:03,4,8,16,8
What should my plot command look like?
Update: I tried working around it with:
plot "data.csv" using 1:($2) with linespoints,
plot "data.csv" using 1:($3) with linespoints,
But it just plots the first line... This workaround is feasible for me but I don't know how to add more lines? Again, I cannot use the for [i=2:5] trick because that breaks my x range.
plot graph gnuplot
plot graph gnuplot
edited Nov 21 '18 at 12:54
Kiichiro Matsushita
asked Nov 21 '18 at 12:39
Kiichiro MatsushitaKiichiro Matsushita
163
163
Instead of($1)
, just use1
. Same with($2)
etc.
– Michael O.
Nov 21 '18 at 18:11
Simply usingplot for [i=2:5] "data.csv" using 1:i with linespoints
works fine for me with 5.2.2, i.stack.imgur.com/zftPw.png
– Christoph
Nov 21 '18 at 18:36
add a comment |
Instead of($1)
, just use1
. Same with($2)
etc.
– Michael O.
Nov 21 '18 at 18:11
Simply usingplot for [i=2:5] "data.csv" using 1:i with linespoints
works fine for me with 5.2.2, i.stack.imgur.com/zftPw.png
– Christoph
Nov 21 '18 at 18:36
Instead of
($1)
, just use 1
. Same with ($2)
etc.– Michael O.
Nov 21 '18 at 18:11
Instead of
($1)
, just use 1
. Same with ($2)
etc.– Michael O.
Nov 21 '18 at 18:11
Simply using
plot for [i=2:5] "data.csv" using 1:i with linespoints
works fine for me with 5.2.2, i.stack.imgur.com/zftPw.png– Christoph
Nov 21 '18 at 18:36
Simply using
plot for [i=2:5] "data.csv" using 1:i with linespoints
works fine for me with 5.2.2, i.stack.imgur.com/zftPw.png– Christoph
Nov 21 '18 at 18:36
add a comment |
0
active
oldest
votes
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%2f53412225%2fwhy-does-gnuplot-complain-about-empty-x-range-and-ruin-the-graph-when-i-apply%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f53412225%2fwhy-does-gnuplot-complain-about-empty-x-range-and-ruin-the-graph-when-i-apply%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
Instead of
($1)
, just use1
. Same with($2)
etc.– Michael O.
Nov 21 '18 at 18:11
Simply using
plot for [i=2:5] "data.csv" using 1:i with linespoints
works fine for me with 5.2.2, i.stack.imgur.com/zftPw.png– Christoph
Nov 21 '18 at 18:36