R语言学习记录-图形篇

1.坐标轴坐标方向
**las **represents the style of axis labels.
(0=parallel, 1=all horizontal, 2=all perpendicular to axis, 3=all vertical)

plot(x,y,las=1)

2.生成一些列的颜色

>cm.colors(10, alpha = 1)
[1] "#80FFFFFF" "#99FFFFFF" "#B2FFFFFF" "#CCFFFFFF" "#E6FFFFFF" "#FFE6FFFF"
[7] "#FFCCFFFF" "#FFB2FFFF" "#FF99FFFF" "#FF80FFFF"
>rainbow(n, s = 1, v = 1, start = 0, end = max(1, n - 1)/n, alpha = 1)
>heat.colors(n, alpha = 1)
>terrain.colors(n, alpha = 1)
>topo.colors(n, alpha = 1)
>cm.colors(n, alpha = 1)
  1. 画颜色梯度条
library(RColorBrewer)

color.bar <- function(lut, min, max=-min, nticks=11, ticks=seq(min, max, len=nticks), title='') 
{ 
    scale = (length(lut)-1)/(max-min) 
    dev.new(width=1.75, height=5) 
    plot(c(0,10), c(min,max), type='n', bty='n', xaxt='n', xlab='', yaxt='n',   ylab='', main=title) 
     axis(2, ticks, las=1) 
    for (i in 1:(length(lut)-1)) { 
        y = (i-1)/scale + min rect(0,y,10,y+1/scale, col=lut[i], border=NA) 
    } 
}

color.bar(colorRampPalette(c("light green", "yellow", "orange", "red"))(100), -1)

http://stackoverflow.com/questions/9314658/colorbar-from-custom-colorramppalette</code> http://www.colbyimaging.com/wiki/statistics/color-bars </blockquote>

4.多个图形置于一张图

par(mfrow=c(2,2))

5.Text and Symbol Size

option description
cex number indicating the amount by which plotting text and symbols should be scaled relative to the default. 1=default, 1.5 is 50% larger, 0.5 is 50% smaller, etc.
cex.axis magnification of axis annotation relative to cex
cex.lab magnification of x and y labels relative to cex
cex.main magnification of titles relative to cex
cex.sub magnification of subtitles relative to cex

6.

7.

8.

9.

10.

11.

12.

13.

http://blog.revolutionanalytics.com/2009/01/10-tips-for-making-your-r-graphics-look-their-best.html

CHENTONG
版权声明:本文为博主原创文章,转载请注明出处。
alipay.png WeChatPay.png

CHENTONG

CHENTONG
积微,月不胜日,时不胜月,岁不胜时。凡人好敖慢小事,大事至,然后兴之务之。如是,则常不胜夫敦比于小事者矣!何也?小事之至也数,其悬日也博,其为积也大。大事之至也希,其悬日也浅,其为积也小。故善日者王,善时者霸,补漏者危,大荒者亡!故,王者敬日,霸者敬时,仅存之国危而后戚之。亡国至亡而后知亡,至死而后知死,亡国之祸败,不可胜悔也。霸者之善著也,可以时托也。王者之功名,不可胜日志也。财物货宝以大为重,政教功名者反是,能积微者速成。诗曰:德如毛,民鲜能克举之。此之谓也。

生信宝典文章集锦

### 程序学习心得* [生物信息之程序学习](http://mp.weixin.qq.com/s?__biz=MzI5MTcwNjA4NQ==&mid=2247483927&idx=1&sn=23adf2b9d13400f2081f790e674e...… Continue reading

R统计绘图 - 柱状图

Published on August 12, 2017

R 学习 - 维恩图

Published on August 01, 2017