一、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. YUV格式与RGB格式

    YUV420介绍: YUV420格式是指,每个像素都保留一个Y(亮度)分量,而在水平方向上,不是每行都取U和V分量,而是一行只取U分量,则其接着一行就只取V分量,以此重复(即4:2:0, 4:0:2, ...

  2. mvc HTML转Excel身份证后三位变成0

    @{ var style = "vnd.ms-excel.numberformat:@"; } //HTML <td style=@style><span> ...

  3. HTML5-Input

    HTML5拥有多个新的表单输入类型,这些新特性提供了更好的输入控制和验证(有的浏览器不支持) color.date.datetime.datetime-local.email.month.number ...

  4. python之旅六【第六篇】模块

    json和pickle 用于序列化的两个模块json,用于字符串 和 python数据类型间进行转换pickle,用于python特有的类型 和 python的数据类型间进行转换 json模块提供了四 ...

  5. Windows server 2012 卸载iis 黑屏

    转载:https://jingyan.baidu.com/article/ff42efa9fb6f16c19e2202dc.html 1 按  ctrl+alt+end 键,新建运行任务 ,输入cmd ...

  6. 一:Newtonsoft.Json 支持序列化与反序列化的.net 对象类型;

    导航目录: Newtonsoft.Json 概述 一:Newtonsoft.Json 支持序列化与反序列化的.net 对象类型:    二:C#对象.集合.DataTable与Json内容互转示例: ...

  7. ☆ [POJ2559] Largest Rectangle in a Histogram 「单调栈」

    类型:单调栈 传送门:>Here< 题意:给出若干宽度相同的矩形的高度(条形统计图),求最大子矩形面积 解题思路 单调栈的经典题 显然,最终的子矩形高度一定和某一个矩形相等(反证).因此一 ...

  8. HBase读取与写入流程

    写入流程 读取流程 https://yq.aliyun.com/articles/670748?spm=a2c4e.11153940.blogcont684011.28.427e4648CTtaPL

  9. Codeforces Round #502 (in memory of Leopoldo Taravilse, Div. 1 + Div. 2)

    第一次参加cf的比赛 有点小幸运也有点小遗憾 给自己定个小目标 1500[对啊我就是很菜qvq A. The Rank 难度:普及- n位学生 每个学生有四个分数 然鹅我们只需要知道他的分数和 按分数 ...

  10. 洛谷SP22343 NORMA2 - Norma(分治,前缀和)

    洛谷题目传送门 这题推式子恶心..... 考虑分治,每次统计跨过\(mid\)的所有区间的答案和.\(i\)从\(mid-1\)到\(l\)枚举,统计以\(i\)为左端点的所有区间. 我们先维护好\( ...