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. Java操作文件

    import java.io.File; import java.io.IOException; import java.nio.file.*; import java.nio.file.attrib ...

  2. Jmeter--录制脚本-用户参数化-添加断言

    使用jmeter实现的场景 1.使用badboy录制脚本 2.使用jmeter自带元件进行用户参数化 3.给请求添加断言(给请求添加检查点) 使用badboy录制脚本导入jmeter 1.输入http ...

  3. UVA514 铁轨 Rails:题解

    题目链接:https://www.luogu.org/problemnew/show/UVA514 分析: 入站序列是1-n,入站后判断如果等于出站序列的当前值,则直接出站.否则就在栈里待着不动.模拟 ...

  4. 比赛:小奔的方案 solution

    题目 题目背景 有一个著名的题目: 五个海盗抢到了100个金币,每一颗都一样的大小和价值连城. 他们决定这么分: 1.抽签决定自己的号码 ------ [1.2.3.4.5] 2.首先,由1号提出分配 ...

  5. vijos p1484 ISBN号码

    #include<iostream>#include<string>#include<cctype>using namespace std;int main() { ...

  6. [LeetCode] 107 Binary Tree Level Order Traversal II (easy)

    原题 层序遍历,从自底向上按层输出. 左→右→中 解法一 : DFS,求出自顶向下的,最后返回时反转一下. class Solution { public: vector<vector<i ...

  7. oracle分隔字符串列转行

    1. DEMO: SELECT REGEXP_SUBSTR('1,2', '[^,]+', 1, LEVEL)          FROM DUAL        CONNECT BY REGEXP_ ...

  8. python函数对象-命名空间-作用域-02

    函数对象 函数是第一对象: # 函数名指向的值可以被当做参数传递 函数对象的特性(*****灵活运用,后面讲装饰器会用到) 函数名可以像变量一样被传递 # 变量可以被传递 name = 'jason' ...

  9. MVC设计模式与Java Web经典三层架构

    MVC设计模式 MVC的概念 首先我们需要知道MVC模式并不是javaweb项目中独有的,MVC是一种软件工程中的一种软件架构模式,把软件系统分为三个基本部分:模型(Model).视图(View)和控 ...

  10. python的乘法口诀表

    python的乘法口诀表 python的乘法口诀表 用python来写一个脚本,使得这个脚本在运行后自动输出乘法口诀表. pyton的脚本如下: #!/usr/bin/env python #codi ...