[R] Generating a Special Histogram
Jim Lemon
drjimlemon at gmail.com
Thu Jan 5 22:31:17 CET 2017
Hi Dan,
This may help if your data is in the format below:
waffle.mat<-matrix(c(rep(NA,14),137,135,rep(NA,6),144,149,
rep(NA,3),150,152,159,157,154,
NA,163,164,164,161,162,165,164,rep(NA,5),179,173,173,
rep(NA,4),182,180,185,180,
rep(NA,6),197,190,rep(NA,8)),ncol=9)
waffle.col<-matrix("lightblue",ncol=9,nrow=8)
waffle.col[is.na(waffle.mat)]<-NA
waffle.border<-matrix("blue",ncol=9,nrow=8)
waffle.border[is.na(waffle.mat)]<-NA
library(plotrix)
# use a waffle plot
color2D.matplot(waffle.mat,cellcolors=waffle.col,border=waffle.border,
show.values=TRUE,xat=10,yat=10,xlab="",ylab="")
axis(1,at=1:8,labels=seq(130,200,by=10))
axis(2,at=1:8)
axis.break(1)
Jim
On Fri, Jan 6, 2017 at 3:01 AM, Dan Abner <dan.abner99 at gmail.com> wrote:
> Hi all,
>
> Is anyone aware of a package, function, or general R trick that would make
> generating histograms like the one in the attachment easy in R (i.e.,
> without manually drawing each individual horizontal line and specifying the
> coordinates for a textbox for each number)?
>
> I need to make ~12 of these for different samples of n=25, so the manual
> approach would be very painful...
>
> Thanks,
>
> Dan
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list