Comments (7)
you can
set linetype = 'dashed'
parameter in geom_couple()
layer function.
from linket.
Is there a way to set the negative Mantel's r with dashed lines and positive Mantel's r with solid lines?
If directly set the livetype = "dashed", all lines will be dashed.
from linket.
I also want to know the positive or negative relationship between the matrixes.
from linket.
Hi Houyun,
Is it difficult to add the feature of the solid and dashed lines to make a difference between the positive or negative mantel test relationships, as shown above?
Best,
Bing
from linket.
This part is the same as pure ggplot2
, you need to map the linetype
to mantel's r and then adjust it using scale_linetype_manual()
.
Here's an example:
library(linkET)
library(ggplot2)
library(dplyr)
data("varechem", package = "vegan")
data("varespec", package = "vegan")
mantel <- mantel_test(varespec, varechem,
spec_select = list(Spec01 = 1:7,
Spec02 = 8:18,
Spec03 = 19:37,
Spec04 = 38:44)) %>%
mutate(rd = cut(r, breaks = c(-Inf, 0.2, 0.4, Inf),
labels = c("< 0.2", "0.2 - 0.4", ">= 0.4")),
pd = cut(p, breaks = c(-Inf, 0.01, 0.05, Inf),
labels = c("< 0.01", "0.01 - 0.05", ">= 0.05")))
qcorrplot(correlate(varechem), type = "lower", diag = FALSE) +
geom_square() +
geom_couple(aes(colour = pd, size = rd, linetype = r > 0),
data = mantel,
curvature = nice_curvature()) +
scale_fill_gradientn(colours = RColorBrewer::brewer.pal(11, "RdBu")) +
scale_size_manual(values = c(0.5, 1, 2)) +
scale_colour_manual(values = color_pal(3)) +
scale_linetype_manual(values = c("TRUE" = "solid", "FALSE" = "dashed")) +
guides(size = guide_legend(title = "Mantel's r",
override.aes = list(colour = "grey35"),
order = 2),
colour = guide_legend(title = "Mantel's p",
override.aes = list(size = 3),
order = 1),
fill = guide_colorbar(title = "Pearson's r", order = 3))
from linket.
Yeah, thank you Houyun. I also added the code on making my own plots. But, in both figures, why all significant Mantel's r are positive related lines and only some non-significant Mantel's r represent negative relationship? Is it a bit strange?
Best,
Bing
from linket.
Whether the result is reasonable or not requires professional knowledge to judge.😂
from linket.
Related Issues (20)
- Need a cor_tbl. HOT 1
- namespace ‘vctrs’ 0.5.1 is already loaded, but >= 0.5.2 is required HOT 1
- Caused by error in `spec_dist()`: ! could not find function "spec_dist" HOT 3
- Multiple results for CFLAGS found, something is wrong.FALSE HOT 4
- 是否可以实现热图聚类 HOT 2
- How can I use the subscription or superscription in LinkET HOT 2
- Unsure about the mantel test result HOT 3
- How to fill the missed values in matrix before running linkET? HOT 7
- 是否可以改变Mantel test连线起点和终点的形状和颜色? HOT 1
- 关于geom_square函数设定数据范围的问题 HOT 2
- upcoming 1.0.0 HOT 2
- issue in using different distance matrix for mantel test () HOT 4
- Data volume HOT 4
- what methods to calculate the correlation (r) and p.value in Mantel_test() HOT 1
- How to add significant level stars in qcorrplot function? HOT 2
- Error in cor(as.vector(xdis), ydis, method = method, use = use) : missing observations in cov/cor HOT 4
- Error in calcCurveGrob(x, x$debug) : 端点两头的值是不能相等的 HOT 5
- `correlate()` not return a matrix of p-value when `adjust = TRUE`
- How to deal with the dataframe with NA? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linket.