why is my gnuplot result (png from csv) not what I expected?












0















(gnuplot 5.2.5, Centos 7) I've tried about 8 google examples and my result is still not even close.

Here is my data:




Timestamp,1016.qmgr,1893.sshd,1.systemd,2017.sshd

2018-11-21.04:23:03,0.1,1.0,4.0,2.0

2018-11-21.04:23:04,0.2,2.0,5.0,4.0

2018-11-21.04:23:05,0.3,3.0,6.0,8.0




Here are my plot settings:



 set datafile separator ","
set title "CPU % Usage per task over time"
set ylabel '% CPU'
set xlabel 'Time'
set grid
set term png
set output '10.png'
set key autotitle columnheader
plot for [i=2:5] 'Results.10/CPU.csv' using 1:i'


Basically, I was expecting something like this:
enter image description here



But I got something like this:
enter image description here



Any ideas what to set in the plot parameters file?










share|improve this question




















  • 1





    Please read the comments of tags before applying them, the "linux" tag was wrong here.

    – Ulrich Eckhardt
    Nov 21 '18 at 7:23
















0















(gnuplot 5.2.5, Centos 7) I've tried about 8 google examples and my result is still not even close.

Here is my data:




Timestamp,1016.qmgr,1893.sshd,1.systemd,2017.sshd

2018-11-21.04:23:03,0.1,1.0,4.0,2.0

2018-11-21.04:23:04,0.2,2.0,5.0,4.0

2018-11-21.04:23:05,0.3,3.0,6.0,8.0




Here are my plot settings:



 set datafile separator ","
set title "CPU % Usage per task over time"
set ylabel '% CPU'
set xlabel 'Time'
set grid
set term png
set output '10.png'
set key autotitle columnheader
plot for [i=2:5] 'Results.10/CPU.csv' using 1:i'


Basically, I was expecting something like this:
enter image description here



But I got something like this:
enter image description here



Any ideas what to set in the plot parameters file?










share|improve this question




















  • 1





    Please read the comments of tags before applying them, the "linux" tag was wrong here.

    – Ulrich Eckhardt
    Nov 21 '18 at 7:23














0












0








0








(gnuplot 5.2.5, Centos 7) I've tried about 8 google examples and my result is still not even close.

Here is my data:




Timestamp,1016.qmgr,1893.sshd,1.systemd,2017.sshd

2018-11-21.04:23:03,0.1,1.0,4.0,2.0

2018-11-21.04:23:04,0.2,2.0,5.0,4.0

2018-11-21.04:23:05,0.3,3.0,6.0,8.0




Here are my plot settings:



 set datafile separator ","
set title "CPU % Usage per task over time"
set ylabel '% CPU'
set xlabel 'Time'
set grid
set term png
set output '10.png'
set key autotitle columnheader
plot for [i=2:5] 'Results.10/CPU.csv' using 1:i'


Basically, I was expecting something like this:
enter image description here



But I got something like this:
enter image description here



Any ideas what to set in the plot parameters file?










share|improve this question
















(gnuplot 5.2.5, Centos 7) I've tried about 8 google examples and my result is still not even close.

Here is my data:




Timestamp,1016.qmgr,1893.sshd,1.systemd,2017.sshd

2018-11-21.04:23:03,0.1,1.0,4.0,2.0

2018-11-21.04:23:04,0.2,2.0,5.0,4.0

2018-11-21.04:23:05,0.3,3.0,6.0,8.0




Here are my plot settings:



 set datafile separator ","
set title "CPU % Usage per task over time"
set ylabel '% CPU'
set xlabel 'Time'
set grid
set term png
set output '10.png'
set key autotitle columnheader
plot for [i=2:5] 'Results.10/CPU.csv' using 1:i'


Basically, I was expecting something like this:
enter image description here



But I got something like this:
enter image description here



Any ideas what to set in the plot parameters file?







plot graph gnuplot






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 7:23









Ulrich Eckhardt

12.7k11737




12.7k11737










asked Nov 21 '18 at 4:48









