- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个使用名为 Revigo 的网站制作的图,该网站提供了一个 R 脚本(包括在下面)来创建这样的图:
我想看看是否有可能在同一图中的这些点之上执行和可视化聚类?由于该图看起来像一个大圆圈,因此我试图查看其中是否有任何可以突出显示的较小分组。我有生物学背景,所以我不确定从哪里开始尝试在同一个图中获得这种可视化。我已经使用 hclust()
进行了探索,但我不知道将集群显示在此图顶部的步骤。
给出上图的代码和数据是:
library( ggplot2 );
library( scales );
revigo.names <- c("term_ID","description","frequency_%","plot_X","plot_Y","plot_size","log10_p_value","uniqueness","dispensability");
revigo.data <- rbind(c("GO:0002376","immune system process",16.463,-0.302,-3.807, 3.455,-8.3307,0.995,0.000),
c("GO:0006928","movement of cell or subcellular component",10.987, 1.052, 1.113, 3.280,-8.8153,0.965,0.000),
c("GO:0007610","behavior", 3.254,-1.620, 0.960, 2.752,-4.0048,0.994,0.000),
c("GO:0008150","biological_process",100.000,-6.029,-0.499, 4.239,-8.7447,1.000,0.000),
c("GO:0009987","cellular process",90.329,-5.288, 0.130, 4.195,-10.0701,0.999,0.000),
c("GO:0010243","response to organonitrogen compound", 4.697, 6.870,-2.756, 2.911,-12.7100,0.865,0.000),
c("GO:0023052","signaling",36.613, 2.976,-6.718, 3.803,-7.1931,0.996,0.000),
c("GO:0032501","multicellular organismal process",41.143, 3.761,-0.715, 3.853,-17.2741,0.997,0.000),
c("GO:0032502","developmental process",33.982,-2.865,-0.660, 3.770,-14.4202,0.996,0.000),
c("GO:0034762","regulation of transmembrane transport", 2.452,-3.982, 3.261, 2.629,-13.4123,0.788,0.000),
c("GO:0040007","growth", 5.447, 0.651,-0.889, 2.975,-4.2140,0.995,0.000),
c("GO:0040011","locomotion", 9.452, 2.305,-0.865, 3.215,-8.1068,0.995,0.000),
c("GO:0050896","response to stimulus",49.302, 3.556,-5.122, 3.932,-17.7852,0.997,0.000),
c("GO:0051179","localization",36.018,-0.564,-0.041, 3.795,-8.9245,0.996,0.000),
c("GO:0051704","multi-organism process", 9.873, 1.677,-5.787, 3.234,-4.6925,0.995,0.000),
c("GO:0065007","biological regulation",67.069,-4.157, 0.147, 4.065,-15.5918,0.998,0.000),
c("GO:0007154","cell communication",36.705,-0.841,-2.282, 3.804,-8.3595,0.992,0.006),
c("GO:0008283","cell proliferation",11.321, 2.644, 1.154, 3.293,-4.5376,0.982,0.024),
c("GO:0042391","regulation of membrane potential", 2.204,-0.568,-6.816, 2.583,-10.6073,0.895,0.035),
c("GO:0043086","negative regulation of catalytic activity", 4.934, 4.164,-2.157, 2.932,-4.9172,0.880,0.039),
c("GO:0019216","regulation of lipid metabolic process", 1.685, 3.142, 6.777, 2.467,-6.3215,0.880,0.043),
c("GO:0044057","regulation of system process", 2.862,-6.608, 1.584, 2.696,-13.1469,0.868,0.046),
c("GO:0051093","negative regulation of developmental process", 4.720,-4.950,-3.614, 2.913,-9.9031,0.830,0.050),
c("GO:0006793","phosphorus metabolic process",18.702,-4.363, 6.140, 3.511,-6.8729,0.961,0.053),
c("GO:0008284","positive regulation of cell proliferation", 4.859,-0.261, 4.128, 2.926,-9.2882,0.832,0.055),
c("GO:0065008","regulation of biological quality",20.202,-0.644, 5.306, 3.544,-20.3125,0.920,0.057),
c("GO:0050865","regulation of cell activation", 3.174, 2.497,-4.613, 2.741,-4.7878,0.917,0.062),
c("GO:0065009","regulation of molecular function",17.288,-1.972, 4.374, 3.477,-17.1959,0.923,0.078),
c("GO:0048518","positive regulation of biological process",30.969, 0.597, 8.033, 3.730,-15.2993,0.895,0.095),
c("GO:0051128","regulation of cellular component organization",13.335, 1.445, 4.799, 3.364,-4.5003,0.899,0.104),
c("GO:0007169","transmembrane receptor protein tyrosine kinase signaling pathway", 3.976, 6.886, 4.332, 2.839,-7.5986,0.845,0.114),
c("GO:0032101","regulation of response to external stimulus", 3.976, 6.545, 2.631, 2.839,-9.0405,0.838,0.114),
c("GO:0048519","negative regulation of biological process",26.855,-0.542, 7.989, 3.668,-12.9469,0.898,0.134),
c("GO:0044238","primary metabolic process",60.306,-3.339, 6.565, 4.019,-4.5229,0.961,0.140),
c("GO:0042221","response to chemical",23.993, 7.702,-0.115, 3.619,-24.7399,0.923,0.160),
c("GO:0009628","response to abiotic stimulus", 6.705, 8.008, 1.525, 3.066,-11.1726,0.938,0.174),
c("GO:0007187","G-protein coupled receptor signaling pathway, coupled to cyclic nucleotide second messenger", 1.033, 5.463, 5.279, 2.255,-5.0942,0.874,0.186),
c("GO:0031099","regeneration", 1.016,-3.828,-4.295, 2.248,-4.6216,0.955,0.186),
c("GO:0009719","response to endogenous stimulus", 9.175, 6.984, 0.467, 3.202,-15.8069,0.935,0.188),
c("GO:0098657","import into cell", 0.415,-3.347, 2.843, 1.863,-4.7077,0.928,0.190),
c("GO:0051239","regulation of multicellular organismal process",15.268,-6.085, 3.408, 3.423,-18.1433,0.885,0.192),
c("GO:0007268","chemical synaptic transmission", 3.474, 5.008, 6.277, 2.780,-4.7471,0.914,0.194),
c("GO:0050794","regulation of cellular process",60.427, 0.909, 7.170, 4.020,-15.1986,0.875,0.198),
c("GO:0009605","response to external stimulus",12.043, 7.990, 0.686, 3.320,-7.7520,0.932,0.202),
c("GO:0019222","regulation of metabolic process",35.730,-0.798, 6.924, 3.792,-8.7399,0.888,0.217),
c("GO:0048589","developmental growth", 3.272,-5.765,-3.288, 2.754,-4.6289,0.942,0.220),
c("GO:0048729","tissue morphogenesis", 3.572,-4.454,-4.112, 2.792,-4.2055,0.942,0.223),
c("GO:0048732","gland development", 2.418,-5.936,-2.151, 2.623,-3.9830,0.930,0.224),
c("GO:0032879","regulation of localization",14.409,-3.921, 4.876, 3.398,-19.9830,0.839,0.231),
c("GO:0006950","response to stress",21.310, 7.271,-0.252, 3.567,-11.7905,0.925,0.241),
c("GO:0048583","regulation of response to stimulus",21.610, 7.157, 2.071, 3.574,-14.0640,0.849,0.242),
c("GO:0031323","regulation of cellular metabolic process",33.837, 1.983, 7.193, 3.768,-7.3665,0.804,0.256),
c("GO:0003008","system process",11.575,-6.863, 1.039, 3.303,-14.5229,0.965,0.259),
c("GO:0050789","regulation of biological process",63.456, 0.625, 7.037, 4.041,-16.1244,0.896,0.274),
c("GO:0051899","membrane depolarization", 0.565,-1.372,-6.528, 1.996,-4.2411,0.910,0.284),
c("GO:0061024","membrane organization", 7.299,-5.167, 4.037, 3.102,-4.4237,0.987,0.286),
c("GO:0035150","regulation of tube size", 0.675,-0.489,-6.505, 2.072,-5.1129,0.901,0.290),
c("GO:0009636","response to toxic substance", 1.264, 6.039,-4.714, 2.342,-5.3072,0.915,0.292),
c("GO:0061041","regulation of wound healing", 0.750, 5.568, 3.354, 2.117,-5.7696,0.869,0.296),
c("GO:0007165","signal transduction",33.618, 5.808, 3.554, 3.765,-20.2403,0.784,0.296),
c("GO:0010038","response to metal ion", 1.829, 6.463,-4.185, 2.502,-5.0768,0.911,0.307),
c("GO:0001101","response to acid chemical", 1.858, 6.221,-3.913, 2.509,-5.3072,0.911,0.308),
c("GO:0043066","negative regulation of apoptotic process", 4.749,-4.234,-2.719, 2.916,-5.6778,0.845,0.315),
c("GO:0042493","response to drug", 2.366, 6.792,-3.628, 2.614,-12.6716,0.908,0.319),
c("GO:0010035","response to inorganic substance", 2.816, 6.714,-3.232, 2.689,-6.8125,0.906,0.327),
c("GO:0048856","anatomical structure development",31.558,-4.976,-4.080, 3.738,-12.4157,0.940,0.339),
c("GO:0051716","cellular response to stimulus",40.358, 7.607, 0.187, 3.845,-21.1158,0.911,0.359),
c("GO:0055082","cellular chemical homeostasis", 4.108,-1.327,-6.764, 2.853,-9.7520,0.840,0.364),
c("GO:0007267","cell-cell signaling", 9.025, 5.287, 5.987, 3.195,-5.1175,0.925,0.366),
c("GO:0043408","regulation of MAPK cascade", 3.883, 5.837, 4.526, 2.829,-6.8794,0.689,0.371),
c("GO:0048522","positive regulation of cellular process",27.732,-1.038, 7.337, 3.682,-15.2518,0.798,0.376),
c("GO:0010817","regulation of hormone levels", 2.764,-0.848,-6.705, 2.681,-6.8697,0.892,0.376),
c("GO:0050878","regulation of body fluid levels", 2.862,-1.665,-6.559, 2.696,-4.2541,0.891,0.378),
c("GO:1901654","response to ketone", 1.039, 5.708,-4.850, 2.258,-5.2644,0.898,0.394));
one.data <- data.frame(revigo.data);
names(one.data) <- revigo.names;
one.data <- one.data [(one.data$plot_X != "null" & one.data$plot_Y != "null"), ];
one.data$plot_X <- as.numeric( as.character(one.data$plot_X) );
one.data$plot_Y <- as.numeric( as.character(one.data$plot_Y) );
one.data$plot_size <- as.numeric( as.character(one.data$plot_size) );
one.data$log10_p_value <- as.numeric( as.character(one.data$log10_p_value) );
one.data$frequency <- as.numeric( as.character(one.data$frequency) );
one.data$uniqueness <- as.numeric( as.character(one.data$uniqueness) );
one.data$dispensability <- as.numeric( as.character(one.data$dispensability) );
p1 <- ggplot( data = one.data );
p1 <- p1 + geom_point( aes( plot_X, plot_Y, colour = log10_p_value, size = plot_size), alpha = I(0.6) ) + scale_size_area();
p1 <- p1 + scale_colour_gradientn( colours = c("blue", "green", "yellow", "red"), limits = c( min(one.data$log10_p_value), 0) );
p1 <- p1 + geom_point( aes(plot_X, plot_Y, size = plot_size), shape = 21, fill = "transparent", colour = I (alpha ("black", 0.6) )) + scale_size_area();
p1 <- p1 + scale_size( range=c(5, 30)) + theme_bw(); # + scale_fill_gradientn(colours = heat_hcl(7), limits = c(-300, 0) );
ex <- one.data [ one.data$dispensability < 0.15, ];
p1 <- p1 + geom_text( data = ex, aes(plot_X, plot_Y, label = description), colour = I(alpha("black", 0.85)), size = 3 );
p1 <- p1 + labs (y = "semantic space x", x = "semantic space y");
p1 <- p1 + theme(legend.key = element_blank()) ;
one.x_range = max(one.data$plot_X) - min(one.data$plot_X);
one.y_range = max(one.data$plot_Y) - min(one.data$plot_Y);
p1 <- p1 + xlim(min(one.data$plot_X)-one.x_range/10,max(one.data$plot_X)+one.x_range/10);
p1 <- p1 + ylim(min(one.data$plot_Y)-one.y_range/10,max(one.data$plot_Y)+one.y_range/10);
p1
对不起,代码很忙,这是网站为我提供的,所以这是我的起点 - 任何关于库的指导或任何我可以用来弄清楚如何在这个 ggplot 中突出显示较小分组的指导将不胜感激。
xy <- dplyr::select(one.data, plot_X, plot_Y)
res.km <- kmeans(scale(xy), 3, nstart = 25)
一个制作不良且不准确的示例,说明了我期望重叠分组的样子,但是如果我使用 k-means 来识别 3 个组,那么我尝试查看的绘图样式/类型将如下所示:
res.km <- kmeans(scale(xy), 3, nstart = 25)
给出了 1-3 之间的每一行集群,有没有办法突出显示这样的组?
最佳答案
ggforce
提供了一些符合要求的分组几何:
one.data$cluster = res.km$cluster
#...all your code above...
p1 + ggforce::geom_mark_ellipse(aes(plot_X, plot_Y, group = cluster, label = cluster))
[“label = cluster”部分可以省略以单独获得省略号。]
ggforce::geom_mark_hull
这使您可以绘制更接近集群轮廓的凸包:
p1 + ggforce::geom_mark_hull(aes(plot_X, plot_Y, group = cluster, label = cluster), expand = unit(10, "mm"), radius = unit(10, "mm"), concavity = 1.8)
关于r - 如何在R中可视化覆盖圆形图的集群?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66805929/
我想要一个“真正的”圆形 UIView,以避免应用圆角半径的正方形 View 。 因为我使用的是重力,我的圆圈不能很好地显示,因为它们在角落里不能相互接触(屏幕来自“Debug View Hierar
所以我前段时间建了一点突破克隆 ,我想稍微升级一下,主要是为了碰撞。当我第一次制作它时,我在我的球和我的砖 block 之间进行了基本的“碰撞”检测,这实际上将球视为另一个矩形。但这造成了边缘碰撞的问
我正在尝试在矩形内创建一个椭圆形/圆形。我正在尝试在 Canvas 上对位图图像执行此操作。这是我的代码: int x = (int) (midpoint.x*xRatio); int y = (in
我想知道是否可以绘制圆形 UIButton(不是圆形矩形)。 当我在自定义类型的 UIButton 中添加圆形图像时,它看起来像一个圆形按钮。但是在按钮被点击的那一刻,按钮的边界变得可见,所以它看起来
我有this slider在我的网站上。我想将 slider 移动到 360 度。我如何更改以下脚本来执行此操作? $(document).ready(function() { /*Slide
我正在 PyQt 中使用 QGraphicsView 构建一个 GUI,它将显示互连项目的大型网络,并且我希望能够叠加一个较小的门户来显示网络的远处部分 - 有点像“画中画” “之类的事情。这本身并不
我正在尝试为个人资料图片圈出 ImageView 。在我限制 UiScreen 宽度之前它工作正常。 代码如下 import UIKit class ViewController: UIViewCon
我想创建一个如下所示的圆形 slider 。 但我还想要两个功能。 1) 我想从任意点启动 slider ,但在图 1 中。从0开始。 2) 我想在单个圆形黑色图中包含多个 slider 。 我正在分
我有一个帖子 div,它位于一个奇怪的背景之上,正如您在此屏幕截图中所见 http://i.stack.imgur.com/L5Qj0.png文字越过我想要的区域。我尝试使用 border-radiu
我想知道,如何在 ios 8 或 9 中创建圆形模糊文本输入字段和模糊按钮。我应该使用核心动画还是简单地在 ps 中绘制 png?我从来没有为 UI 使用过 Core Animation,你能推荐一个
我希望在包含在主圆圈中的圆圈底部创建一个深色蒙版。 你可以使用 css masks 来做到这一点吗? 请参阅fiddle Change Profile
我有一个带有 ImageView 的自定义表格 View 单元格。我试图使 ImageView 成为圆形,但它不是圆形的,我无法查明问题所在。 import UIKit class Legislato
最近一直在opencv里瞎折腾,一直在摸索绘图函数(cvCircle(...), cvRectangle(...), etc...)。它们可以正常工作,但我只能在之前加载的图像上绘制它们。 有没有办法
我有一个 FXML 文件、一个 CSS 文件和一个 Controller.java 文件。当鼠标悬停在 FXML 文件中的按钮上时, 例如fx:id="负载" 如何在舞台上创建圆形节点? 我目前正在这
我对圆-矩形相交有疑问。虽然是一个数字我发现了关于它的讨论,我无法得到答案。我的问题是 - 我的 View /窗口 (320 X 480) 有一个矩形下部 (100-200,0-50) .And a
假设我们有以下一组项目 View : View1 -> View2 -> View3 -> ... -> View(n-1) -> View(n) 在经典的 RecyclerView 上,View1
我可以在“didTapAt”事件中在谷歌地图上添加许多标记和圆圈,但我也想删除它们,对于标记我可以在“didTap 标记”事件中执行此操作但我如何才能删除它的形状而不是其他形状? 最佳答案 let c
我正在尝试获得一个圆形的 UIImageView 但它似乎在不同的设备上呈现不同; 在 iPhone Xr 上看起来像这样: 在 iPhone 7 上看起来像这样: 我的高度限制为 60,代码如下:
我想做一个如下图所示的圆形 slider 。jQuery 能够做到这一点吗? 我知道直 slider 的工作原理,但我想制作一个 HTML5 圆形 slider 。这是我在网上找到的 http://j
我有一个包含图像的 UIScrollView。当用户到达最后一张图片并滑动手指查看下一张图片时,我想显示第一张图片。同样,当用户在第一张图片上滑动查看上一张图片时,我想显示最后一张图片。简而言之,这将
我是一名优秀的程序员,十分优秀!