[R] histogram-like plot with two variables

Philipp Pagel p.pagel at wzw.tum.de
Mon Sep 29 13:40:21 CEST 2008

On Mon, Sep 29, 2008 at 04:02:05AM +0200, Jörg Groß wrote:
> Hi,
> I want to plot a binomial propability distribution.
> I know how to generate the data;
>    x <- seq(from=0, to=14, by=1)
>    y <- dbinom(x, 14, 0.7, log = FALSE)
> I tried:
> plot(x,y, type="h")
>   but the bars are very thin -is there a way to define the width?

yes - the lwd parameter controls line width. E.g.:

plot(x,y, type='h', lwd=5)

This is the way I usually plot count data - I prefer this over something
that looks like a normal histogram, because it reminds me that I am
looking at discrete values.


Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany

More information about the R-help mailing list