全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
358 0
2023-08-05
Colour, Size, Shape and Other Aesthetic Attributes
To add additional variables to a plot, we can use other aesthetics like colour,
shape, and size (NB: while I use British spelling throughout this book, ggplot2
also accepts American spellings). These work in the same way as the x and y
aesthetics, and are added into the call to aes():

• aes(displ, hwy, colour = class)
• aes(displ, hwy, shape = drv)
• aes(displ, hwy, size = cyl)
ggplot2 takes care of the details of converting data (e.g., ‘f’, ‘r’, ‘4’) into
aesthetics (e.g., ‘red’, ‘yellow’, ‘green’) with a scale. There is one scale for
each aesthetic mapping in a plot. The scale is also responsible for creating a
guide, an axis or legend, that allows you to read the plot, converting aesthetic
values back into data values. For now, we’ll stick with the default scales
provided by ggplot2.  


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群