gnuplot and categorical data

  • Follow


Hello

I don't find any sure answer: is gnuplot supporting or not categorical
data chart ?

I want to plot a chart with datetime as x-axis and multiple groups of
steps plot on y-axis. Each group is a categorical dataset with multiple
fixed values (event state)

The only reference i found is
http://newsgroups.derkeiler.com/Archive/Comp/comp.graphics.apps.gnuplot/2008-04/msg00185.html
which seems to imply no support

Nothing found by google on gnuplot.info

Thanks a lot
Best regards,

	Julien

note: if there is some support, a link or some example would be
appreciated. Have a merry christmas ! :-)

0
Reply julien.t43NOSPAM (2) 12/24/2009 7:04:41 AM

julien wrote:

> Hello
> 
> I don't find any sure answer: is gnuplot supporting or not categorical
> data chart ?
> 
> I want to plot a chart with datetime as x-axis and multiple groups of
> steps plot on y-axis. Each group is a categorical dataset with
> multiple fixed values (event state)

Sorry. I do not understand what your plot is supposed to look like.
Could you perhaps post a link to an image of such a plot?

> The only reference i found is
> 
http://newsgroups.derkeiler.com/Archive/Comp/comp.graphics.apps.gnuplot/2008
-04/msg00185.html
> which seems to imply no support
> 
> Nothing found by google on gnuplot.info

But the words you are using to search with may not be the
words used by the gnuplot documentation.  That's why we need
an example of the kind of plot you are aiming for.

	Ethan

> 
> Thanks a lot
> Best regards,
> 
> Julien
> 
> note: if there is some support, a link or some example would be
> appreciated. Have a merry christmas ! :-)


0
Reply sfeam 12/24/2009 7:42:08 AM


sfeam wrote on 24/12/09 08:42:
> But the words you are using to search with may not be the
> words used by the gnuplot documentation.  That's why we need
> an example of the kind of plot you are aiming for.
> 

I know this, but have a hard time to found an example chart

image could be like an oscilloscope

http://zovirl.com/2008/11/remote_and_arduino.jpg

x-axis is timedate data
y-axis is categorical data: a list of event state in my case

I want to chart one or multiple datasaet which will share the same
x-axis and with y-axis shifted between the different dataset.

each dataset could have a different list of possible states.
0
Reply julien 12/26/2009 7:35:21 PM

Hi!

julien wrote:
> sfeam wrote on 24/12/09 08:42:
>> But the words you are using to search with may not be the
>> words used by the gnuplot documentation.  That's why we need
>> an example of the kind of plot you are aiming for.
>>
> 
> I know this, but have a hard time to found an example chart
> 
> image could be like an oscilloscope
> 
> http://zovirl.com/2008/11/remote_and_arduino.jpg
> 
> x-axis is timedate data
> y-axis is categorical data: a list of event state in my case
> 
> I want to chart one or multiple datasaet which will share the same
> x-axis and with y-axis shifted between the different dataset.

reset
offset=10.5
plot "datafile" u 1:2 w lines, "" u 1:($3+offset) w lines


plots your datafile, x-axis is in 1. column, 2. column your y-data, 3.
column other y-data shifted by offset

HTH
Stefan
0
Reply Stefan 12/26/2009 9:39:25 PM

Stefan Nowy wrote on 26/12/09 22:39:
> reset
> offset=10.5
> plot "datafile" u 1:2 w lines, "" u 1:($3+offset) w lines
> 
> 
> plots your datafile, x-axis is in 1. column, 2. column your y-data, 3.
> column other y-data shifted by offset

not sure to understand.

My current datafiles are like

Dec 14 01:00:00,state1
Dec 14 14:00:00,state2
Dec 14 18:00:00,state1
Dec 15 14:00:00,state3

or

Dec 14 01:00:00,group1,labelA,state1
Dec 14 14:00:00,group2,labelB,state2
Dec 14 18:00:00,group1,labelC,state4
Dec 15 14:00:00,group3,labelD,state3

I need to:

* make gnuplot respect timeline scale
set xdata time
set format x "%d\n%H:%M"
set timefmt "%?m %d %H:%M:%S"

cf. http://www.gnuplot.info/docs/gnuplot.html#Time%2fDate_data

* place each state/categorical data on an y-axis, eventually with a
defined order ?

pseudo code could be

- for first dataset:
set format y ?categorical
plot "datafile" using 1:2 with steps,

- for second one:
set format y ?categorical
plot "datafile" using 1:4 with steps label col3 group by col2,



thanks a lot for your help Stefan

0
Reply julien 12/27/2009 10:22:49 AM

nobody on this ?

thanks

julien wrote on 27/12/09 11:22:
> 
> My current datafiles are like
> 
> Dec 14 01:00:00,state1
> Dec 14 14:00:00,state2
> Dec 14 18:00:00,state1
> Dec 15 14:00:00,state3
> 
> or
> 
> Dec 14 01:00:00,group1,labelA,state1
> Dec 14 14:00:00,group2,labelB,state2
> Dec 14 18:00:00,group1,labelC,state4
> Dec 15 14:00:00,group3,labelD,state3
> 
> I need to:
> 
> * make gnuplot respect timeline scale
> set xdata time
> set format x "%d\n%H:%M"
> set timefmt "%?m %d %H:%M:%S"
> 
> cf. http://www.gnuplot.info/docs/gnuplot.html#Time%2fDate_data
> 
> * place each state/categorical data on an y-axis, eventually with a
> defined order ?
> 
> pseudo code could be
> 
> - for first dataset:
> set format y ?categorical
> plot "datafile" using 1:2 with steps,
> 
> - for second one:
> set format y ?categorical
> plot "datafile" using 1:4 with steps label col3 group by col2,
> 
> 
> 
> thanks a lot for your help Stefan
> 

0
Reply julien 1/3/2010 3:34:35 PM

julien wrote:

> 
> nobody on this ?

I still don't understand what is special about your "categorical" plot.
The example you pointed to 
(http://zovirl.com/2008/11/remote_and_arduino.jpg)
looks like two ordinary graphs stacked on top of each other.
Stefan suggested a way to do this using a single graph containing
two plots.  Otherwise you could use multiplot mode to stack multiple
identically sized graphs.  Or so it seems from the example given.

	Ethan


> 
> thanks
> 
> julien wrote on 27/12/09 11:22:
>> 
>> My current datafiles are like
>> 
>> Dec 14 01:00:00,state1
>> Dec 14 14:00:00,state2
>> Dec 14 18:00:00,state1
>> Dec 15 14:00:00,state3
>> 
>> or
>> 
>> Dec 14 01:00:00,group1,labelA,state1
>> Dec 14 14:00:00,group2,labelB,state2
>> Dec 14 18:00:00,group1,labelC,state4
>> Dec 15 14:00:00,group3,labelD,state3
>> 
>> I need to:
>> 
>> * make gnuplot respect timeline scale
>> set xdata time
>> set format x "%d\n%H:%M"
>> set timefmt "%?m %d %H:%M:%S"
>> 
>> cf. http://www.gnuplot.info/docs/gnuplot.html#Time%2fDate_data
>> 
>> * place each state/categorical data on an y-axis, eventually with a
>> defined order ?
>> 
>> pseudo code could be
>> 
>> - for first dataset:
>> set format y ?categorical
>> plot "datafile" using 1:2 with steps,
>> 
>> - for second one:
>> set format y ?categorical
>> plot "datafile" using 1:4 with steps label col3 group by col2,
>> 
>> 
>> 
>> thanks a lot for your help Stefan
>>

0
Reply sfeam 1/3/2010 7:40:22 PM

sfeam wrote on 03/01/10 20:40:
> julien wrote:
> 
>>
>> nobody on this ?
> 
> I still don't understand what is special about your "categorical" plot.
> The example you pointed to 
> (http://zovirl.com/2008/11/remote_and_arduino.jpg)
> looks like two ordinary graphs stacked on top of each other.
> Stefan suggested a way to do this using a single graph containing
> two plots.  Otherwise you could use multiplot mode to stack multiple
> identically sized graphs.  Or so it seems from the example given.
> 
> 	Ethan

from wikipedia, Categorical (also said nominal)
http://en.wikipedia.org/wiki/Level_of_measurement
http://en.wikipedia.org/wiki/Categorical_data

Categorical Data cannot be measured by numbers, only label. That's why I
put an example dataset

so the problem is
first, chart categorical data
second, chart two one the same graph but probably easy if first is ok.

thanks a lot

	Julien
0
Reply julien 1/4/2010 5:21:39 AM

julien wrote:

> sfeam wrote on 03/01/10 20:40:
>> julien wrote:
>> 
>>>
>>> nobody on this ?
>> 
>> I still don't understand what is special about your "categorical"
>> plot. The example you pointed to
>> (http://zovirl.com/2008/11/remote_and_arduino.jpg)
>> looks like two ordinary graphs stacked on top of each other.
>> Stefan suggested a way to do this using a single graph containing
>> two plots.  Otherwise you could use multiplot mode to stack multiple
>> identically sized graphs.  Or so it seems from the example given.
>> 
>> Ethan
> 
> from wikipedia, Categorical (also said nominal)
> http://en.wikipedia.org/wiki/Level_of_measurement
> http://en.wikipedia.org/wiki/Categorical_data
> 
> Categorical Data cannot be measured by numbers, only label. That's why
> I put an example dataset

If you are plotting it on an x/y plane, then one way or another your
categorical data has to be assigned coordinates. In other words, it
is may not be "measured" by numbers, but in order to be plotted it must
be _represented_ by numbers.

So here's an example using your sample data
  
ycoord(y) = (y eq "labelA") ? 1 : \
            (y eq "labelB") ? 2 : \
            (y eq "labelC") ? 3


plot 'data' using 1:(ycoord(strcol(3))
 

0
Reply sfeam 1/4/2010 5:59:59 AM

sfeam wrote on 04/01/10 06:59:
>> Categorical Data cannot be measured by numbers, only label. That's why
>> I put an example dataset
> 
> If you are plotting it on an x/y plane, then one way or another your
> categorical data has to be assigned coordinates. In other words, it
> is may not be "measured" by numbers, but in order to be plotted it must
> be _represented_ by numbers.

ok

thanks a lot for the help, Ethan.
And best wishes for the new year

	Julien
0
Reply julien 1/4/2010 6:29:13 PM

julien wrote:

> sfeam wrote on 04/01/10 06:59:
>>> Categorical Data cannot be measured by numbers, only label. That's why
>>> I put an example dataset
>> 
>> If you are plotting it on an x/y plane, then one way or another your
>> categorical data has to be assigned coordinates. In other words, it
>> is may not be "measured" by numbers, but in order to be plotted it must
>> be _represented_ by numbers.

I should qualify that, or expand a little bit.
Obviously in order to place a symbol on the plot you need to assign
it a set of [x,y] coordinates.  But the symbol may convey information about
multiple categories.  One category may be indicated by the x-coordinate,
another by the y coordinate, a third by the color, a fourth by the shape,
and a fifth by the size.

In this way gnuplot can represent 5 separate properties (categories)
belonging to a single point on a graph.  But one of these properties must of
course be the y coordinate.  Actually, if it's a 3D plot I suppose you 
can get up to 6 properties per point.   

A partial example is the second plot of
   http://gnuplot.sourceforge.net/demo_cvs/rgb_variable.html
Each point has an x,y, and z coordinate, a color, and a size.
In principle you could vary the shape as well, or attach a label to each
point, but I think the plot commands don't currently allow you to do all
this in a single command.
0
Reply sfeam 1/4/2010 7:46:22 PM

sfeam wrote on 04/01/10 20:46:
> I should qualify that, or expand a little bit.
> Obviously in order to place a symbol on the plot you need to assign
> it a set of [x,y] coordinates.  But the symbol may convey information about
> multiple categories.  One category may be indicated by the x-coordinate,
> another by the y coordinate, a third by the color, a fourth by the shape,
> and a fifth by the size.
> 
> In this way gnuplot can represent 5 separate properties (categories)
> belonging to a single point on a graph.  But one of these properties must of
> course be the y coordinate.  Actually, if it's a 3D plot I suppose you 
> can get up to 6 properties per point.   

thanks for the complement
> 
> A partial example is the second plot of
>    http://gnuplot.sourceforge.net/demo_cvs/rgb_variable.html

impressive. was not thinking that gnuplot could handle this kind of graph.
Problem with 3D graph for me: I think they are hardly useful without
interactivity so except if gnuplot could create interactive svg or vrml,
not usable.

> Each point has an x,y, and z coordinate, a color, and a size.
> In principle you could vary the shape as well, or attach a label to each
> point, but I think the plot commands don't currently allow you to do all
> this in a single command.

ok
these examples with label fit me
http://gnuplot.sourceforge.net/demo_cvs/stringvar.html
0
Reply julien 1/4/2010 11:03:46 PM

Am 04.01.2010, 01:21 Uhr, schrieb julien  
<julien.t43NOSPAM@nospamgmail.com>:


> Categorical Data cannot be measured by numbers, only label. That's why I
> put an example dataset

But you could convert your categories into numbers, for a (stupid)  
example: If the variable "haircolour" has the possible values (blond, red,  
brown, black) you could replace those with (1, 2, 3, 4) and then simply  
label the axis manually (as explained in the gnuplot manual).
0
Reply Dr 1/10/2010 5:58:38 PM

12 Replies
696 Views

(page loaded in 0.111 seconds)

Similiar Articles:


















7/19/2012 4:26:41 PM


Reply: