Graeme Frost
Graeme Frost

Reputation: 2623

How do I change the axis sizes in pca2d?

I'm using the pca3d package to plot principle components 1-5 of gene expression data. I was having a hard time standardizing the 3d plot, so instead I plotted PC1 vs PC2, PC2 vs PC3, etc. My code for that is below

par(mfrow = c(2,2))
for(n in 1:4){

  pca2d(pcaSix$x[,n:(n+1)], # Mclust Grouping - module Genes
        title = "Six Genes From Abel, et al. 2011",
        shape = 16,
        group = clustersMod1six,
        radius = 1,
        legend = NULL,
        show.centroids = FALSE,
        show.ellipses = TRUE,
        col = ClusterColorsSix,
        axe.titles = c(paste("PCA",
                             n,
                             sep = ""),
                       paste("PCA",
                             n+1,
                             sep = "")
                       ),
        xlim = c(-1,1),
        ylim = c(-1,1)
        ) 

}

The issue that I'm having is that the xlim and ylim arguments do not appear to have any effect on the plot, I found this post that suggested using the asp argument, but setting asp did not allow me to change the axes.

Does anyone know how I could force pca2d to change the axes limits?

Upvotes: 0

Views: 390

Answers (1)

Roman Luštrik
Roman Luštrik

Reputation: 70643

Without modifying the function, there is no way to control the axes. See line 32:

plot(NULL, type= "n", 
  xlim= prange$x,
  ylim= prange$y,
  xlab= xlab,
  ylab= ylab,
  bty= "none"
  ) 

Upvotes: 1

Related Questions