Skip to content

geom_encircle missing #1898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Zoewante opened this issue Dec 7, 2020 · 1 comment
Closed

geom_encircle missing #1898

Zoewante opened this issue Dec 7, 2020 · 1 comment

Comments

@Zoewante
Copy link

Zoewante commented Dec 7, 2020

The function geom_encircle, wich exist with ggplot, has yet to be implemented in plotly.

library(ggplot2)
library(plotly)
library(FactoMineR)

Simul = matrix(abs(round(rnorm(3600,0,10))),ncol=200)
row.names(Simul) = c("A", "B", "C", "D", "E","F", "G", "H", "I", "J","K","L","M", "O", "P","Q", "R","S")

res.PCA<-PCA(Simul,ncp=4,graph=FALSE)
res.HCPC<-HCPC(res.PCA,nb.clust=5,consol=FALSE,graph=FALSE)
pca_md <- res.PCA$ind
df_p <- data.frame(pca_md$coord, Boutique=row.names(Simul))
Groupe <- res.HCPC$data.clust$clust
df_p <- cbind(df_p, Groupe)

df_pc_1 <- df_p[res.HCPC$data.clust$clust == 1, ] 

p <- ggplot(data = df_p, aes(Dim.1, Dim.2)) +
  coord_cartesian(xlim = 1.2 * c(min(df_p$Dim.1), 1.1 * max(df_p$Dim.1)), 
                  ylim = 1.2 * c(min(df_p$Dim.2), 1.1 * max(df_p$Dim.2))) +   
  geom_encircle(data = df_pc_1, aes(x=Dim.1, y=Dim.2), expand=0.05)

ggplotly(p)
```
@cpsievert
Copy link
Collaborator

Duplicate of #566

@cpsievert cpsievert marked this as a duplicate of #566 Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants