Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This script generate a SVG file wherein you can interactively annotate the points.</p> <pre><code>library(ggplot2) library(gridSVG) geom_point2 &lt;- function (...) GeomPoint2$new(...) GeomPoint2 &lt;- proto(GeomPoint, { objname &lt;- "point2" draw &lt;- function(., data, scales, coordinates, na.rm = FALSE, ...) { data &lt;- remove_missing(data, na.rm, c("x", "y", "size", "shape"), name = "geom_point") if (empty(data)) return(zeroGrob()) name &lt;- paste(.$my_name(), data$PANEL[1], sep = ".") with(coordinates$transform(data, scales), ggname(name, pointsGrob(x, y, size = unit(size, "mm"), pch = shape, gp = gpar(col = alpha(colour, alpha), fill = fill, label = label, fontsize = size * .pt)))) }} ) p &lt;- ggplot(mtcars, aes(mpg, wt, label = rownames(mtcars))) + geom_point2() + facet_wrap(~ gear) print(p) grob_names &lt;- grid.ls(print = FALSE)$name point_grob_names &lt;- sort(grob_names[grepl("point", grob_names)]) point_grobs_labels &lt;- lapply(point_grob_names, function(x) grid.get(x)$gp$label) library(rjson) jlabel &lt;- toJSON(point_grobs_labels) grid.text("value", 0.05, 0.05, just = c(0, 0), name = "text_place", gp = gpar(col = "red")) script &lt;- ' var txt = null; function f() { var id = this.id.match(/geom_point2.([0-9]+)\\.points.*\\.([0-9]+)$/); txt.textContent = label[id[1]-1][id[2]-1]; } window.addEventListener("load",function(){ var es = document.getElementsByTagName("circle"); for (i=0; i&lt;es.length; ++i) es[i].addEventListener("mouseover", f, false); txt = (document.getElementById("text_place").getElementsByTagName("tspan"))[0]; },false); ' grid.script(script = script) grid.script(script = paste("var label = ", jlabel)) gridToSVG() </code></pre> <p>Do you know some places I can upload SVG file?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload