![margin cheatsheet](images/plot_margin.PNG)
#or
<img src="images/plot_margin.PNG"/>
reference: www.r-graph-gallery.com
http://vis.supstat.com/2013/04/plotting-symbols-and-color-palettes/
http://www.sthda.com/english/wiki/visualize-correlation-matrix-using-correlogram
plot with missing value: http://stackoverflow.com/questions/22000630/corrplot-machinedouble-eps-missing-value
https://rpubs.com/gaston/dendrograms
http://www.sigmath.es.osaka-u.ac.jp/shimo-lab/prog/pvclust/
hc <- hclust(dist(USArrests[1:7,]), "ave")
#--------- plot
suppressMessages(library(dendextend))
dend1 <- as.dendrogram(hc)
cutree(dend1,h=70) # it now works on a dendrogram with dendextend library
## Alabama Alaska Arizona Arkansas California Colorado
## 1 1 1 2 1 2
## Connecticut
## 3
#--------- plot
clus5 = cutree(hc, 5)
plot(hc, xlab = ""
, hang = -1 # set label height
)
rect.hclust(hc, h=70, border="blue")
rect.hclust(hc, h=30, border="red")
legend("topright", "(x,y)"
, c("Strong relation - red", "Good relation - blue") # add text
, text.col=c("red", "blue")
, lty=-1 , pch=NA # set lyt and pch to remove the legend symbols
)
x<- 1:10
y1 <- sample(seq(1:50), 10)
y2 <- sample(seq(100:200), 10)
# all sides have 2 lines of space margin to give space for axis on the right
par(oma=c(2,2,2,2))
# first plot
plot(x=x, y=y1, type="l", col="red")
# tell R to draw over the first plot
par(new=T)
# do second plot
plot(x=x, y=y2, type ="l", ylab="", yaxt='n' )
axis(4, (range(y2)), ylab='y2') # draw second axis on the right
mtext("y2", side=4, line=2.3, adj=0.5, cex=1) # add test label on the right
las: 0: always parallel to the axis [default], 1: always horizontal, 2: always perpendicular to the axis, 3: always vertical.
Producing Simple Graphs with R : http://www.harding.edu/fmccown/r/
http://personality-project.org/r/r.plottingdates.html
Hmisc http://rgm2.lab.nig.ac.jp/RGM2/func.php?rd_id=Hmisc:Ecdf
heatmap-or-plot-for-a-correlation-matrix http://stackoverflow.com/questions/15887212/heatmap-or-plot-for-a-correlation-matrix