Kiichiro MatsushitaKiichiro Matsushita

163




163








  • 1





    Please read the comments of tags before applying them, the "linux" tag was wrong here.

    – Ulrich Eckhardt
    Nov 21 '18 at 7:23














  • 1





    Please read the comments of tags before applying them, the "linux" tag was wrong here.

    – Ulrich Eckhardt
    Nov 21 '18 at 7:23








1




1





Please read the comments of tags before applying them, the "linux" tag was wrong here.

– Ulrich Eckhardt
Nov 21 '18 at 7:23





Please read the comments of tags before applying them, the "linux" tag was wrong here.

– Ulrich Eckhardt
Nov 21 '18 at 7:23












1 Answer
1






active

oldest

votes


















1














You need to tell gnuplot that the first column contains time data, and also what the format is:



set xdata time
set timefmt "%Y-%m-%d.%H:%M:%S"


There are other ways to do it, but that is the simplest way to deal with time specified as a string.



[amended answer]
If you just want the content of the first column printed along x as an opaque text string, the command is:



plot for [i=2:5] 'Results.10/CPU.csv' using 0:i:xticlabels(1)


Because these strings are very long, you probably will need to rotate the labels so they do not overlap:



set xtics rotate by -45





share|improve this answer


























  • why? I mean, it's a series of values. Could be A, B, C...

    – DraxDomax
    Nov 21 '18 at 9:46











  • I may have misunderstood what you want. The example plot you showed has time values along the x axis so I thought that is what you wanted. If you just want the content of column 1 printed as an opaque text blob, the command is different. See amended answer

    – Ethan
    Nov 21 '18 at 18:07











  • actually that somehow helped. I am still not sure how, as the series that represents the x values is nicely sorted anyway. I had other problems with that plot properties file but I seem to be on top of it now. Thanks!

    – DraxDomax
    Nov 22 '18 at 22:22











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53405419%2fwhy-is-my-gnuplot-result-png-from-csv-not-what-i-expected%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









1














You need to tell gnuplot that the first column contains time data, and also what the format is:



set xdata time
set timefmt "%Y-%m-%d.%H:%M:%S"


There are other ways to do it, but that is the simplest way to deal with time specified as a string.



[amended answer]
If you just want the content of the first column printed along x as an opaque text string, the command is:



plot for [i=2:5] 'Results.10/CPU.csv' using 0:i:xticlabels(1)


Because these strings are very long, you probably will need to rotate the labels so they do not overlap:



set xtics rotate by -45





share|improve this answer


























  • why? I mean, it's a series of values. Could be A, B, C...

    – DraxDomax
    Nov 21 '18 at 9:46











  • I may have misunderstood what you want. The example plot you showed has time values along the x axis so I thought that is what you wanted. If you just want the content of column 1 printed as an opaque text blob, the command is different. See amended answer

    – Ethan
    Nov 21 '18 at 18:07











  • actually that somehow helped. I am still not sure how, as the series that represents the x values is nicely sorted anyway. I had other problems with that plot properties file but I seem to be on top of it now. Thanks!

    – DraxDomax
    Nov 22 '18 at 22:22
















1














You need to tell gnuplot that the first column contains time data, and also what the format is:



set xdata time
set timefmt "%Y-%m-%d.%H:%M:%S"


There are other ways to do it, but that is the simplest way to deal with time specified as a string.



[amended answer]
If you just want the content of the first column printed along x as an opaque text string, the command is:



plot for [i=2:5] 'Results.10/CPU.csv' using 0:i:xticlabels(1)


Because these strings are very long, you probably will need to rotate the labels so they do not overlap:



set xtics rotate by -45





share|improve this answer


























  • why? I mean, it's a series of values. Could be A, B, C...

    – DraxDomax
    Nov 21 '18 at 9:46











  • I may have misunderstood what you want. The example plot you showed has time values along the x axis so I thought that is what you wanted. If you just want the content of column 1 printed as an opaque text blob, the command is different. See amended answer

    – Ethan
    Nov 21 '18 at 18:07











  • actually that somehow helped. I am still not sure how, as the series that represents the x values is nicely sorted anyway. I had other problems with that plot properties file but I seem to be on top of it now. Thanks!

    – DraxDomax
    Nov 22 '18 at 22:22














