sinhrks / ggfortify

Define fortify and autoplot functions to allow ggplot2 to handle some popular R packages.
Other
525 stars 65 forks source link

PCA plot coordinates #186

Closed connorrogerson closed 6 years ago

connorrogerson commented 6 years ago

It's unclear how autoplot transforms the PC values to the coordinates that it plots. Would be useful to be able to extract the values to replot the PCA.

terrytangyuan commented 6 years ago

You can use ggfortify::fortify() to get the data used for plotting.

connorrogerson commented 6 years ago

Thanks for this. I've had a go and this just outputs exactly the same as pca$x i.e. the PC scores. What I want is the actual coordinates that autoplot plots.


From: Yuan (Terry) Tang notifications@github.com Sent: 06 February 2018 15:24 To: sinhrks/ggfortify Cc: connorrogerson; Author Subject: Re: [sinhrks/ggfortify] PCA plot coordinates (#186)

You can use ggfortify::fortify() to get the data used for plotting.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsinhrks%2Fggfortify%2Fissues%2F186%23issuecomment-363456182&data=02%7C01%7C%7C8fe70ffb9ef94165578208d56d75b6c5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636535274693512819&sdata=t7pXTsE8wn%2BF6J8VIIwL7zoMF0fVXUFsJ7FNscKYIz0%3D&reserved=0, or mute the threadhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAQHrXK8Ys3CiX_RWsoIlcO-1l6wTYokwks5tSG6rgaJpZM4R7Av9&data=02%7C01%7C%7C8fe70ffb9ef94165578208d56d75b6c5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636535274693512819&sdata=YeEdCd%2FDyPuhPQGHoEQ8k3A9Lwmn9NoTXjoVTlPehLI%3D&reserved=0.

terrytangyuan commented 6 years ago

I see. You can try this: https://stackoverflow.com/questions/12218440/is-it-possible-to-get-the-transformed-plot-data-e-g-coordinates-of-points-in

On Wed, Feb 7, 2018 at 4:27 AM connorrogerson notifications@github.com wrote:

Thanks for this. I've had a go and this just outputs exactly the same as pca$x i.e. the PC scores. What I want is the actual coordinates that autoplot plots.


From: Yuan (Terry) Tang notifications@github.com Sent: 06 February 2018 15:24 To: sinhrks/ggfortify Cc: connorrogerson; Author Subject: Re: [sinhrks/ggfortify] PCA plot coordinates (#186)

You can use ggfortify::fortify() to get the data used for plotting.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub< https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsinhrks%2Fggfortify%2Fissues%2F186%23issuecomment-363456182&data=02%7C01%7C%7C8fe70ffb9ef94165578208d56d75b6c5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636535274693512819&sdata=t7pXTsE8wn%2BF6J8VIIwL7zoMF0fVXUFsJ7FNscKYIz0%3D&reserved=0>, or mute the thread< https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAQHrXK8Ys3CiX_RWsoIlcO-1l6wTYokwks5tSG6rgaJpZM4R7Av9&data=02%7C01%7C%7C8fe70ffb9ef94165578208d56d75b6c5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636535274693512819&sdata=YeEdCd%2FDyPuhPQGHoEQ8k3A9Lwmn9NoTXjoVTlPehLI%3D&reserved=0

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sinhrks/ggfortify/issues/186#issuecomment-363708315, or mute the thread https://github.com/notifications/unsubscribe-auth/AEEnSuETAmKeiloLOpTGdqJ-lZM8GV5iks5tSWxlgaJpZM4R7Av9 .

connorrogerson commented 6 years ago

Perfect!!!

terrytangyuan commented 6 years ago

Great! Is it working for you? Feel free to close the issue if so.