Open BinhongLiu opened 4 years ago
I tried this code with the demo data:
ggordpoint(obj=pcoares, biplot=TRUE, speciesannot=TRUE,
mapping=aes(size="time"),
factorNames=c("time"), ellipse=TRUE) +
scale_color_manual(values=c("#2874C5", "#EABF00"))
It showed this error: 错误: stat_ord_ellipse requires the following missing aesthetics: x and y
After I added the x and y:
ggordpoint(obj=pcoares, biplot=TRUE, speciesannot=TRUE,
mapping=aes(x=pcoares@pca$vectors[,1],y=pcoares@pca$vectors[,2],size="time"),
factorNames=c("time"), ellipse=TRUE) +
scale_size_manual(values = c("Early"=12,"Late"=1))
The plot was still the same. Could you provide some demo about this function? Many thanks!
When your want to set it by yourself, only alpha can be setted, the first element of factorNames has been setted to map color, and the second element of factorNames has been setted to map shape. Please reinstall github version and use the following codes.
p <- ggordpoint(obj=pcoares, biplot=TRUE, speciesannot=TRUE,
mapping=aes(alpha=time),
factorNames=c("time", "time"), ellipse=TRUE) +
scale_color_manual(values=c("#2874C5", "#EABF00"))
The first time
will be mapped to color of point, and second time
(if you have other variable) will be mapped to shape of point. and third continuous variable can be mapped to alpha. Because I don't have the datasets contained three variable.
Note: The gg
functions of MicrobiotaProcess
are not general like ggplot2
or other ggplot2-extension
, because I want them to plot the figures to reduce the amout of codes of users, and geneatare the publicaton figures. So I want to keep a balance between reducing the amount of codes of users and flexibility.
Thanks! That help me a lot!
Learned from your answer above, I have known that factorNames can set the alpha,shape and fill. but I just want to change the shape.and just want a figure plot with circle point and different color fill.how should I code?Thanks!
The previous version didn't export the starshape
of ggstar
. (the point layer is provided by ggstar
since it can provide more shapes). I will set the default shape to the circle point. But I recommend you use mp_cal_pca
or mp_cal_pcoa
to perform the analysis of PCA
or PCoA
. I re-built the framework based on MPSE
object inherited SummarizedExperiment
object and tibble
(need re-install via remotes::install_github("YuLab-SMU/MicrobiotaProcess")
). I am rebuilding the vignettes, but, you can also follow the examples of them. And you can use mp_import_dada2
, mp_import_qiime
or mp_import_qiime2
to parse the output of upstream analysis.
Hi Shuangbin, I'm wondering how to set the aesthetic mapping of PCoA use the mapping parameter in the ggordpoint function. It seems to be that I can change the shape, size, or alpha of the points using this function just like ggplot2. Could you provide some demo about this function? Thanks!