ggplot2 code runs and updates plot but no data actually shows up

I'm trying to produce a graph using ggplot2 in R. While I am able to generate the graph I want using plot() and when I run the ggplot code below it shows up with the proper axes, but there's no data or scale. Data looks something like this: data <- data.frame(area=c("alpha", "alpha", "bravo", "bravo", "charlie", "charlie"), year=c(2001, 2002, 2001, 2002, 2001, 200

ggplot2代码运行并更新绘图,但实际上没有数据显示

我试图在R中使用ggplot2生成一个图形。虽然我能够使用plot()生成图形,但当我在下面运行ggplot代码时,它会显示适当的坐标轴,但没有数据或比例。 数据看起来像这样: data <- data.frame(area=c("alpha", "alpha", "bravo", "bravo", "charlie", "charlie"), year=c(2001, 2002, 2001, 2002, 2001, 2002), rate=c(.94, .90, .83, .87, .87, .95)) 哪里地区是一个字符变量,年/费

Customizing a vegan pca plot with ggplot2

I'm trying to make a custom plot of some vegan rda results in ggplot2. I'm essentially modifying directions as seen in Plotting RDA (vegan) in ggplot, so that I am using shape and color labels to convey some information about the sample points. I set up a pca analysis with vegan as follows library(vegan) library(dplyr) library(tibble) library(ggplot2) cbPalette <- c("#000000", "#E6

使用ggplot2自定义纯素pca图

我试图在ggplot2中制作一些素食主义者rda结果的自定义图。 我基本上修改了ggplot中绘制RDA(素食主义者)所见的方向,以便我使用形状和颜色标签来传达有关采样点的一些信息。 我按照如下方式与素食主义者建立了一个pca分析 library(vegan) library(dplyr) library(tibble) library(ggplot2) cbPalette <- c("#000000", "#E69F00", "#56B4E9", "#009E73", "#0072B2", "#D55E00", "#CC79A7", "#F0E442") data(dune) data(du

Plotting princomp loadings with ggplot

I'm trying to carry out a PCA Analysis on my dataset, and I can plot the loadings out on the basic plot function. But I want to do them on ggplot, but I keep getting this error, "ggplot2 doesn't know how to deal with data of class loadings". I'm using the princomp function, and I'm plotting my first component against my second component. And I need to colour it on th

用ggplot绘制princomp加载

我试图对我的数据集进行PCA分析,并且可以在基本绘图函数上绘制加载。 但我想在ggplot上完成它们,但我一直得到这个错误,“ggplot2不知道如何处理类加载的数据”。 我正在使用princomp函数,并且正在绘制我的第一个组件和第二个组件。 而且我需要在外部因素的基础上着色,这个外部因素与我正在执行的数据帧具有相同的rownames。 我试图用prcomp做与本教程相同的事情,但使用pca $ loadings,但它没有奏效。 我需要在ggplot

Vegan: Significant axes in RDA

I have a data frame of phytocoenological relevés: rows represent sites columns represent species I run RDA on it using vegan function rda(matrix ~ 1) . Now I have the axes of the ordination summary(rda)$sites , but how to find out which of them are significant? And my further question is, would these approaches differ if I use different ordination methods? Thank you attention and anwer

素食主义者:RDA中的重要轴线

我有一个植物信息学相关数据框架: 行代表网站 列代表物种 我使用vegan函数rda(matrix ~ 1)在其上运行RDA。 现在我拥有排序summary(rda)$sites的坐标轴,但是如何找出它们中哪些是重要的? 而且我的进一步问题是,如果我使用不同的排序方法,这些方法会不同吗? 谢谢你的注意和安格斯。 就我个人而言,我会说没有办法。 但是,有些人提出了找出非重要坐标轴数量的方法。 其中一些是在素食主义者github问题中讨论

ggplot: Multiple years on same plot by month

So, I've hit something I don't think I have every come across. I scoured Google looking for the answer, but have not found anything (yet)... I have two data sets - one for 2015 and one for 2016. They represent the availability of an IT system. The data frames read as such: 2015 Data Set: variable value Jan 2015 100 Feb 2015 99.95 ... ... 2015 Data Set: variable value Jan 201

ggplot:按月在同一地块上多年

所以,我碰到了一些我认为我没有遇到过的事情。 我搜索谷歌寻找答案,但还没有找到任何东西(但)... 我有两个数据集 - 一个用于2015年,一个用于2016年。它们代表IT系统的可用性。 数据帧读取如下: 2015数据集: variable value Jan 2015 100 Feb 2015 99.95 ... ... 2015数据集: variable value Jan 2016 99.99 Feb 2016 99.90 ... ... 他们只是从1月至12月列出系统的可用性。 “变量”列是一个as.yearmo

Change loadings (arrows) length in PCA plot using ggplot2/ggfortify?

I have been struggling with rescaling the loadings (arrows) length in a ggplot2/ggfortify PCA. I have looked around extensively for an answer to this, and the only information I have found either code new biplot functions or refer to other entirely different packages for PCA (ggbiplot, factoextra), neither of which address the question I would like to answer: Is it possible to scale/change siz

使用ggplot2 / ggfortify更改PCA图中的加载(箭头)长度?

我一直在努力在ggplot2 / ggfortify PCA中重新调整加载(箭头)长度。 我周围环顾四周寻找答案,唯一的信息是我已经发现代码新的双触发函数或者引用PCA(ggbiplot,factoextra)的其他完全不同的包,这两个都不能解决我想回答的问题: 是否可以在ggfortify中缩放/更改PCA加载的大小? 以下是我必须使用库存R函数绘制PCA的代码以及使用autoplot / ggfortify绘制PCA的代码。 您会注意到在股票R图中,我可以通过简单乘以标量

changing individual points to group means/SE

I tried this question in stats.stackexchange and somebody suggested I try it over here, so here goes: I've completed PCA analysis, in R with VEGAN package, of some ecological data on tree health. There are 80 trees total (so, 80 'sites') divided into four treatment categories. I've got the data plotted with color coded points--colors according to the treatment groups. Rather

将个别点改为组合手段/ SE

我在stats.stackexchange中试过这个问题,有人建议我在这里尝试一下,所以在这里: 我已用RAN和VEGAN软件包完成了一些有关树木健康的生态数据的PCA分析。 总共有80棵树(如此,80个地点)分成四个处理类别。 我已经用颜色编码的点绘制了数据 - 根据治疗组的颜色。 我不想在PCA双槽图上绘制单独的网站/树,我想制作一个像盒子一样的图,它有四个“十字”,它们显示每个组的质心和两个PCA维度的SE。 我在论文中看到过这样的人

R: Plot works, but ggplot doesn't

I have some data from the 2008 election, which I've aggregated in the hopes of making a couple graphics about out-party voting. The data looks like this: > voting voteObama voteMcCain partyID totalvote outvotenumber outVoteProportion 1 325.5233 16.3212 1-Strong Dem 341.8445 16.3212 0.04774452 2 202.7162 32.6342 2-Weak Dem 235.3504 32.6342 0.13

R:绘图工程,但ggplot没有

我收集了2008年大选的一些数据,我已经汇总了这些数据,希望能够制作一些关于外派投票的图形。 数据如下所示: > voting voteObama voteMcCain partyID totalvote outvotenumber outVoteProportion 1 325.5233 16.3212 1-Strong Dem 341.8445 16.3212 0.04774452 2 202.7162 32.6342 2-Weak Dem 235.3504 32.6342 0.13866218 3 201.8810 20.7225 3-Lean Dem 222.6035

page pdf file of a grid of ggplot plots

I am trying to generate a multi-page pdf of a grid of ggplots from a list of ggplots. I have tried very many ways to do this and have not succeeded. Here is a reproducible equivalent to what I have been working with: library(ggplot2) # generate a data frame w same structure as the one I'm working with time <- c(1:10) veclist <- list() veclist[[1]] <- time for (i in 2:25){ veclist[

ggplot图的网格页面pdf文件

我正尝试从ggplots列表中生成ggplots网格的多页面pdf。 我尝试了很多方法来做到这一点,但没有成功。 这是一个与我一直合作的重现相当的事物: library(ggplot2) # generate a data frame w same structure as the one I'm working with time <- c(1:10) veclist <- list() veclist[[1]] <- time for (i in 2:25){ veclist[[i]] <- as.vector(c(runif(10,-2,2))) } d <- as.data.frame(do.call(rbind, vec

plotting multiple images together using ggmap and plotRGB

I am trying to display one picture made of 2 plots, with on the left-side a plot given by: plotRGB(myRasterBrick, b=1, g=2, r=3) on the right-side a plot given by: ggmap(Gmap)+geom_polygon(aes(x=x, y=y), data=df, alpha=.4) Both images can be displayed perfectly well independently, but I cannot find a way to display them together, one left, one right. To give you more detail, here is my full

使用ggmap和plotRGB将多个图像一起绘制

我试图显示一张由2张图组成的图片,左侧显示的图是: plotRGB(myRasterBrick, b=1, g=2, r=3) 在右侧给出了一个情节: ggmap(Gmap)+geom_polygon(aes(x=x, y=y), data=df, alpha=.4) 这两个图像都可以独立完美地显示,但我无法找到一种方法将它们一起显示,一个左侧,一个右侧。 给你更多的细节,这里是我的完整脚本: 对于我的第一张图片: #request a satellite image from Google lat <- 1.266 lon <- 34.348 G