Questions tagged [ggbiplot]

A biplot based on ggplot2.

This tag refer to the library ggbiplot on github for the programming language. One can install it with:

library(devtools)
install_github("vqv/ggbiplot")

It allows to plot Principal Component Analysis using ggplot (see ).

107 questions
3
votes
1 answer

How to change the line type of ellipses in ggbiplot?

Is it possible to change the type of lines of the normal probability ellipsoids in ggbiplot, e.g. have them dashed and dotted lines instead of or additional to the different colors? I couldn't find anything in the documentation of ggbiplot except…
raumkundschafter
  • 429
  • 1
  • 8
  • 24
3
votes
1 answer

PCA prcomp: how to get PC1 to PC3 graph

In my script for PCA (below), I always get a graph of PC1 vs PC2. mydata.pca <- prcomp(mydata.fixed, center = TRUE, scale. = TRUE) g <- ggbiplot(mydata.pca, obs.scale = 1, var.scale = 1, groups = mysamples, ellipse = FALSE, …
user5797184
  • 31
  • 1
  • 2
3
votes
2 answers

Q: ggbiplot _ Foreground arrows; change arrow color

I have a large data set and was trying to plot a PCA. I am rather satisfied with the resulting plot, but I would like to change a couple of things: arrows: They appear to be in the background and covered by the data points. 1) how can I foreground…
Martin Jansen
  • 31
  • 1
  • 2
3
votes
4 answers

ggbiplot - how not to use the feature vectors in the plot

I have a dataset data$cell_line.sva, which has dim of 313 11875. cc.pca <- prcomp(data$cell_line.sva, center = TRUE, scale. = TRUE, retx = TRUE) g <- ggbiplot(cc.pca, obs.scale = 1, var.scale = 1, groups = as.factor(cgpResponse), ellipse = TRUE,…
Cheng
  • 770
  • 11
  • 22
3
votes
2 answers

Specifying colour, transparency and position of arrows (line segments) in ggbiplot

I am creating a PCA biplot with multivariate data. Is there a way to specify the colour/transparency/position of line segments in ggbiplot? None of the arguments to this command provide this option. I know ggbiplot is based on ggplot - does it…
JanP
  • 31
  • 1
  • 2
3
votes
2 answers

ggbiplot - change the point size

Does someone have an idea how to change the point size and still maintain the group colors in the code below? Just adding the geom_point(size = 8) changes the colors of all the points to black. Code: library(ggbiplot) data(wine) wine.pca <-…
lroca
  • 621
  • 2
  • 8
  • 19
2
votes
1 answer

ggplot2: Adjusting label positions for the PCA loadings in a PCA biplot in R

Issue: I have produced a PCA biplot using the packages ggbiplot/ggplot2. I have lengthened the loadings (arrows) using the function geom_segment() and I would like to delete the original loadings (short arrows), keep the longer loadings (new…
Alice Hobbs
  • 1,021
  • 1
  • 15
  • 31
2
votes
0 answers

Adjusting length of box plot to remove white spaces for a gene diagram using R

Dataset1 -> Exons: Start Length adjust_start end 1 1511150 724 723 1447 2 1518357 142 7930 8072 3 1520047 167 9620 9787 4 1520343 213 9916 10129 5 1520808 207 10381 10588 6 1523700 183 13273 13456 7 1523956 129 13529 …
tacrolimus
  • 500
  • 2
  • 12
2
votes
1 answer

Visualizing PCA with large number of variables in R using ggbiplot

I am trying to visualize a PCA that includes 87 variables. prc <-prcomp(df[,1:87], center = TRUE, scale. = TRUE) ggbiplot(prc, labels = rownames(df[,1:87]), var.axes = TRUE) When I create the biplot, many of the vectors overlap with each other,…
melbez
  • 960
  • 1
  • 13
  • 36
2
votes
2 answers

Save intermediate list output in dplyr pipeline and map it back to another list further down the pipeline - R

I am running pcas on groups in a data set using dplyr pipelines. I am starting with group_split, so am working with a list. In order to run the prcomp() function, only the numeric columns of each list can be included, but I would like the factor…
J.Con
  • 4,101
  • 4
  • 36
  • 64
2
votes
2 answers

ggbiplot overlapping variables

I can't get variable labels do not overlap with ggbiplot (using RStudio 1.1.463 and R version 3.5.3) I am running a pca with prcomp but i get this kind of variable label overlapping: Here is an…
Facu
  • 101
  • 6
2
votes
1 answer

loop over characters in r for ggbiplot / ggplot

It might sound stupid but: I have a list for every country BE, AT, DE, etc. that I have performed pca, in a loop: countries <- c("BE","BG","CZ","DK","DE","EE","IE","EL","ES","FR", …
2
votes
2 answers

Errror in ggplot2/ggfortify plotting PCA

I'm getting the following error message for trying to do a (basic) plot of a PCA using ggplot2: Error in plot_label(p = p, data = plot.data, label = label, label.label = label.label, : Unsupported class: princomp The plot works in R's own…
Zurgle
  • 31
  • 1
  • 3
2
votes
0 answers

How to separate size for variables in ggbiplot PCA

I'm currently running a PCA (Principal component analysis) on a large dataset with 2000 observation and 21 variables, 20 of these variables are measurements I've done on fossils, and last 1 accounts for species. 7 of the 2000 observations are the…
2
votes
1 answer

R pca ggbiplot error : replacement has 36 rows, data has 35

I'm new to R. I was trying to use pca and ggbiplot to display the pca result but somehow stuck with some errors I could not solve. Perhaps there is a problem with my data as the code works fine with other data. I put the code and the data files I…
user4178184
  • 89
  • 1
  • 8