Questions tagged [ggfortify]

Issues and questions regarding ggfortify R package - a unified interface for ggplot2 to easily plot many popular statistical packages using one line of code.

Github repo link: https://github.com/sinhrks/ggfortify

Manual can be found here: https://cran.r-project.org/web/packages/ggfortify/ggfortify.pdf

76 questions
14
votes
3 answers

Changing axis titles for autoplot

Using autoplot from ggfortify to create diagnostic plots: library(ggplot2) library(ggfortify) mod <- lm(Petal.Width ~ Petal.Length, data = iris) autoplot(mod, label.size = 3) Is it possible to change the axis and plot titles (easily)? I'd like to…
erc
  • 10,113
  • 11
  • 57
  • 88
9
votes
2 answers

Change point colors and color of frame/ellipse around points

I want to start by saying that I am a novice user of R and especially of this website, so if it is necessary that I clarify anything here, please let me know! I don't quite understand everything yet, so please feel free to "dumb down" as possible.…
9
votes
2 answers

R: ggfortify: "Objects of type prcomp not supported by autoplot"

I am trying to use ggfortify to visualize the results of a PCA I did using prcomp. sample code: iris.pca <- iris[c(1, 2, 3, 4)] autoplot(prcomp(iris.pca)) Error: Objects of type prcomp not supported by autoplot. Please use qplot() or…
JR Flanders
  • 91
  • 1
  • 1
  • 2
8
votes
2 answers

Using ggfortify and ggrepel for pca

I am running a principal component analysis with a varimax rotation and wish to display the plot which seems simple enough, however my loading vectors are very close in some places and the labels of which factor they are tend to overlap. That is…
E. Nicholson
  • 105
  • 1
  • 5
7
votes
1 answer

Add Cook's distance levels to ggplot2

How can I add the red dashed contour lines that show the Cook's distance in this first plot to the second plot using ggplot and ggfortify? Code used: library(ggfortify) model <- glm(mpg ~ wt, data = mtcars, family = gaussian()) plot(model, which…
Hasnep
  • 121
  • 3
  • 10
6
votes
1 answer

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…
ginkgotrees
  • 63
  • 1
  • 5
6
votes
0 answers

How to get same loadings scales for biplots produced from stats::biplot and ggplot2::autoplot from ggfortify R package?

The scales of loadings for biplots produced from stats::biplot and ggplot2::autoplot from ggfortify R package are different. How can I get the same loadings scales for biplots produced from stats::biplot and ggplot2::autoplot from ggfortify R…
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
5
votes
1 answer

"color" vs "colour" when calling ggfortify + autoplot on a PCA object

This is the first time I've encountered an issue with not using the Queen's spelling: if I call autoplot with colour= I get the points colored according to the referenced variable, but if I write color= the argument gets ignored and everything is…
C. Murtaugh
  • 574
  • 4
  • 15
5
votes
2 answers

HP Fortify : ASP.NET Bad Practices: Non-Serializable Object Stored in Session

The method set_UserActiveEnvironments() in HttpContextHelper.cs stores a non-serializable object as an HttpSessionState attribute on line 47, which can damage application reliability By default, ASP.NET servers store the HttpSessionState object, its…
Mohanraj R
  • 51
  • 1
  • 4
4
votes
1 answer

Why doesn't this survfit plot start at 100%

When I plot the survfit plot of data with two different censoring events, the overall plot (s0) doesnt start at time = 0, pstate = 100%, but jumps to 100% when the first cencoring event occurs. Here you can see in an example, where the jump occurs…
LittleLynx
  • 1,163
  • 2
  • 12
4
votes
1 answer

ggfortify::autoplot or ggfortify:::autoplot not working

The following code works fine: library(ggfortify) autoplot(lm(Petal.Width ~ Petal.Length, data = iris), label.size = 3) However ggfortify::autoplot and ggfortify:::autoplot do not work as expected. See below the codes with…
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
4
votes
3 answers

Show non-default principal components using autoplot (ggfortify)

I would like to plot PC2 against PC3 using the function autoplot() of the package ggfortify. By default just PC1 and PC2 are shown: library(ggfortify) myPCA <- prcomp(iris[-5]) autoplot(myPCA) I can get what I want by reordering and renaming…
albifrons
  • 303
  • 2
  • 9
3
votes
2 answers

Adding a general title to autoplot.lm

I'm plotting diagnostics plots for a regression model using autoplot. I would like to add a general single title for the graph. As example: library(ggfortify) autoplot(lm(Petal.Width ~ Petal.Length, data = iris), label.size = 3) I would like to…
rsrjohnson
  • 100
  • 1
  • 8
3
votes
1 answer

What is the difference between autoplot function and plot function in R

What is the difference between these two functions plot(AP,xlab="Date", ylab = "Passenger numbers (1000's)",main="Air Passenger numbers from 1949 to 1961") autoplot(AP) + labs(x ="Date", y = "Passenger numbers (1000's)", title="Air Passengers from…
Jojo Joseph
  • 1,493
  • 1
  • 15
  • 12
3
votes
1 answer

Labelling the legend in ggplot2 and ggfortify in R

I plotted a graph and want to customize the legend of this plot. I will appreciate all help with this. Thanks! library("survival") library("ggplot2") library("ggfortify") data(lung) lung$SurvObj <- with(lung, Surv(time, status == 2)) km.by.sex <-…
Soly
  • 155
  • 1
  • 2
  • 9
1
2 3 4 5 6