[R] labelling a plot in binom library function call

Pascal Oettli kridox at ymail.com
Wed Apr 2 04:20:40 CEST 2014


Hello,

The "binom" package is using "ggplot2" to plot the density. Thus, you
have to follow the "ggplot2" syntax:

R>  binom.bayes.densityplot(hpdc) + ggtitle("my plot")

HTH
Pascal

On Tue, Apr 1, 2014 at 7:41 AM, Chris <chris.barker at barkerstats.com> wrote:
> Hi, I'm using  a function in the binom library. I'd like to add a title(s) to the plot generated by "binom.bayes.densityplot".
>
> I get an error message when trying to use the title function
> The error message is: "Error in title(main = "my plot") : plot.new has not been called yet" occurs after running the title command".
>
> Example code:
>
> hpdc <- binom.bayes(
> x = 0:10, n = 10, type = "central", conf.level = 0.8, tol = 1e-9)
> print(hpdc)
> binom.bayes.densityplot(hpdc)
> title(main="my plot")
>
>
> I was also unsuccessful in passing a plot title to the function call.
>
> And issuing a "plot.new()" before the title command clears the plot.
>
> Thanks in advance for suggestions.
>
>
>
> Chris Barker, Ph.D.
> Adjunct Associate Professor of Biostatistics - UIC-SPH
> and
> President and Owner
> Statistical Planning and Analysis Services, Inc.
> www.barkerstats.com
> 415 609 7473415 609 7473
> skype: barkerstats
>
>
> Call
> Send SMS
> Add to Skype
> You'll need Skype CreditFree via Skype
>         [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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.
>



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan




More information about the R-help mailing list