搜索
查看: 2459|回复: 0

ggplot调整标度-scale

[复制链接]

365

主题

512

帖子

1713

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1713
发表于 2017-5-10 10:55:07 | 显示全部楼层 |阅读模式
本帖最后由 ydchen 于 2017-5-10 10:59 编辑

理解一件事很有趣:
每个变量对应的标度都是有legend可以调整的,色彩,颜色,大小,形状,通通可以调整:
[mw_shl_code=applescript,true]bp + scale_fill_discrete(name="Experimental\nCondition")

bp + scale_fill_discrete(name="Experimental\nCondition",
                         breaks=c("ctrl", "trt1", "trt2"),
                         labels=c("Control", "Treatment 1", "Treatment 2"))

# Using a manual scale instead of hue
bp + scale_fill_manual(values=c("#999999", "#E69F00", "#56B4E9"),
                       name="Experimental\nCondition",
                       breaks=c("ctrl", "trt1", "trt2"),
                       labels=c("Control", "Treatment 1", "Treatment 2"))[/mw_shl_code]




Kinds of scales
There are many kinds of scales. They take the form scale_xxx_yyy. Here are some commonly-used values of xxx and yyy:
xxx
Description
colourColor of lines and points
fillColor of area fills (e.g. bar graph)
linetypeSolid/dashed/dotted lines
shapeShape of points
sizeSize of points
alphaOpacity/transparency



yyy
Description
hueEqually-spaced colors from the color wheel
manualManually-specified values (e.g., colors, point shapes, line types)
gradientColor gradient
greyShades of grey
discreteDiscrete values (e.g., colors, point shapes, line types, point sizes)
continuousContinuous values (e.g., alpha, colors, point sizes)
Changing the factor in the data frame
Another way to change the legend title and labels is to directly modify the data frame.




上一篇:Meta分析第一步收集数据咯
下一篇:git第6天
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|生信技能树 ( 粤ICP备15016384号  

GMT+8, 2020-3-31 10:45 , Processed in 0.019734 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.