Skip to content

geom_encircle missing  #1898

Closed
Closed
@Zoewante

Description

@Zoewante

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)
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions