need help with stacked histogram

View: New views
5 Messages — Rating Filter:   Alert me  

need help with stacked histogram

by stevecoh1 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

All the samples tend to assume that you are working from a data file
where the header row contains the labels for each piece of the stack.  
That is not the case in my situation.  I want to supply the labels from
each stack in the script.

My script is as follows:

#set terminal png transparent nocrop enhanced size 900 600
#set output 'latest-connections.png'
set title "Database Connections"
set key below
set xdata time
set timefmt "%Y-%m-%d %H:%M"
set format x "%H:%M"
set style data histogram
set style histogram rowstacked
set style fill solid noborder

plot 'latest-connections.dat' using 1 "%Y-%m-%d %H:%M", \
'' using 2 title "A", \
'' using 3 title "B", \
'' using 4 title "C", \
'' using 5 title "D", \
'' using ($6-($2+$3+$4+$5)) title "other"
------------------------------------------

Data File is as follows:

2009-10-17 10:15 5 0 0 22 27
2009-10-17 10:17 5 0 0 8 13
2009-10-17 10:19 5 0 0 8 13
2009-10-17 10:31 5 0 0 13 18
...

Error message is:

 "connections2.gplot", line 17: Please use between 1 and 7 conversions,
of type double (%lf)

Not sure what this means or what I must do to correct it.

Can someone help?

Thanks.




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-info

Re: need help with stacked histogram

by Thomas Sefzick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

you mix xticlabels for histograms and x-axis timedata.
this can not work. and, your column numbering is not
correct.
use following script and see if it does what you expect:

reset
set title "Database Connections"
set key below
set style data histogram
set style histogram rowstacked
set style fill solid noborder
set boxwidth 0.75
plot 'latest-connections.dat' using 3:xtic(2) title "A", \
'' using 4 title "B", \
'' using 5 title "C", \
'' using 6 title "D", '' using ($7-($3+$4+$5+$6)) title "other"

Steve Cohen wrote:
All the samples tend to assume that you are working from a data file
where the header row contains the labels for each piece of the stack.  
That is not the case in my situation.  I want to supply the labels from
each stack in the script.

My script is as follows:

#set terminal png transparent nocrop enhanced size 900 600
#set output 'latest-connections.png'
set title "Database Connections"
set key below
set xdata time
set timefmt "%Y-%m-%d %H:%M"
set format x "%H:%M"
set style data histogram
set style histogram rowstacked
set style fill solid noborder

plot 'latest-connections.dat' using 1 "%Y-%m-%d %H:%M", \
'' using 2 title "A", \
'' using 3 title "B", \
'' using 4 title "C", \
'' using 5 title "D", \
'' using ($6-($2+$3+$4+$5)) title "other"
------------------------------------------

Data File is as follows:

2009-10-17 10:15 5 0 0 22 27
2009-10-17 10:17 5 0 0 8 13
2009-10-17 10:19 5 0 0 8 13
2009-10-17 10:31 5 0 0 13 18
...

Error message is:

 "connections2.gplot", line 17: Please use between 1 and 7 conversions,
of type double (%lf)

Not sure what this means or what I must do to correct it.

Can someone help?

Thanks.




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnuplot-info

Re: need help with stacked histogram

by stevecoh1 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, Thomas - this works - up to a point. The bars display as I
wanted them to.

However, part of the point of my earlier attempt was to get the
time-based x-axis to show recognizable times (17:30, etc.) In this
graph, since there are so many bars so close together, the time values
overwrite each other beneath the x-axis making an unrecognizable line of
black mess. How would I fix this?

Also, unfortunately, the server I ultimately want to run this on runs
RedHat EL which has not released a distro yet that includes Gnuplot 4.2,
and so I am restricted to using 4.0 there. Over there I could ALMOST get
what I like running using the following with the same data. This WORKS
on 4.2, but on 4.0 the largest impulse overwrites all the others so that
only the first impulse is seen.

set title "Database Connections"
set key below
set xdata time
set timefmt "%Y-%m-%d %H:%M"
set format x "%H:%M"
set yrange [0:*]

plot 'latest-connections.dat' using 1:7 title "other" with impulses, \
'latest-connections.dat' using 1:($6+$5+$4+$3) title "A" with impulses, \
'latest-connections.dat' using 1:($5+$4+$3) title "B" with impulses, \
'latest-connections.dat' using 1:($4+$3) title "C" with impulses, \
'latest-connections.dat' using 1:3 title "C" with impulses

Is there a way to do something like this in 4.0? Because I haven't found
it, I am restricted to a messy and somewhat inadquate replacement using
impulses for the whole and points for the parts, which is somewhat
informative but I want it to stack.



Thomas Sefzick wrote:

> you mix xticlabels for histograms and x-axis timedata.
> this can not work. and, your column numbering is not
> correct.
> use following script and see if it does what you expect:
>
> reset
> set title "Database Connections"
> set key below
> set style data histogram
> set style histogram rowstacked
> set style fill solid noborder
> set boxwidth 0.75
> plot 'latest-connections.dat' using 3:xtic(2) title "A", \
> '' using 4 title "B", \
> '' using 5 title "C", \
> '' using 6 title "D", '' using ($7-($3+$4+$5+$6)) title "other"
>
>
> Steve Cohen wrote:
>  
>> All the samples tend to assume that you are working from a data file
>> where the header row contains the labels for each piece of the stack.  
>> That is not the case in my situation.  I want to supply the labels from
>> each stack in the script.
>>
>> My script is as follows:
>>
>> #set terminal png transparent nocrop enhanced size 900 600
>> #set output 'latest-connections.png'
>> set title "Database Connections"
>> set key below
>> set xdata time
>> set timefmt "%Y-%m-%d %H:%M"
>> set format x "%H:%M"
>> set style data histogram
>> set style histogram rowstacked
>> set style fill solid noborder
>>
>> plot 'latest-connections.dat' using 1 "%Y-%m-%d %H:%M", \
>> '' using 2 title "A", \
>> '' using 3 title "B", \
>> '' using 4 title "C", \
>> '' using 5 title "D", \
>> '' using ($6-($2+$3+$4+$5)) title "other"
>> ------------------------------------------
>>
>> Data File is as follows:
>>
>> 2009-10-17 10:15 5 0 0 22 27
>> 2009-10-17 10:17 5 0 0 8 13
>> 2009-10-17 10:19 5 0 0 8 13
>> 2009-10-17 10:31 5 0 0 13 18
>> ...
>>
>> Error message is:
>>
>>  "connections2.gplot", line 17: Please use between 1 and 7 conversions,
>> of type double (%lf)
>>
>> Not sure what this means or what I must do to correct it.
>>
>> Can someone help?
>>
>> Thanks.
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Gnuplot-info mailing list
>> Gnuplot-info@...
>> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>>
>>
>>    
>
>  


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-info

Re: need help with stacked histogram

by Thomas Sefzick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

you may use boxes instead of impulses:

set title "Database Connections"
set key below
set xdata time
set timefmt "%Y-%m-%d %H:%M"
set format x "%H:%M"
set style fill solid
set boxwidth 60.0
set yrange [0:]
plot 'latest-connections.dat' using 1:7 with boxes title "other", \
'' using 1:($3+$4+$5+$6) with boxes title "D", \
'' using 1:($3+$4+$5) with boxes title "C", \
'' using 1:($3+$4) with boxes title "B", \
'' using 1:($3) with boxes title "A"

but, if the highest impulses overdraw the smaller ones then there
is something wrong with your gnuplot 4.0 installation. i can not
reproduce this behavior here with
G N U P L O T
Version 4.0 patchlevel 0
last modified Thu Apr 15 14:44:22 CEST 2004
System: Linux 2.6.27.29-0.1-pae

Steve Cohen wrote:
Thanks, Thomas - this works - up to a point. The bars display as I
wanted them to.

However, part of the point of my earlier attempt was to get the
time-based x-axis to show recognizable times (17:30, etc.) In this
graph, since there are so many bars so close together, the time values
overwrite each other beneath the x-axis making an unrecognizable line of
black mess. How would I fix this?

Also, unfortunately, the server I ultimately want to run this on runs
RedHat EL which has not released a distro yet that includes Gnuplot 4.2,
and so I am restricted to using 4.0 there. Over there I could ALMOST get
what I like running using the following with the same data. This WORKS
on 4.2, but on 4.0 the largest impulse overwrites all the others so that
only the first impulse is seen.

set title "Database Connections"
set key below
set xdata time
set timefmt "%Y-%m-%d %H:%M"
set format x "%H:%M"
set yrange [0:*]

