The way to check the color and coreponding value pairs in ggplot2

To see what colors are used to make your plot you can use function ggplot_build() and then look at data part of this object (in column colour are codes).

p <- ggplot(df, aes(x = value, y = value, color = type)) +
geom_point(shape = 21, size = 4) ggplot_build(p)$data
# [[1]]
# colour x y PANEL group
# 1 #F8766D 1 1 1 1
# 2 #B79F00 2 2 1 2
# 3 #00BA38 3 3 1 3
# 4 #00BFC4 4 4 1 4
# 5 #619CFF 5 5 1 5
# 6 #F564E3 6 6 1 6

ggplot2 position parameter usage :

ggplot(data = diamonds + geom_bar(mapping = aes(x = cut, fill = clarity),
position = "identity",alpha = 1/5) +
geom_bar(aes(x = cut, fill = clarity), position = "dodge")

  

ggplot2: how to check the color and coreponding value pairs的更多相关文章

  1. [R可视化]ggplot2库介绍及其实例

    前言 ggplot是一个拥有一套完备语法且容易上手的绘图系统,在Python和R中都能引入并使用,在数据分析可视化领域拥有极为广泛的应用.本篇从R的角度介绍如何使用ggplot2包,首先给几个我觉得最 ...

  2. [CareerCup] 17.2 Tic Tac Toe 井字棋游戏

    17.2 Design an algorithm to figure out if someone has won a game oftic-tac-toe. 这道题让我们判断玩家是否能赢井字棋游戏, ...

  3. shell example01

    条件判断 if [[ -e ${1} ]]; then echo "$(tput setaf 2) found ${1} $(tput sgr0)" cat ${1} else e ...

  4. Designing for iOS: Graphics & Performance

    http://robots.thoughtbot.com/designing-for-ios-graphics-performance  [原文] In the previous article, w ...

  5. 扩展jquery的选择器

    I’m sure you all know that it’s possible to create plugins and extend various aspects of the jQuery ...

  6. Yii2 捕获错误日志

    在技术开发中,捕获程序框架错误,是非常必要的一件事情,我们公司使用Yii2框架,简单说下Yii2的错误捕获处理 Yii2 web应用 1 配置如下 其中errorHandler就是错误处理配置,执行E ...

  7. js正则表达式进行格式校验

    今天做了个js正则表达式的练习,利用正则表达式进行注册信息格式验证,注册信息界面如下: 格式要求: 1.学号项不能为空,必须为纯数字,不能与数据库中的重复,正则表达式/^\d+$/g: 2.姓名项不能 ...

  8. php随机验证码

    今天同学问我,用php怎么写验证码,由于是新手所以花了半天的时间才完成.而且功能很是简单呵呵.今天本来打算写session和cookie的看来是要明天了. <?php $image_width= ...

  9. [Angular 2] @Input & @Output Event with ref

    The application is simple, to build a color picker: When click the rect box, it will check the color ...

随机推荐

  1. 深度解密Go语言之channel

    目录 并发模型 并发与并行 什么是 CSP 什么是 channel channel 实现 CSP 为什么要 channel channel 实现原理 数据结构 创建 接收 发送 关闭 channel ...

  2. C#3.0新增功能09 LINQ 基础05 使用 LINQ 进行数据转换

    连载目录    [已更新最新开发文章,点击查看详细] 语言集成查询 (LINQ) 不只是检索数据. 它也是用于转换数据的强大工具. 通过使用 LINQ查询,可以使用源序列作为输入,并通过多种方式对其进 ...

  3. 利用gcc编译链接时出现 ‘undefined reference to `std::ios_base::Init::Init()’ 解决

    一般编译链接c++程序最好使用g++,若有如上的报错信息,需要在gcc后加上 -lstdc++ eg: gcc test.c -lstdc++ gcc和g++都是GNU的一个编译器. g++:后缀.c ...

  4. [sublime3] 在linux下的终端中使用sublime3打开文件

    通过ln命令创建软连接实现 echo $PATH 查看路径 例 我的路径是: /home/rh/anaconda3/bin:/home/rh/bin:/home/rh/.local/bin:/usr/ ...

  5. hdu6396 Swordsman(贪心)

    Swordsman 题目传送门 解题思路 先将每种属性排序,因为打倒怪兽会使属性增强,所以肯定是能打就打,用cnt[i]记录怪兽i已经被超过的属性数量,如果被超过的属性数为k了,则打倒此怪兽,将获得的 ...

  6. 动态规划_Apple Catching_POJ-2385

    It and ) in his field, each full of apples. Bessie cannot reach the apples when they are on the tree ...

  7. three出现状态200的报错

    报错代码如下: {status: 200, data: {…}} "sa_SpringUserFindOneView_findPbUserByUserId"header.vue?1 ...

  8. python对数据去重处理

    我们在数据处理时,经常需要用到对重复数据进行过滤处理.  对数据去重有两种处理方式,如下: 1.对重复数据去重,并且会自动排序 使用函数  set # 列表去重 list_a = [6, 6, 5, ...

  9. Python3数据驱动ddt

    对于同一个方法执行大量数据的程序时,我们可以采用ddt数据驱动的方式,来对数据规范化整理及输出 一.需要使用python的ddt库,ddt,data,unpack方法 1.仅使用ddt和data,代码 ...

  10. 20190803 NOIP模拟测试12「斐波那契(fibonacci)· 数颜色 · 分组 」

    164分 rank11/64 这次考的不算太差,但是并没有多大的可能性反超(只比一小部分人高十几分而已),时间分配还是不均,T2两个半小时,T1半个小时,T3-额十几分钟吧 然额付出总是与回报成反比的 ...