corrgram
corrgram copied to clipboard
Labels getting corrupted
Hello,
I created a corrgram off some network captures. However, the text labels are getting cropped.
I played around with the angles but it does not solve the issue. Any ideas on what is causing or how to correct?

Code utilized:
corrgram(df_stats, order=NULL, lower.panel=panel.shade,
upper.panel=NULL, text.panel=panel.txt,label.srt=5,
main="PCAP variables Correlation")
Here's an example that shows how to prevent text from being clipped:
# diagonal labels unclipped.
require(corrgram)
require('grid')
require('gridBase')
unclipped.txt <- function(x=0.1, y=0.5, txt, cex, font, srt){
vps <- gridBase::baseViewports()
vps$figure$clip <- NA # Hack. Do NOT clip text that falls outside the ploting region
pushViewport(vps$inner) # Figure region
pushViewport(vps$figure) # The diagonal box region
grid.text(txt, x=0.1, y=y, just='left', gp=gpar(cex=cex))
popViewport(2)
}
corrgram(mtcars[2:6], order=TRUE,
labels=c("Cylinders","Displacement","Horsepower","Axle ratio","Weight"),
cex.labels=2, adj=0,
upper.panel=NULL, lower.panel=panel.conf,
diag.panel=NULL, text.panel=unclipped.txt)
