Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R ggplot2在旋转x标签后返回空打印_R_Ggplot2 - Fatal编程技术网

R ggplot2在旋转x标签后返回空打印

R ggplot2在旋转x标签后返回空打印,r,ggplot2,R,Ggplot2,我得到了比较两个基因组(第1列和第2列)的数据,以及它们与指示物种基因组比较数量的指数的相似性: Genome1 Genome2 % of similarity 1 in 2 % of similarity 2 in 1 Species index 1: GCF_001956585.1 GCF_002860635.1 65.2 65.0

我得到了比较两个基因组(第1列和第2列)的数据,以及它们与指示物种基因组比较数量的指数的相似性:

 Genome1               Genome2             % of similarity 1 in 2   % of similarity 2 in 1       Species        index
 1: GCF_001956585.1 GCF_002860635.1                  65.2                  65.0      Actinomyces_naeslundii     1
 2: GCF_001937545.1 GCF_001937675.1                  78.8                  79.1            Actinomyces_oris     1
 3: GCF_001937545.1 GCF_001937725.1                  80.9                  73.5            Actinomyces_oris     2
 4: GCF_001937675.1 GCF_001937725.1                  78.4                  71.1            Actinomyces_oris     3
 5: GCF_001262035.1 GCF_003130125.1                  92.6                  93.5 Aggregatibacter_aphrophilus     1
 6: GCF_001262035.1 GCF_003252995.1                  82.8                  84.3 Aggregatibacter_aphrophilus     2
 7: GCF_003130125.1 GCF_003252995.1                  84.5                  84.8 Aggregatibacter_aphrophilus     3
 8: GCF_001059425.1 GCF_003130095.1                  92.4                  89.3      Aggregatibacter_segnis     1
 9: GCF_001059425.1 GCF_003252685.1                  90.1                  90.1      Aggregatibacter_segnis     2
10: GCF_003130095.1 GCF_003252685.1                  87.0                  89.8      Aggregatibacter_segnis     3
我试图旋转一个几何点图的x标签。

标签已成功旋转,但图形为空(不显示数据)


g这个代码适合我。看这里

资料


请提供一些数据,以便于回答。看到这里了吗?你没有将
g+geom_point()
的结果保存回
g
@AlmogAngel我的帖子回答了你的问题吗?是的,谢谢!
g <- ggplot(data = compareset, aes(x = Species, y =`% of similarity 1 in 2`, col = index))
g + geom_point()
g + theme(axis.text.x = element_text(angle = 90, hjust = 1))
set.seed(1)
myFun <- function(n) {
  a <- do.call(paste0, replicate(5, sample(LETTERS, n, TRUE), FALSE))
  paste0(a, sprintf("%04d", sample(9999, n, TRUE)), sample(LETTERS, n, TRUE))
}

n <- 20
compareset <- data.frame(Species= myFun(n=n), y= rnorm(n), index= factor(rep(c(1,2), n/2)))
library(ggplot2)

g <- ggplot(data = compareset, aes(x = Species, y = y, col = index))
g <- g + geom_point()
g <- g + theme(axis.text.x = element_text(angle = 90, hjust = 1))
g
compareset <- data.frame(similarity= c(65.2, 78.8, 80.9, 78.4, 92.6,
                                       82.8, 84.5, 92.4, 90.1, 87.0),
                         Species= c("Actinomyces_naeslundii1", "Actinomyces_oris1", "Actinomyces_oris2", "Actinomyces_oris3", "Aggregatibacter_aphrophilus1",
                                  "Aggregatibacter_aphrophilus2", "Aggregatibacter_aphrophilus3", "Aggregatibacter_segnis1", "Aggregatibacter_segnis2", "Aggregatibacter_segnis3"),
                         index= c(1,1,2,3,1,2,3,1,2,3))

g <- ggplot(data = compareset, aes(x = Species, y = similarity, col = index))
g <- g + geom_point()
g <- g + theme(axis.text.x = element_text(angle = 90, hjust = 1))
g