GGally :: ggpairs图不显示相关系数 [英] GGally::ggpairs plot does not display correlation coefficients
问题描述
我试图理解为什么在传递命令ggpairs(iris, mapping=ggplot2::aes(colour = Species))
I am trying to understand why the plot with the correlation coefficient is not showing while passing the command ggpairs(iris, mapping=ggplot2::aes(colour = Species))
这是它的样子: 显示相关系数的图不可见
如果我在情节上执行检查元素,则html中的图片标签为:
if i perform inspect element on the plot, the image tag in the html is:
<img id="img" width="100%" height="100%" style="display: inline;" src="http://127.0.0.1:27032/graphics/b7091da9-1a0a-4672-902e-7c844add4aa9.png">
我刚刚开始学习R,因此这使我感到困惑.我觉得这是语言环境的问题,所以我尝试通过
I have just started learning R and hence this confounded me. I felt like it was an issue with the locale so i tried experimenting by
Sys.setlocale("LC_ALL", 'en_US.UTF-8')
尽管再次调用了库,但没有任何改变.
By nothing changed despite calling the libraries again.
以下是一些详细信息:
R version 4.0.1 (2020-06-06) running on Arch Linux x86_64 5.6.15-arch1-1
> Sys.getlocale()
[1] "LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=C;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C"
如果我没有提供足够的数据,我深表歉意.如果是这种情况,我将进行更新.
I apologize if I haven't provided enough data. I shall update this if that is the case.
使用install.packages("GGally", type = 'source')
> install.packages("GGally", type = 'source')
Installing package into ‘/home/mogad0n/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/GGally_2.0.0.tar.gz'
Content type 'application/x-gzip' length 1393325 bytes (1.3 MB)
==================================================
downloaded 1.3 MB
* installing *source* package ‘GGally’ ...
** package ‘GGally’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (GGally)
The downloaded source packages are in
‘/tmp/RtmpvIM27v/downloaded_packages’
推荐答案
在Linux中渲染等宽字体时,这显然与冲突有关—冲突似乎与tex
有关(请参阅此处和
This apparently has to do with a conlfict when rendering monospace fonts in linux -- the conflict appears to have something to do with tex
(see here and here).
This is what it looked like before:
library(GGally)
iris %>%
select(Sepal.Length:Petal.Width) %>%
ggpairs()
输出:
,然后我告诉它使用sans
字体:
and after I told it to use a sans
font:
iris %>%
select(Sepal.Length:Petal.Width) %>%
ggpairs(upper = list(continuous = wrap("cor", family="sans")))
输出:
在Ubuntu 20.04和R版本4.0.2上为我工作
worked for me on Ubuntu 20.04 and R version 4.0.2
这篇关于GGally :: ggpairs图不显示相关系数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!