1

I have data like this

Date       instance 1, 2, 3, 4, 5, 6
03-09-2013 0 0 1 0 0 1
03-09-2013 0 0 6 0 0 6
03-09-2013 0 0 2 0 0 6
03-09-2013 0 0 3 0 0 6
03-09-2013 0 0 1 0 0 6
03-09-2013 0 0 2 0 0 6
04-09-2013 0 0 4 0 0 4
04-09-2013 0 0 8 0 0 8
04-09-2013 0 0 2 0 0 8
04-09-2013 0 0 3 0 0 4
04-09-2013 0 0 1 0 0 8
04-09-2013 0 0 5 0 0 8

It is just sample of huge data. For every day there are 6 columns, shows the 6 difference process instances.

I have to pick maximum number of instances for each day and plot it on graph.

like on 03 Sep for process 3 there are 6 instances, on 4 sept there are 8 instances like that i have to pick maximum number of instances for each date and plot a graph with 6 different lines depicting instances for each process.

Problem: I am writing code in Shell script, how do i get maximum number of instances for each process for each day. Is there a way to build data structure and find out. Or Do I need to use Python or Perl? if so, please guide. All these scripting languages are completely new to me.

2) How do I plot using gnuplot. example

03-09-2013 2 0 2 3 0 7
04-09-2013 6 0 4 2 0 12
05-09-2013 7 0 6 1 0 14

My graph should have dates in X-Axis, no. of process in Y-Axis. each line for each instance, 6 lines for 6 instances.

4
  • Are these data all in one file, or spread across one per day? Commented Jun 3, 2014 at 3:36
  • Actually spread across multiple files, but i wrote a script to process all the data into 1 file. Commented Jun 3, 2014 at 3:45
  • From your data example I don't see how you get e.g. 6 instances for process 1 on Sep 3rd. Is is just the sum over all values in one column for the same date (and there are more data points for this day)? BTW: Please use Ctrl+K (indentation by 4 spaces) to mark data or code blocks. That eases copying for testing. Commented Jun 3, 2014 at 7:25
  • @Christoph update the question,it was huge data just added proper data for making it more clear to understand Commented Jun 3, 2014 at 11:00

1 Answer 1

2

I can answer the second question (more information is needed for the first part).

With a data file like

03-09-2013 2 0 2 3 0 7
04-09-2013 6 0 4 2 0 12
05-09-2013 7 0 6 1 0 14

You can plot it with

set xdata time
set timefmt "%m-%d-%Y"
plot for [ii=1:6] 'data.dat' using 1:ii title 'Instance '.ii

Or replace the plot for with something like

plot 'data.dat' using 1:2 title 'Instance 1', \
'data.dat' using 1:3 title 'Instance 2', \
'data.dat' using 1:4 title 'Instance 3', \
'data.dat' using 1:5 title 'Instance 4', \
'data.dat' using 1:6 title 'Instance 5', \
'data.dat' using 1:7 title 'Instance 6'
Sign up to request clarification or add additional context in comments.

1 Comment

it seems OP's date format is "%d-%m-%Y" if I'm not mistaken.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.