一些代码在SIBRE的捆绑演示数据集上执行此操作 .

在这个例子中,我们尝试使用ggplot2创建后椭圆的多个样本的一些图 .

library(SIBER)

library(ggplot2)

library(dplyr)

library(ellipse)

使基本SIBER模型适合与包捆绑在一起的示例数据 .

# load in the included demonstration dataset

data("demo.siber.data")

#

# create the siber object

siber.example

# Calculate summary statistics for each group: TA, SEA and SEAc

group.ML

# options for running jags

parms

parms$n.iter

parms$n.burnin

parms$n.thin

parms$n.chains

# define the priors

priors

priors$R

priors$k

priors$tau.mu

# fit the ellipses which uses an Inverse Wishart prior

# on the covariance matrix Sigma, and a vague normal prior on the

# means. Fitting is via the JAGS method.

ellipses.posterior

# The posterior estimates of the ellipses for each group can be used to

# calculate the SEA.B for each group.

SEA.B

siberDensityPlot(SEA.B, xticklabels = colnames(group.ML),

xlab = c("Community | Group"),

ylab = expression("Standard Ellipse Area " ('\u2030' ^2) ),

bty = "L",

las = 1,

main = "SIBER ellipses on each group"

)

现在我们想要从这些分布中创建一些样本椭圆的图 . 我们需要为每个组创建所有省略号的data.frame对象 . 在这个例子中,我们简单地将第10个后部绘制假设它们彼此独立,但如果您愿意,可以随机抽取样本 .

# how many of the posterior draws do you want?

n.posts

# decide how big an ellipse you want to draw

p.ell

# for a standard ellipse use

# p.ell

# a list to store the results

all_ellipses

# loop over groups

for (i in 1:length(ellipses.posterior)){

# a dummy variable to build in the loop

ell

post.id

for ( j in 1:n.posts){

# covariance matrix

Sigma

# mean

mu

# ellipse points

out

ell

post.id

}

ell

ell$rep

all_ellipses[[i]]

}

ellipse_df

# now we need the group and community names

# extract them from the ellipses.posterior list

group_comm_names

# split them and conver to a matrix, NB byrow = T

split_group_comm

nrow(ellipse_df), 2, byrow = TRUE)

ellipse_df$community

ellipse_df$group

ellipse_df

现在来创建情节 . 首先根据需要绘制所有原始数据 .

first.plot

geom_point(aes(color = factor(group):factor(community)), size = 2)+

ylab(expression(paste(delta^{15}, "N (\u2030)")))+

xlab(expression(paste(delta^{13}, "C (\u2030)"))) +

theme(text = element_text(size=15))

print(first.plot)

现在我们可以尝试按组添加顶部和刻面上的后椭圆

second.plot

print(second.plot)

# rename columns of ellipse_df to match the aesthetics

third.plot

geom_polygon(data = ellipse_df,

mapping = aes(iso1, iso2,

group = rep,

color = factor(group):factor(community),

fill = NULL),

fill = NA,

alpha = 0.2)

print(third.plot)

