Simple 2D bar graph

Simple 2D bar graph

Post by M. Farrenko » Thu, 15 Oct 1998 04:00:00



This most certainly won't challenge the deep capabilities of gnuplot.
However ...

I'm looking to take a group of data (in this case, four entries per week)
and draw it on a simple bar chart.  Data range is 0-100, and it's going to
be over 35 weeks.  What I'd like to do is:

100 -|
     |
 90 -|
     | #
 80 -| ##    #
     | ##    ## #
 70 -| ##    ## #
     | ##    ## #
 60 -| ##    ## #
     | ## #  ## #
 50 -| ## #  ## #
     | ## #  ####
 40 -| ## #  ####
     | ## #  ####
 30 -| ####  ####
     | ####  ####
 20 -| ####  ####
     | ####  ####
 10 -| ####  ####
     | ####  ####
  0 -| ####  ####
     +--------------
      Week1 Week2 ...

But right now, it's stacking the data all on top of each other, and going
off the top of the chart.

I could get away with treating each entry like a separate week, of sorts.
(i.e. entry 1 week 1 x=1, entry 2 week 1 x=2, etc.), but I'd prefer to do it
in the above format.

Also, is there any way to get it to fill in the bars that it plots?  I've
looked through some of the web-based resources, but haven't found anything.
Most everyone else seems to want to do complicated data, like sin(x) and
cos(x) and tan(x) and other such things. :-)

Running stock 3.50.1.17 that came with RedHat Linux 4.1, but I just
downloaded pre-3.6beta347pl4.  Haven't compiled it yet.

Any assistance would be most appreciated.  Thanks.

Matt Farrenkopf

--
==========================================================================
"Why put fault tolerance in the OS, when it's already built into the User?"
        - Steve Shaw, comp.os.linux.advocacy, on the apparent lack of
          fault tolerance in MS Windows-series of OS's.

 
 
 

Simple 2D bar graph

Post by Bernhard Reit » Thu, 15 Oct 1998 04:00:00




Quote:} I'm looking to take a group of data (in this case, four entries per week)
} and draw it on a simple bar chart.  Data range is 0-100, and it's going to
} be over 35 weeks.  What I'd like to do is:
}
} 100 -|
}      |
}  90 -|
}      | #
}  80 -| ##    #
}      | ##    ## #
}  70 -| ##    ## #
}      | ##    ## #
}  60 -| ##    ## #
}      | ## #  ## #
}  50 -| ## #  ## #
}      | ## #  ####
}  40 -| ## #  ####
}      | ## #  ####
}  30 -| ####  ####
}      | ####  ####
}  20 -| ####  ####
}      | ####  ####
}  10 -| ####  ####
}      | ####  ####
}   0 -| ####  ####
}      +--------------
}       Week1 Week2 ...
}
} But right now, it's stacking the data all on top of each other, and going
} off the top of the chart.
}
} I could get away with treating each entry like a separate week, of sorts.
} (i.e. entry 1 week 1 x=1, entry 2 week 1 x=2, etc.), but I'd prefer to do it
} in the above format.

I do not understand, what kind of format  you do want to plot how,
but using the gnuplot 3.6b capabilites of "plot" with "using"
should help you. (Like plot "data.dat" using 0:1, "" using ($0+1):2

Quote:} Also, is there any way to get it to fill in the bars that it plots?  I've
} looked through some of the web-based resources, but haven't found anything.

Two workarounds exist. Look at my webresource:
http://http://www.usf.Uni-Osnabrueck.DE/~breiter/tools/gnuplot/barcha...

Quote:} Running stock 3.50.1.17 that came with RedHat Linux 4.1, but I just
} downloaded pre-3.6beta347pl4.  Haven't compiled it yet.

3.6b is the beter choise.

        Bernhard

 
 
 

Simple 2D bar graph

Post by M. Farrenko » Fri, 16 Oct 1998 04:00:00



