[R] Need a suggestion on a package to make a figure

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Sat May 9 13:26:28 CEST 2020


Hi again,
Oops, you'll need the images as well. Save the HTML file and images to
the same directory.

Jim

On Sat, May 9, 2020 at 9:24 PM Jim Lemon <drjimlemon using gmail.com> wrote:
>
> Hi Aiguo
> Just for fun, I tried to work out what you wanted. I think you are
> looking for a function that creates a horizontal stacked bar image of
> a logical vector:
>
> TFbar<-function(x,file="TFbar",grDev="png",width=100,height=25,
>  col=c("green","red")) {
>
>  do.call(grDev,
>   list(file=paste(file,grDev,sep="."),width=width,height=height))
>  par(xaxs="i",mar=c(0,0,0,0))
>  plot(0,xlim=c(1,width),ylim=c(1,height),type="n",axes=FALSE)
>  Twidth<-width*sum(x)/length(x)
>  Fwidth<-width-Twidth
>  rect(1,1,Twidth,height,col=col[1])
>  rect(Twidth,1,width,height,col=col[2])
>  dev.off()
>  return(Twidth/width)
> }
>
> To instantiate this with your example:
>
> TFnames<-paste0("Pathway",1:4)
> for(i in 1:4) {
>  assign("x",sample(c(TRUE,FALSE),100,TRUE))
>  TFbar(x,TFnames[i])
> }
> TFtags<-paste0("<img src=",TFnames,".png>")
> TFdf<-data.frame(GO_Terms=TFnames,S1=TFtags,stringsAsFactors=FALSE)
> library(prettyR)
> delim.table(TFdf,filename="TFtable.htm",leading.delim=FALSE,
>  label="",html=TRUE,show.rownames=FALSE)
>
> Sadly, I found a bug in delim.table that will be corrected in the next
> version. The attached HTML file shows the table you get with the
> corrected version.
>
> Jim
>
> On Sat, May 9, 2020 at 12:50 AM aiguo li via R-help
> <r-help using r-project.org> wrote:
> >
> > Hello all,
> > I need to make a table with a value imaged by greater than certain value as attached.  Could you give me a suggestions on which R package will be good for this type of table?
> > Thanks and stay safe!
> > Aiguo______________________________________________
> > R-help using 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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Pathway1.png
Type: image/png
Size: 169 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20200509/3837b0d1/attachment.png>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Pathway2.png
Type: image/png
Size: 167 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20200509/3837b0d1/attachment-0001.png>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Pathway3.png
Type: image/png
Size: 168 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20200509/3837b0d1/attachment-0002.png>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Pathway4.png
Type: image/png
Size: 170 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20200509/3837b0d1/attachment-0003.png>


More information about the R-help mailing list