有没有办法将质心和蜘蛛添加到这个 PCoA 绘图代码中?

问题描述

这里是新的,并且一般使用 R。我正在尝试修改用于生成 PCoA 图的脚本以包含质心和“蜘蛛”(将每个样本数据点连接到质心的线段)。与附加图片类似。1https://i.stack.imgur.com/Tjj3T.png

这是我一直在使用的代码

p.pcoa.wuniRM <- plot_ordination(ps2.prev_RM,ord.pcoa.wuniRM,color = "Location",axes = c(4,5)) +
  geom_point(size = 2,aes(shape = Location)) +
  labs(title = "PCoA of wUniFrac distances",color = "Location") +
  theme(legend.text = element_text(size=5),aspect.ratio = 1)

是否有一种简单的方法可以修改此脚本以绘制质心和蜘蛛图形,或者我是否需要一起找到不同的脚本?

解决方法

您应该尝试 import React,{ useState } from 'react' const GridCell = ({ style,onGridClick }) => { const [clicked,setClicked] = useState(false) const handleClick = () => { if (!clicked) { setClicked(true) onGridClick() } } return ( <div style={{ position: 'absolute',border: 1,zIndex: 10,borderStyle: 'solid',...style,}} onClick={handleClick} diabled={clicked} ></div> ) } const ClickScore = ({ taskNumber,numberOfAnswers }) => { const [score,setScore] = useState(0) const onGridClick = (row,col) => { if (taskNumber === 1) { if ( (row === 1 && col === 2) || (row === 2 && col === 1) || (row === 2 && col === 3) ) { setScore((prevScore) => prevScore + 1) } return `${score}/${numberOfAnswers}` } } return ( <> <div> <p id='score'>{score}</p> </div> <GridCell onGridClick={() => onGridClick(1,1)} style={{ borderColor: 'blue',left: 23,height: 170.48,width: 290.86,top: 37.91,}} /> <GridCell onGridClick={() => onGridClick(1,2)} style={{ borderColor: 'red',left: 298.86,3)} style={{ borderColor: 'red',left: 600,}} /> <GridCell onGridClick={() => onGridClick(2,1)} style={{ borderColor: 'red',left: 3,top: 212.91,}} /> </> ) } 函数:

stat_ellipse()

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...