Can you implement geom_GeomTextNpc() in plotly ?
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- R
- Star
- 2.7k
- Fork
- 641
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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 :

And here the graphic with plotly:

Thank you for creating and implementing plotly 👍
Best,
Fanny
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với cảnh báo geom2trace.default cho geom_GeomTextNpc() và chạy reproduction ggplotly(df_plot) được cung cấp. Theo dõi cách các layer ggplot2 được ggplotly chuyển đổi, sau đó xác định phần triển khai cần thiết cho geom này. Hoàn thành khi cảnh báo biến mất và R² cùng phương trình hồi quy xuất hiện trong biểu đồ tương tác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- plotly, r
- Lĩnh vực
- data-visualization
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100