Trying to build a hook in the plot for ggrepel (geom_text_repel)

The link below talks about how you can build a hook into the plot using a call gets3methodsfrom to.basic. However, this only works for geometers that break down into simpler geometries (from geom_lineto geom_path). For geom_text_repelI'm not sure if this is possible.

The following indicates that you need to create your own method for geom2trace. How to do it? I'm new to the S3 recommendations and doing something similar, so I'm not quite sure where to start here.

If I run methods(geom2trace), I get:

> methods(geom2trace)
 [1] geom2trace.default*       geom2trace.GeomBar*       geom2trace.GeomBlank*     geom2trace.GeomBoxplot*   geom2trace.GeomErrorbar* 
 [6] geom2trace.GeomErrorbarh* geom2trace.GeomPath*      geom2trace.GeomPoint*     geom2trace.GeomPolygon*   geom2trace.GeomText*     
[11] geom2trace.GeomTile*     
see '?methods' for accessing help and source code

and I see a geom2trace.GeomText, which seems to be something that is needed here.

Any guidance here would be a huge help in me trying to create an interactive wordcloud! It is also nice to share the results of this project.

In more complex cases, when your custom geometry cannot be converted to lower-level geometry, the custom method for geom2trace () is generic required (the (geom2trace) methods list all the basic geomes that we initially supported). This method should include the conversion from data frame to list, similar to the plotly.js Help object.

https://plotly-book.cpsievert.me/translating-custom-ggplot2-geoms.html

+4
source share

Source: https://habr.com/ru/post/1693936/


All Articles