1












1








1







You need to tell gnuplot that the first column contains time data, and also what the format is:



set xdata time
set timefmt "%Y-%m-%d.%H:%M:%S"


There are other ways to do it, but that is the simplest way to deal with time specified as a string.



[amended answer]
If you just want the content of the first column printed along x as an opaque text string, the command is:



plot for [i=2:5] 'Results.10/CPU.csv' using 0:i:xticlabels(1)


Because these strings are very long, you probably will need to rotate the labels so they do not overlap:



set xtics rotate by -45





share|improve this answer















You need to tell gnuplot that the first column contains time data, and also what the format is:



set xdata time
set timefmt "%Y-%m-%d.%H:%M:%S"


There are other ways to do it, but that is the simplest way to deal with time specified as a string.



[amended answer]
If you just want the content of the first column printed along x as an opaque text string, the command is:



plot for [i=2:5] 'Results.10/CPU.csv' using 0:i:xticlabels(1)


Because these strings are very long, you probably will need to rotate the labels so they do not overlap:



set xtics rotate by -45






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 21 '18 at 18:21

























answered Nov 21 '18 at 5:35









EthanEthan

1,796267




1,796267













  • why? I mean, it's a series of values. Could be A, B, C...

    – DraxDomax
    Nov 21 '18 at 9:46











  • I may have misunderstood what you want. The example plot you showed has time values along the x axis so I thought that is what you wanted. If you just want the content of column 1 printed as an opaque text blob, the command is different. See amended answer

    – Ethan
    Nov 21 '18 at 18:07











  • actually that somehow helped. I am still not sure how, as the series that represents the x values is nicely sorted anyway. I had other problems with that plot properties file but I seem to be on top of it now. Thanks!

    – DraxDomax
    Nov 22 '18 at 22:22



















  • why? I mean, it's a series of values. Could be A, B, C...

    – DraxDomax
    Nov 21 '18 at 9:46











  • I may have misunderstood what you want. The example plot you showed has time values along the x axis so I thought that is what you wanted. If you just want the content of column 1 printed as an opaque text blob, the command is different. See amended answer

    – Ethan
    Nov 21 '18 at 18:07











  • actually that somehow helped. I am still not sure how, as the series that represents the x values is nicely sorted anyway. I had other problems with that plot properties file but I seem to be on top of it now. Thanks!

    – DraxDomax
    Nov 22 '18 at 22:22

















why? I mean, it's a series of values. Could be A, B, C...

– DraxDomax
Nov 21 '18 at 9:46





why? I mean, it's a series of values. Could be A, B, C...

– DraxDomax
Nov 21 '18 at 9:46













I may have misunderstood what you want. The example plot you showed has time values along the x axis so I thought that is what you wanted. If you just want the content of column 1 printed as an opaque text blob, the command is different. See amended answer

– Ethan
Nov 21 '18 at 18:07





I may have misunderstood what you want. The example plot you showed has time values along the x axis so I thought that is what you wanted. If you just want the content of column 1 printed as an opaque text blob, the command is different. See amended answer

– Ethan
Nov 21 '18 at 18:07













actually that somehow helped. I am still not sure how, as the series that represents the x values is nicely sorted anyway. I had other problems with that plot properties file but I seem to be on top of it now. Thanks!

– DraxDomax
Nov 22 '18 at 22:22





actually that somehow helped. I am still not sure how, as the series that represents the x values is nicely sorted anyway. I had other problems with that plot properties file but I seem to be on top of it now. Thanks!

– DraxDomax
Nov 22 '18 at 22:22


















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53405419%2fwhy-is-my-gnuplot-result-png-from-csv-not-what-i-expected%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

Npm cannot find a required file even through it is in the searched directory