plotly / plotly/plotly.R

Can you implement geom_GeomTextNpc() in plotly ?

Ouverte
#1,921 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
R
Étoiles
2.7k
Forks
641
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

Hi,
I'm using the package ggpmisc to display on ggplot graphique the R² and equation of regression thanks to ggpmisc::stat_poly_eq().
This is working well when I am plotting the ggplot graphic. But when I want to use the function ggplotly() to display the graphic, the R² and the equation disappear.
I receive this messages :
Warning message: In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) : geom_GeomTextNpc() has yet to be implemented in plotly. If you'd like to see this geom implemented, Please open an issue with your example code at https://github.com/ropensci/plotly/issues

If you have the time, and the desire to implement geom_GeomTextNpc() in plotly, it could be super nice.

I give you a small code to reproduce the problem

#Data cration

df<-tibble(a=c(2,6,3,4,10),
           b=c(3,6,9,12,15))
df

#relation
myFormula<- y ~ poly(x,2,raw = TRUE)

#ggplot
df_plot<-ggplot(data = df,aes(x = a,y = b))+
  geom_point()+
  geom_smooth(method = lm,
              formula = myFormula)+
  ggtitle("polynomial 2")+
    #from here problem with ggplotly
  ggpmisc::stat_poly_eq(
    aes(label=paste("atop(",stat(rr.label),",",
                    stat(eq.label),")",
                    sep="")),
    formula = myFormula,parse = TRUE)

df_plot

#plotly
ggplotly(df_plot)

The ggplot graphic :
ggplot_with_equation

And here the graphic with plotly:
ggplotly

Thank you for creating and implementing plotly 👍
Best,
Fanny

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par l’avertissement geom2trace.default pour geom_GeomTextNpc() et exécutez la reproduction fournie ggplotly(df_plot). Suivez la manière dont ggplotly convertit les couches ggplot2, puis déterminez l’implémentation nécessaire pour ce geom. Le travail est terminé lorsque l’avertissement a disparu et que R² ainsi que l’équation de régression apparaissent dans le graphique interactif.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
plotly, r
Domaine
data-visualization
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.