plot 'latest-connections.dat' using 1:7 title "other" with impulses, \
'latest-connections.dat' using 1:($6+$5+$4+$3) title "A" with impulses, \
'latest-connections.dat' using 1:($5+$4+$3) title "B" with impulses, \
'latest-connections.dat' using 1:($4+$3) title "C" with impulses, \
'latest-connections.dat' using 1:3 title "C" with impulses

Is there a way to do something like this in 4.0? Because I haven't found
it, I am restricted to a messy and somewhat inadquate replacement using
impulses for the whole and points for the parts, which is somewhat
informative but I want it to stack.



Thomas Sefzick wrote:
> you mix xticlabels for histograms and x-axis timedata.
> this can not work. and, your column numbering is not
> correct.
> use following script and see if it does what you expect:
>
> reset
> set title "Database Connections"
> set key below
> set style data histogram
> set style histogram rowstacked
> set style fill solid noborder
> set boxwidth 0.75
> plot 'latest-connections.dat' using 3:xtic(2) title "A", \
> '' using 4 title "B", \
> '' using 5 title "C", \
> '' using 6 title "D", '' using ($7-($3+$4+$5+$6)) title "other"
>
>
> Steve Cohen wrote:
>  
>> All the samples tend to assume that you are working from a data file
>> where the header row contains the labels for each piece of the stack.  
>> That is not the case in my situation.  I want to supply the labels from
>> each stack in the script.
>>
>> My script is as follows:
>>
>> #set terminal png transparent nocrop enhanced size 900 600
>> #set output 'latest-connections.png'
>> set title "Database Connections"
>> set key below
>> set xdata time
>> set timefmt "%Y-%m-%d %H:%M"
>> set format x "%H:%M"
>> set style data histogram
>> set style histogram rowstacked
>> set style fill solid noborder
>>
>> plot 'latest-connections.dat' using 1 "%Y-%m-%d %H:%M", \
>> '' using 2 title "A", \
>> '' using 3 title "B", \
>> '' using 4 title "C", \
>> '' using 5 title "D", \
>> '' using ($6-($2+$3+$4+$5)) title "other"
>> ------------------------------------------
>>
>> Data File is as follows:
>>
>> 2009-10-17 10:15 5 0 0 22 27
>> 2009-10-17 10:17 5 0 0 8 13
>> 2009-10-17 10:19 5 0 0 8 13
>> 2009-10-17 10:31 5 0 0 13 18
>> ...
>>
>> Error message is:
>>
>>  "connections2.gplot", line 17: Please use between 1 and 7 conversions,
>> of type double (%lf)
>>
>> Not sure what this means or what I must do to correct it.
>>
>> Can someone help?
>>
>> Thanks.
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Gnuplot-info mailing list
>> Gnuplot-info@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>>
>>
>>    
>
>  


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnuplot-info

Re: need help with stacked histogram

by stevecoh1 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, thanks, Thomas, for all your help. This technique works, and I'm
not sure why I thought it didn't. It works with impulses too. Working
too hard, I guess. Thanks again.


Thomas Sefzick wrote:

