Skip to content
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

Edit the tool tips in all plots to be more informative #4

Open
sanoke opened this issue Apr 12, 2017 · 1 comment
Open

Edit the tool tips in all plots to be more informative #4

sanoke opened this issue Apr 12, 2017 · 1 comment
Assignees
Labels

Comments

@sanoke
Copy link
Owner

sanoke commented Apr 12, 2017

At the moment the tooltip contains ggplotly() default text. This text needs to be revised to contain more helpful information.

[Moved from sanoke/hetviz-dev#7]

@sanoke
Copy link
Owner Author

sanoke commented May 11, 2017

Fixing the text in the tooltip requires parsing of plotly_build(p), where p is a ggplot2 object/plot. While there's documentation on what aspects of this object to edit to customize the tooltip information, there is not documentation on how to automate this procedure. For example, the plotly_build(p) is a list, its length corresponding somehow to the layers of the ggplot2 object p. I can't tell which layers in p correspond to which elements in plotly_build(p)... I may have to cycle through the list and select out for $type.

In any case, below is a print out of the plotly_build() output behind this figure.

forest plot

> q$x$data
[[1]]
[[1]]$x
[1]  0.55 10.45

[[1]]$y
[1] 5.343169 5.343169

[[1]]$text
[1] "yintercept: 5.343169"

[[1]]$type
[1] "scatter"

[[1]]$mode
[1] "lines"

[[1]]$line
[[1]]$line$width
[1] 0.3779528

[[1]]$line$color
[1] "rgba(0,0,255,1)"

[[1]]$line$dash
[1] "solid"


[[1]]$hoveron
[1] "points"

[[1]]$showlegend
[1] FALSE

[[1]]$xaxis
[1] "x"

[[1]]$yaxis
[1] "y"

[[1]]$hoverinfo
[1] "text"

[[1]]$frame
[1] NA


[[2]]
[[2]]$x
 [1]  7  7 NA  1  1 NA  4  4 NA  9  9 NA  2  2 NA 10 10 NA  8  8 NA  5  5 NA  3  3 NA  6  6

[[2]]$y
 [1]  5.82100  5.99950       NA  0.86800  0.91600       NA  4.80000  4.84275       NA  8.98425  9.04500       NA
[13]  1.23800  1.89700       NA  9.87375 10.00375       NA  6.10500  8.84400       NA  5.03100  5.11100       NA
[25]  1.93350  4.72000       NA  5.67100  5.77975

[[2]]$text
 [1] "estGrp:  7<br />Q25: 5.82100<br />Q75:  5.99950<br />estGrp:  7<br />estGrp:  7<br />Q50: 5.82100"
 [2] "estGrp:  7<br />Q25: 5.82100<br />Q75:  5.99950<br />estGrp:  7<br />estGrp:  7<br />Q50: 5.82100"
 [3] NA                                                                                                 
 [4] "estGrp:  1<br />Q25: 0.86800<br />Q75:  0.91600<br />estGrp:  1<br />estGrp:  1<br />Q50: 0.86800"
 [5] "estGrp:  1<br />Q25: 0.86800<br />Q75:  0.91600<br />estGrp:  1<br />estGrp:  1<br />Q50: 0.86800"
 [6] NA                                                                                                 
 [7] "estGrp:  4<br />Q25: 4.80000<br />Q75:  4.84275<br />estGrp:  4<br />estGrp:  4<br />Q50: 4.80000"
 [8] "estGrp:  4<br />Q25: 4.80000<br />Q75:  4.84275<br />estGrp:  4<br />estGrp:  4<br />Q50: 4.80000"
 [9] NA                                                                                                 
[10] "estGrp:  9<br />Q25: 8.98425<br />Q75:  9.04500<br />estGrp:  9<br />estGrp:  9<br />Q50: 8.98425"
[11] "estGrp:  9<br />Q25: 8.98425<br />Q75:  9.04500<br />estGrp:  9<br />estGrp:  9<br />Q50: 8.98425"
[12] NA                                                                                                 
[13] "estGrp:  2<br />Q25: 1.23800<br />Q75:  1.89700<br />estGrp:  2<br />estGrp:  2<br />Q50: 1.23800"
[14] "estGrp:  2<br />Q25: 1.23800<br />Q75:  1.89700<br />estGrp:  2<br />estGrp:  2<br />Q50: 1.23800"
[15] NA                                                                                                 
[16] "estGrp: 10<br />Q25: 9.87375<br />Q75: 10.00375<br />estGrp: 10<br />estGrp: 10<br />Q50: 9.87375"
[17] "estGrp: 10<br />Q25: 9.87375<br />Q75: 10.00375<br />estGrp: 10<br />estGrp: 10<br />Q50: 9.87375"
[18] NA                                                                                                 
[19] "estGrp:  8<br />Q25: 6.10500<br />Q75:  8.84400<br />estGrp:  8<br />estGrp:  8<br />Q50: 6.10500"
[20] "estGrp:  8<br />Q25: 6.10500<br />Q75:  8.84400<br />estGrp:  8<br />estGrp:  8<br />Q50: 6.10500"
[21] NA                                                                                                 
[22] "estGrp:  5<br />Q25: 5.03100<br />Q75:  5.11100<br />estGrp:  5<br />estGrp:  5<br />Q50: 5.03100"
[23] "estGrp:  5<br />Q25: 5.03100<br />Q75:  5.11100<br />estGrp:  5<br />estGrp:  5<br />Q50: 5.03100"
[24] NA                                                                                                 
[25] "estGrp:  3<br />Q25: 1.93350<br />Q75:  4.72000<br />estGrp:  3<br />estGrp:  3<br />Q50: 1.93350"
[26] "estGrp:  3<br />Q25: 1.93350<br />Q75:  4.72000<br />estGrp:  3<br />estGrp:  3<br />Q50: 1.93350"
[27] NA                                                                                                 
[28] "estGrp:  6<br />Q25: 5.67100<br />Q75:  5.77975<br />estGrp:  6<br />estGrp:  6<br />Q50: 5.67100"
[29] "estGrp:  6<br />Q25: 5.67100<br />Q75:  5.77975<br />estGrp:  6<br />estGrp:  6<br />Q50: 5.67100"

[[2]]$type
[1] "scatter"

[[2]]$mode
[1] "lines"

[[2]]$line
[[2]]$line$width
[1] 1.889764

[[2]]$line$color
[1] "rgba(0,0,0,1)"

[[2]]$line$dash
[1] "solid"


[[2]]$hoveron
[1] "points"

[[2]]$showlegend
[1] FALSE

[[2]]$xaxis
[1] "x"

[[2]]$yaxis
[1] "y"

[[2]]$hoverinfo
[1] "text"

[[2]]$frame
[1] NA


[[3]]
[[3]]$x
 [1]  7  7 NA  1  1 NA  4  4 NA  9  9 NA  2  2 NA 10 10 NA  8  8 NA  5  5 NA  3  3 NA  6  6

[[3]]$y
 [1]  5.798000  6.074000        NA  0.825500  0.937000        NA  4.774000  4.886125        NA  8.951000
[11]  9.110125        NA  0.938000  1.917000        NA  9.783000 10.075000        NA  6.075000  8.950000
[21]        NA  4.953000  5.135000        NA  1.918000  4.773000        NA  5.592875  5.797000

[[3]]$text
 [1] "estGrp:  7<br />wL: 5.798000<br />wR:  6.074000<br />estGrp:  7<br />estGrp:  7<br />Q50: 5.798000"
 [2] "estGrp:  7<br />wL: 5.798000<br />wR:  6.074000<br />estGrp:  7<br />estGrp:  7<br />Q50: 5.798000"
 [3] NA                                                                                                  
 [4] "estGrp:  1<br />wL: 0.825500<br />wR:  0.937000<br />estGrp:  1<br />estGrp:  1<br />Q50: 0.825500"
 [5] "estGrp:  1<br />wL: 0.825500<br />wR:  0.937000<br />estGrp:  1<br />estGrp:  1<br />Q50: 0.825500"
 [6] NA                                                                                                  
 [7] "estGrp:  4<br />wL: 4.774000<br />wR:  4.886125<br />estGrp:  4<br />estGrp:  4<br />Q50: 4.774000"
 [8] "estGrp:  4<br />wL: 4.774000<br />wR:  4.886125<br />estGrp:  4<br />estGrp:  4<br />Q50: 4.774000"
 [9] NA                                                                                                  
[10] "estGrp:  9<br />wL: 8.951000<br />wR:  9.110125<br />estGrp:  9<br />estGrp:  9<br />Q50: 8.951000"
[11] "estGrp:  9<br />wL: 8.951000<br />wR:  9.110125<br />estGrp:  9<br />estGrp:  9<br />Q50: 8.951000"
[12] NA                                                                                                  
[13] "estGrp:  2<br />wL: 0.938000<br />wR:  1.917000<br />estGrp:  2<br />estGrp:  2<br />Q50: 0.938000"
[14] "estGrp:  2<br />wL: 0.938000<br />wR:  1.917000<br />estGrp:  2<br />estGrp:  2<br />Q50: 0.938000"
[15] NA                                                                                                  
[16] "estGrp: 10<br />wL: 9.783000<br />wR: 10.075000<br />estGrp: 10<br />estGrp: 10<br />Q50: 9.783000"
[17] "estGrp: 10<br />wL: 9.783000<br />wR: 10.075000<br />estGrp: 10<br />estGrp: 10<br />Q50: 9.783000"
[18] NA                                                                                                  
[19] "estGrp:  8<br />wL: 6.075000<br />wR:  8.950000<br />estGrp:  8<br />estGrp:  8<br />Q50: 6.075000"
[20] "estGrp:  8<br />wL: 6.075000<br />wR:  8.950000<br />estGrp:  8<br />estGrp:  8<br />Q50: 6.075000"
[21] NA                                                                                                  
[22] "estGrp:  5<br />wL: 4.953000<br />wR:  5.135000<br />estGrp:  5<br />estGrp:  5<br />Q50: 4.953000"
[23] "estGrp:  5<br />wL: 4.953000<br />wR:  5.135000<br />estGrp:  5<br />estGrp:  5<br />Q50: 4.953000"
[24] NA                                                                                                  
[25] "estGrp:  3<br />wL: 1.918000<br />wR:  4.773000<br />estGrp:  3<br />estGrp:  3<br />Q50: 1.918000"
[26] "estGrp:  3<br />wL: 1.918000<br />wR:  4.773000<br />estGrp:  3<br />estGrp:  3<br />Q50: 1.918000"
[27] NA                                                                                                  
[28] "estGrp:  6<br />wL: 5.592875<br />wR:  5.797000<br />estGrp:  6<br />estGrp:  6<br />Q50: 5.592875"
[29] "estGrp:  6<br />wL: 5.592875<br />wR:  5.797000<br />estGrp:  6<br />estGrp:  6<br />Q50: 5.592875"

[[3]]$type
[1] "scatter"

[[3]]$mode
[1] "lines"

[[3]]$line
[[3]]$line$width
[1] 0.3779528

[[3]]$line$color
[1] "rgba(0,0,0,1)"

[[3]]$line$dash
[1] "solid"


[[3]]$hoveron
[1] "points"

[[3]]$showlegend
[1] FALSE

[[3]]$xaxis
[1] "x"

[[3]]$yaxis
[1] "y"

[[3]]$hoverinfo
[1] "text"

[[3]]$frame
[1] NA


[[4]]
[[4]]$x
 [1]  7  1  4  9  2 10  8  5  3  6

[[4]]$y
 [1] 5.8610 0.8975 4.8220 9.0190 1.8780 9.9665 6.1450 5.0730 1.9620 5.7560

[[4]]$text
 [1] "estGrp:  7<br />Q50: 5.8610" "estGrp:  1<br />Q50: 0.8975" "estGrp:  4<br />Q50: 4.8220"
 [4] "estGrp:  9<br />Q50: 9.0190" "estGrp:  2<br />Q50: 1.8780" "estGrp: 10<br />Q50: 9.9665"
 [7] "estGrp:  8<br />Q50: 6.1450" "estGrp:  5<br />Q50: 5.0730" "estGrp:  3<br />Q50: 1.9620"
[10] "estGrp:  6<br />Q50: 5.7560"

[[4]]$type
[1] "scatter"

[[4]]$mode
[1] "markers"

[[4]]$marker
[[4]]$marker$autocolorscale
[1] FALSE

[[4]]$marker$color
[1] "transparent"

[[4]]$marker$opacity
[1] 1

[[4]]$marker$size
[1] 1.641428

[[4]]$marker$symbol
[1] "circle"

[[4]]$marker$line
[[4]]$marker$line$width
[1] 1.889764

[[4]]$marker$line$color
[1] "rgba(255,0,0,1)"



[[4]]$hoveron
[1] "points"

[[4]]$showlegend
[1] FALSE

[[4]]$xaxis
[1] "x"

[[4]]$yaxis
[1] "y"

[[4]]$hoverinfo
[1] "text"

[[4]]$frame
[1] NA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

1 participant