[R] histogram-like plot with two variables

Greg Snow Greg.Snow at imail.org
Mon Sep 29 19:28:55 CEST 2008


An added note, if you use this approach, then you should probably set the lend parameter as well (becomes more important with wider lines).  See ?par and scroll down to lend for options/details.

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Philipp Pagel
> Sent: Monday, September 29, 2008 5:40 AM
> To: r-help at r-project.org
> Subject: Re: [R] histogram-like plot with two variables
>
> 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.
>
> cu
>         Philipp
>
> --
> Dr. Philipp Pagel
> Lehrstuhl für Genomorientierte Bioinformatik
> Technische Universität München
> Wissenschaftszentrum Weihenstephan
> 85350 Freising, Germany
> http://mips.gsf.de/staff/pagel
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list