> you may use boxes instead of impulses:
>
> set title "Database Connections"
> set key below
> set xdata time
> set timefmt "%Y-%m-%d %H:%M"
> set format x "%H:%M"
> set style fill solid
> set boxwidth 60.0
> set yrange [0:]
> plot 'latest-connections.dat' using 1:7 with boxes title "other", \
> '' using 1:($3+$4+$5+$6) with boxes title "D", \
> '' using 1:($3+$4+$5) with boxes title "C", \
> '' using 1:($3+$4) with boxes title "B", \
> '' using 1:($3) with boxes title "A"
>
> but, if the highest impulses overdraw the smaller ones then there
> is something wrong with your gnuplot 4.0 installation. i can not
> reproduce this behavior here with
> G N U P L O T
> Version 4.0 patchlevel 0
> last modified Thu Apr 15 14:44:22 CEST 2004
> System: Linux 2.6.27.29-0.1-pae
>
>
> Steve Cohen wrote:
>  
>> Thanks, Thomas - this works - up to a point. The bars display as I
>> wanted them to.
>>
>> However, part of the point of my earlier attempt was to get the
>> time-based x-axis to show recognizable times (17:30, etc.) In this
>> graph, since there are so many bars so close together, the time values
>> overwrite each other beneath the x-axis making an unrecognizable line of
>> black mess. How would I fix this?
>>
>> Also, unfortunately, the server I ultimately want to run this on runs
>> RedHat EL which has not released a distro yet that includes Gnuplot 4.2,
>> and so I am restricted to using 4.0 there. Over there I could ALMOST get
>> what I like running using the following with the same data. This WORKS
>> on 4.2, but on 4.0 the largest impulse overwrites all the others so that
>> only the first impulse is seen.
>>
>> set title "Database Connections"
>> set key below
>> set xdata time
>> set timefmt "%Y-%m-%d %H:%M"
>> set format x "%H:%M"
>> set yrange [0:*]
>>
>> plot 'latest-connections.dat' using 1:7 title "other" with impulses, \
>> 'latest-connections.dat' using 1:($6+$5+$4+$3) title "A" with impulses, \
>> 'latest-connections.dat' using 1:($5+$4+$3) title "B" with impulses, \
>> 'latest-connections.dat' using 1:($4+$3) title "C" with impulses, \
>> 'latest-connections.dat' using 1:3 title "C" with impulses
>>
>> Is there a way to do something like this in 4.0? Because I haven't found
>> it, I am restricted to a messy and somewhat inadquate replacement using
>> impulses for the whole and points for the parts, which is somewhat
>> informative but I want it to stack.
>>
>>
>>
>> Thomas Sefzick wrote:
>>    
>>> you mix xticlabels for histograms and x-axis timedata.
>>> this can not work. and, your column numbering is not
>>> correct.
>>> use following script and see if it does what you expect:
>>>
>>> reset
>>> set title "Database Connections"
>>> set key below
>>> set style data histogram
>>> set style histogram rowstacked
>>> set style fill solid noborder
>>> set boxwidth 0.75
>>> plot 'latest-connections.dat' using 3:xtic(2) title "A", \
>>> '' using 4 title "B", \
>>> '' using 5 title "C", \
>>> '' using 6 title "D", '' using ($7-($3+$4+$5+$6)) title "other"
>>>
>>>
>>> Steve Cohen wrote:
>>>  
>>>      
>>>> All the samples tend to assume that you are working from a data file
>>>> where the header row contains the labels for each piece of the stack.  
>>>> That is not the case in my situation.  I want to supply the labels from
>>>> each stack in the script.
>>>>
>>>> My script is as follows:
>>>>
>>>> #set terminal png transparent nocrop enhanced size 900 600
>>>> #set output 'latest-connections.png'
>>>> set title "Database Connections"
>>>> set key below
>>>> set xdata time
>>>> set timefmt "%Y-%m-%d %H:%M"
>>>> set format x "%H:%M"
>>>> set style data histogram
>>>> set style histogram rowstacked
>>>> set style fill solid noborder
>>>>
>>>> plot 'latest-connections.dat' using 1 "%Y-%m-%d %H:%M", \
>>>> '' using 2 title "A", \
>>>> '' using 3 title "B", \
>>>> '' using 4 title "C", \
>>>> '' using 5 title "D", \
>>>> '' using ($6-($2+$3+$4+$5)) title "other"
>>>> ------------------------------------------
>>>>
>>>> Data File is as follows:
>>>>
>>>> 2009-10-17 10:15 5 0 0 22 27
>>>> 2009-10-17 10:17 5 0 0 8 13
>>>> 2009-10-17 10:19 5 0 0 8 13
>>>> 2009-10-17 10:31 5 0 0 13 18
>>>> ...
>>>>
>>>> Error message is:
>>>>
>>>>  "connections2.gplot", line 17: Please use between 1 and 7 conversions,
>>>> of type double (%lf)
>>>>
>>>> Not sure what this means or what I must do to correct it.
>>>>
>>>> Can someone help?
>>>>
>>>> Thanks.
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>>> is the only developer event you need to attend this year. Jumpstart your
>>>> developing skills, take BlackBerry mobile applications to market and
>>>> stay
>>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>>> http://p.sf.net/sfu/devconference
>>>> _______________________________________________
>>>> Gnuplot-info mailing list
>>>> Gnuplot-info@...
>>>> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>>>>
>>>>
>>>>    
>>>>        
>>>  
>>>      
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Gnuplot-info mailing list
>> Gnuplot-info@...
>> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>>
>>
>>    
>
>  


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gnuplot-info mailing list
Gnuplot-info@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-info