JAVA定义一个多边形类_如何在每个数据类别中绘制多个多边形?相关推荐

  1. python定义一个复数类complex、并实现复数相加_用java定义一个复数类Complex,能够创建复数对象,并且实现复数之间的加、减运算...

    题目: 用java定义一个复数类Complex,能够创建复数对象,并且实现复数之间的加.减运算 复数具有实部和虚部两部分,如2+5i就是一个复数,其中2为实部,5i为虚部;两复数相加时,实部与实部相加 ...

  2. java定义一个日期类 包括年 月 日_定义一个日期类:包括年、月、日三个成员变量,显示日期的方法...

    /*定义一个日期类:包括年.月.日三个成员变量,显示日期的方法 * 提供构造方法:定义无参构造方法,和有参构造方法 */ 代码如下: public class Demo { public static ...

  3. java定义一个长方形类,该类中具有长方形长宽两种属性,并具有相应的构造方法属性访问方法,计算长方形的周长和面积的方法,要求输出长是5,宽是4的长方形

    定义一个长方形类,该类中具有长方形长宽两种属性,并具有相应的构造方法 属性访问方法,计算长方形的周长和面积的方法,要求输出长是5,宽是4的长方形 public class test3 {public ...

  4. java定义一个Person类

    定义一个Person类,其包含:name.address.e_mail三个成员变量:一个显示"this is in class Person"字符串的show()方法: 要求根据此 ...

  5. java设计一个user类_关于JAVA设计一个用户类

    关于JAVA设计一个用户类 关注:152  答案:2  mip版 解决时间 2021-02-02 05:51 提问者安分守己的小青春 2021-02-02 02:23 设计一个用户类,该类有用户编号. ...

  6. vb6.0 定义一个公共类_纠正网上的错误:能不能自定义一个类叫java.lang.System/String?...

    前语:不要为了读文章而读文章,一定要带着问题来读文章,勤思考. 作者:一汪清水  来源:https://dwz.cn/i7Pf6VwZ 最近,学习了下java类加载相关的知识.然后看到网上有一道面试题 ...

  7. java定义一个日期类 包括年 月 日_【说明】 设计一个日期类Date包括年、月、日等私有数据成员。要求实现日期..._考试资料网...

    填空题[说明] 设计一个日期类Date包括年.月.日等私有数据成员.要求实现日期的基本运算,如某日期加上天数.某日期减去天数.两日期相差的天数等. 在Date类中设计如下重载运算符函数: Date o ...

  8. java编程定义一个表示学生信息的类student_要求如下_用JAVA定义一个学生类Student来表示学生信息,学生类中包含成员有学号(id)、姓名(name)、年龄和成绩...

    展开全部 如下所示: public class Student { private int sNo; //学号 private String name; //姓名 private String sex ...

  9. java编写学生类student.属性:姓名_学号_年龄_用JAVA定义一个学生类Student来表示学生信息,含成员学号、姓名、年龄和成绩...

    展开全部 如下所示: public class Student { private int sNo; //学号 private String name; //姓名 private String sex ...

最新文章

  1. 对数据库表中的某一字段去重分组排序
  2. php留言板源码免mysql_PHPMYSQL留言板源码(终极完整版).doc
  3. fusioncharts相关问题
  4. 对实体 characterEncoding 的引用必须以 ';' 分隔符结尾
  5. 一文看懂Python(一)-----列表和元组篇
  6. 100块钱买100只鸡php,使用JS计算买100只鸡问题
  7. html选择器有哪些child,css3选择器child有哪些?css3选择器child用法详解
  8. GDB 调试程序 详解 使用实例
  9. 适配器模式之对象适配器
  10. primefaces教程_Primefaces日历组件示例教程
  11. vue-router 源码:实现一个简单的 vue-router
  12. Jupyter Notebook激活conda对应的环境
  13. Functional Programming
  14. 使用ajax模拟用户名是否被占用
  15. 【老王读Spring AOP-3】Spring AOP 执行 Pointcut 对应的 Advice 的过程
  16. word太大怎么压缩变小,word压缩方法
  17. 文字识别模型MNIST
  18. Unix/BSD/Linux的口令机制初探(转)
  19. Dolby技术汇总(二) --- Dolby Mobile
  20. Exchange Server 2007+0ffice Communication Server 2007构建统一消息平台

热门文章

  1. 563. 二叉树的坡度
  2. 【实战】tensorflow 花卉识别
  3. 【计网】计算机网络-物理层【理论1-2】
  4. reactjs typescript数据传递
  5. CDH6.3.2默认管理端口是7180,HDFS相关端口
  6. Scala基于Akka模拟Spark Master Worker进程间通信(一):Worker向Master注册
  7. golang管道channel的遍历和关闭:应该使用for...range来遍历
  8. Python3类方法和静态方法
  9. Python Django URL传参代码示例
  10. Python Django 打印执行过的查询语句