Skip to content

Forcing hist()

2 messages · Par Leijonhufvud, Marc Schwartz (via MN)

#
I'm trying to create histogram (using hist()) that fullfill the following
criteria:

        * data is on a ordinal scale (1, 2, 3, 4, 5)
        * I want bars centered over the number on the x-axis
        * I want 5 bars of equal width

I have tried various versions of the hist() command, with no luck. what
am I missing?

/Par
#
On Wed, 2005-09-14 at 20:17 +0200, Par Leijonhufvud wrote:
More than likely, you want to use barplot() and not hist():

Try:

  barplot(1:5, names.arg = 1:5)

See ?barplot for more information.

HTH,

Marc Schwartz

P.S. To R Core: It probably makes sense to add barplot to the See Also
section of ?hist, since hist is listed in the See Also for ?barplot.