日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

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

發(fā)布時(shí)間:2024/10/12 56 豆豆
生活随笔 收集整理的這篇文章主要介紹了 JAVA定义一个多边形类_如何在每个数据类别中绘制多个多边形? 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

一些代碼在SIBRE的捆綁演示數(shù)據(jù)集上執(zhí)行此操作 .

在這個(gè)例子中,我們嘗試使用ggplot2創(chuàng)建后橢圓的多個(gè)樣本的一些圖 .

library(SIBER)

library(ggplot2)

library(dplyr)

library(ellipse)

使基本SIBER模型適合與包捆綁在一起的示例數(shù)據(jù) .

# 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"

)

現(xiàn)在我們想要從這些分布中創(chuàng)建一些樣本橢圓的圖 . 我們需要為每個(gè)組創(chuàng)建所有省略號(hào)的data.frame對(duì)象 . 在這個(gè)例子中,我們簡(jiǎn)單地將第10個(gè)后部繪制假設(shè)它們彼此獨(dú)立,但如果您愿意,可以隨機(jī)抽取樣本 .

# 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

現(xiàn)在來(lái)創(chuàng)建情節(jié) . 首先根據(jù)需要繪制所有原始數(shù)據(jù) .

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)

現(xiàn)在我們可以嘗試按組添加頂部和刻面上的后橢圓

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)

總結(jié)

以上是生活随笔為你收集整理的JAVA定义一个多边形类_如何在每个数据类别中绘制多个多边形?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。