[R] ggplot stat_bin question

Thierry Onkelinx thierry.onkelinx at inbo.be
Wed Jun 3 09:31:35 CEST 2015


Dear Glenn,

Your code contains a typo: it has bindwidth instead of binwidth. Fixing
that will no longer show the message. AFAIK, the message is always
displayed when binwidth is not set. You can use suppressMessages() to hide
them.

Best regards,

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2015-06-03 2:32 GMT+02:00 Glenn Schultz <glennmschultz op me.com>:

> All,
>
> I am using gglpot to produce combination density and histogram plots,
> which are actually kinda cool, everything works well and the plots look
> nice.  However after each plot run I receive the following message:
>
> stat_bin: binwidth defaulted to range/30. Use 'bin width = x' to adjust
> this.
>
> Below is the code I used to create the graph.  I think I am pretty much
> following the examples in Hadley's ggplot2 book and really just need to
> eliminate the message as the graphs look fine.  Any suggestions are
> appreciated.
>
> Best Regards,
> Glenn
>
>   Mdur.dist <- ggplot(OAS.Mdur, aes(x = value )) +
>     geom_density(fill = "#56B4E9", colour = "#56B4E9", alpha = .6) +
>     geom_histogram(aes(y =..density..), color = "lightgrey", fill =
> "#0072B2", bindwidth = .01) +
>     theme_minimal() +
>     #scale_x_continuous(breaks = seq(80,120, 5)) +
>     labs(title = "Mod. Duration Distribution") +
>     ylab("Density")+
>     xlab("Path Mod. Duration") +
>     theme(panel.grid.major = element_line(size = .25, color = "grey")) +
>     theme(axis.text = element_text(size = 15)) +
>     theme(axis.title = element_text(size = 20)) +
>     theme(legend.position = "none")
>
> ______________________________________________
> R-help op r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

	[[alternative HTML version deleted]]



More information about the R-help mailing list