Quote:>I do not understand, what kind of format  you do want to plot how,
>but using the gnuplot 3.6b capabilites of "plot" with "using"
>should help you. (Like plot "data.dat" using 0:1, "" using ($0+1):2

I've found what I consider a rather kludgy way of doing it, but I just
assign the first entry for the first week to 0.2 on the x-axis, then the
second entry to 0.4, then 0.6 and 0.8.  To start the next set of data, I
start with 1.2, etc.  This provides the appropriate grouping for the data,
with the desired space in-between.  I also saw another message in here about
using labels for the tic marks on the x-axis, so that's working well now
too.

Quote:>} Also, is there any way to get it to fill in the bars that it plots?  I've
>} looked through some of the web-based resources, but haven't found anything.
>Two workarounds exist. Look at my webresource:
>http://http://www.usf.Uni-Osnabrueck.DE/~breiter/tools/gnuplot/barcha...

Thank you.  I'll look into this.

Quote:>} Running stock 3.50.1.17 that came with RedHat Linux 4.1, but I just
>} downloaded pre-3.6beta347pl4.  Haven't compiled it yet.
>3.6b is the beter choise.

As soon as I get a chance to compile it, I will.  Thanks for the
information.

Matt

--
==========================================================================
"Why put fault tolerance in the OS, when it's already built into the User?"
        - Steve Shaw, comp.os.linux.advocacy, on the apparent lack of
          fault tolerance in MS Windows-series of OS's.

 
 
 

1. Simple bar graphs

Greetings,

I'm trying to write a simple graph that would have labels with names of
machines along the X-axis and the hours these machines have been up on
the Y-axis, and a bar graph for each machine that corresponds to the
time on the Y-axis.

I can figure most of gnuplot, but what I don't understand is how it uses
the columns.  Example:

[foo.gnuplot]
set encoding iso_8859_1
set data style boxes

set xrange [0:6]
set xtic ("" 0, "" 1, "" 2, "" 3, "" 4 , "" 5 , "" 6)
set ytic 5
set label 1 "one" at 0.5, graph -0.05, 0 centre norotate
set label 2 "two" at 1.5, graph -0.05, 0 centre norotate
set label 3 "three" at 2.5, graph -0.05, 0 centre norotate
set label 4 "and more" at 3.5, graph -0.05, 0 centre norotate
set label 5 "what?" at 4.5, graph -0.05, 0 centre norotate
set label 6 "probe" at 5.5, graph -0.05, 0 centre norotate

set ylabel "Votes" 0.000000,0.000000  ""

set term fig  metric color big
set output "play.fig"

set title "BarChartDemo"
set boxwidth 0.25
plot "play.dat" using 1:2 title "yes" linetype 2

[play.dat]
2     10
3     100

The following generates one bar that goes upto 100 on the Y-axis.  My
question is, why do I need two lines to generate it?  Why can't I just
supply 2 and 10 or 3 and 100 and have it generate a bar?

Also, if I modify play.dat to look like this:

[play.dat]
2     10
3     100
2     54

It generates two bars.  Why is that?  I'm really confused about how the
columns work as you can see.  What I want to be able to do is the
following:

Generate a bar (each of _different_ linetype, with different title) for
every name on the X-axis (i.e. from play.gnuplot it would be "one",
"two", "three", "and more", "probe") that corresponds to a number on the
Y-axis (that number should really be a time.. so how can I represent
this?  I simply want a graph that shows how long a machine has been up
using bars).

I've looked at all the demos, especially using.demo, but I still don't
understand the columns.

Sorry if this was confusing, but I'm just very confused about gnuplot's
columns.

Thanks a lot!
 -- John

Sent via Deja.com http://www.deja.com/
Before you buy.

2. Help: RAW format

3. 2D or 3D bar graphs?

4. Cross Platform monitor use

5. NewBie-Graphs with VML basic algo for making simple graph's

6. Info on graphic ic from Tseng Labs ?

7. Need help w/ simple simple 2D thing

8. Removing background..how do I do it?

9. SW to draw 2D graph from 2D grid needed

10. Need scriptable utility to generate bar/line graphs (gif/jpeg format)

11. How to get real time animated bar graph?

12. Drawing bar or xy graphs

13. Help on Basics ... Moving Bar Graph