一、beeswarm作为一维散点图包R包,可以生成点不重复的图,与stripchart的区别就是等值点不会重叠到一起,下图展示了stripchart与beeswarm图的区别:

stripchart(decrease ~ treatment, data = OrchardSprays, vertical = TRUE, log = "y", method = 'jitter', jitter = 0.2, cex = 1,pch = 16, col = rainbow(8),main = 'stripchart')

beeswarm(decrease ~ treatment, data = OrchardSprays, log = TRUE, pch = 16, col = rainbow(8),main = 'beeswarm')

  OrchardSprays是R自带的数据,decrease 和 treatment必须是数据的header

  pch:描点的样式

  jitter:把横坐标抖散(jitter),使本来都拥有相同坐标的点的横坐标稍有不同。jitter是基类函数{base},无需调用任何包

  

二、不同的beeswarm图:

  1.The color of individual points can be specified

install.packages(“beeswarm”)
library(beeswarm)
data(breast)#必须先library(beeswarm),才能导入breast数据集
head(breast)
getwd()
setwd('/home/name/R')#自己设置路径
png('diff_color.png',width=400*2,height=400*2,res=72*2,type='cairo-png')
beeswarm(time_survival ~ ER, data=breast,pch=16, pwcol=1+as.numeric(event_survival),xlab="",ylab="Follow-up time (months)",labels = c("ER neg", "ER pos"))
legend("topright",legend=c("yes","no"),title="Censored",pch=16,col=1:2)
dev.off()

  2.Compare the four methods for arranging points#点的组织方式可以多种,如("swarm", "center", "hex", "square")

## Generate some random data
set.seed(123)
distro <- list(runif = runif(100, min = -3, max = 3), rnorm = rnorm(100)) png("arrange_points.png",width=600*2,height=600*2,res=72*2,type='cairo-png')
par(mfrow=c(2,2))#两行两列画布
for (m in c("swarm", "center", "hex", "square")) {
beeswarm(distro, col = 2:3, pch = 16,method = m,
main = paste('method = "', m, '"', sep = ''))
} dev.off()

  3.Combining beeswarms with "boxplot" or "bxplot"

  

png("box_plus_beeswarm.png",width=600*2,height=600*2,res=72*2,type='cairo-png')
par(mfrow=c(1,2))
boxplot(len ~ dose, data = ToothGrowth,outline = FALSE,main = 'boxplot + beeswarm')
#outline = FALSE :avoid double-plotting outliers, if any
beeswarm(len ~ dose, data = ToothGrowth,col = 4, pch = 16, add = TRUE) beeswarm(len ~ dose, data = ToothGrowth,col = 4, pch = 16,main = 'beeswarm + bxplot')
bxplot(len ~ dose, data = ToothGrowth, add = TRUE)
dev.off()

  4.New arguments "side" and "priority"

png("side_priority.png",width=600*2,height=600*2,res=72*2,type='cairo-png')
par(mfrow=c(2,3))
beeswarm(distro, col = 2:4, main = 'Default') beeswarm(distro, col = 2:4, side = -1, main = 'side = -1') beeswarm(distro, col = 2:4, side = 1, main = 'side = 1') beeswarm(distro, col = 2:4, priority = "descending", main = 'priority = "descending"') beeswarm(distro, col = 2:4, priority = "random", main = 'priority = "random"') beeswarm(distro, col = 2:4, priority = "density", main = 'priority = "density"') dev.off()

  参考:http://www.cbs.dtu.dk/~eklund/beeswarm/

  

beeswarm-蜜蜂图的更多相关文章

  1. 【R作图】蜜蜂群图beeswarm和jitter的使用

    最近经常要画好看的盒形图,还要在上面加入散点,所以总结了两个方法. 第一种方法是,利用beeswarm函数: library(beeswarm) beeswarm 蜜蜂群图 http://rgm3.l ...

  2. HBase轻松入门之HBase架构图解析

    2018-12-13 2018-12-20 本篇文章旨在针对初学者以我本人现阶段所掌握的知识就HBase的架构图中各模块作一个概念科普.不对文章内容的“绝对.完全正确性”负责. 1.开胃小菜 关于HB ...

  3. 『看球笔记』20140208利物浦VS阿森纳,十字重剑与蜜蜂飞舞

      红圈位置42%对58%的控球率,是不是觉得比分很不符?我们卖个关子,最后再说这个.   十字重剑     第一次任意球防守,俩后卫盯俩后卫,负责斯科特尔的是科斯切尔尼,而默特萨克盯图雷.     ...

  4. bzoj 2304 [Apio2011]寻路 Dij+模拟+恶心建图

    [Apio2011]寻路 Time Limit: 20 Sec  Memory Limit: 256 MBSubmit: 624  Solved: 193[Submit][Status][Discus ...

  5. PHP-生成缩略图和添加水印图-学习笔记

    1.开始 在网站上传图片过程,经常用到缩略图功能.这里我自己写了一个图片处理的Image类,能生成缩略图,并且可以添加水印图. 2.如何生成缩略图 生成缩略图,关键的是如何计算缩放比率. 这里,我根据 ...

  6. 火焰图分析openresty性能瓶颈

    注:本文操作基于CentOS 系统 准备工作 用wget从https://sourceware.org/systemtap/ftp/releases/下载最新版的systemtap.tar.gz压缩包 ...

  7. 一起来玩echarts系列(一)------箱线图的分析与绘制

    一.箱线图 Box-plot 箱线图一般被用作显示数据分散情况.具体是计算一组数据的中位数.25%分位数.75%分位数.上边界.下边界,来将数据从大到小排列,直观展示数据整体的分布情况. 大部分正常数 ...

  8. iOS开发系列--打造自己的“美图秀秀”

    --绘图与滤镜全面解析 概述 在iOS中可以很容易的开发出绚丽的界面效果,一方面得益于成功系统的设计,另一方面得益于它强大的开发框架.今天我们将围绕iOS中两大图形.图像绘图框架进行介绍:Quartz ...

  9. Webstorm+Webpack+echarts构建个性化定制的数据可视化图表&&两个echarts详细教程(柱状图,南丁格尔图)

    Webstorm+Webpack+echarts   ECharts 特性介绍 ECharts,一个纯 Javascript 的图表库,可以流畅的运行在 PC 和移动设备上,兼容当前绝大部分浏览器(I ...

随机推荐

  1. HackerRank beautiful string

    问题 https://vjudge.net/problem/HackerRank-beautiful-string 给一个字符串S,可以任意取走S中的两个字符从而得到另外一个字符串P,求有多少种不同的 ...

  2. Spring MVC 使用介绍(一)—— 概述

    一.Web MVC简介 1.经典的MVC架构 存在的问题:1.控制器负责流程控制.请求数据整理与校验.模型与视图选择等功能,过于复杂.2.模型层没有进行分层设计 2.改进的MVC设计 1)控制器功能拆 ...

  3. POJ 1012

    参考自:https://www.cnblogs.com/ECJTUACM-873284962/p/6480880.html Joseph Time Limit: 1000MS   Memory Lim ...

  4. C# 动态调用泛型方法

    static void Main(string[] args) { #region 具体类型可传递. Personal specifiedPersonal = new Personal(); Empl ...

  5. LOJ2721 [NOI2018] 屠龙勇士 【扩展中国剩余定理】

    好久没写了,写一篇凑个数. 题目分析: 这题不难想,讲一下中国剩余定理怎么扩展. 考虑$$\left\{\begin{matrix}x \equiv a\pmod{b}\\ x \equiv c\pm ...

  6. 大学java教案之MySQL安装图解

    一.MYSQL的安装 1.打开下载的mysql安装文件mysql-5.0.27-win32.zip,双击解压缩,运行"setup.exe". 2.选择安装类型,有"Typ ...

  7. Hdoj 1007 Quoit Design 题解

    Problem Description Have you ever played quoit in a playground? Quoit is a game in which flat rings ...

  8. 【Luogu2197】NIM游戏(博弈论)

    题面 洛谷 题解 \(Nim\)游戏模板题 #include<iostream> #include<cstdio> #include<cstdlib> using ...

  9. 解决zabbix3.4图表显示中文乱码问题

    问题描述: 在Zabbix界面设置中,已经调成中文语言,可能zabbix自身携带的字体还不够完美,出现如下乱码: 测试环境: zabbix 3.4(经测试,目前3.x版本都适用) 解决步骤: 1. 寻 ...

  10. CodeFroces-- 514.div2.C-Sequence Transformation

    题目链接 :514.div2.C-Sequence Transformation #include<bits/stdc++.h> using namespace std; #define ...