Enhancing geom_text() and geom_label()

I have defined in package ‘ggpp’ enhanced versions of geom_text() and geom_label() under the names of geom_text_s() and geom_label_s() . The s is for segment, at least it was when I thought of these names. The versions described are included in version 0.5.0.

The idea of better supporting the use of data labels in ggplots is not new. I have been for a long time a user of the repulsive geometries geom_text_repel() and geom_label_repel() from package ‘ggrepel’. I have even contributed some code to ‘ggrepel’.  However, some time back when designing some new position functions, the idea of developing non-repulsive geometries suitable for data labels started growing on me.

Continue reading

from Data to Viz (external link)

from data to Viz is a new web site related to data analysis and R. Its aim is to make it easier to choose among different types of data visualisations. It looks beautiful, is easy to navigate, includes “trees” displaying a classification of visualizations and multiple individual examples with the corresponding R code.  Highly recommended!

To access the website and/or to buy the printed poster visit from Data to Viz.

 

R tips 1: playing with polynomials

Polynomial equation as annotation

Polynomial equation as annotation to a ggplot.

I have collected some code snippets I used recently for working with polynomials. The idea of writing this page came from a question I was asked a few days ago by Titta Kotilainen. I should emphasize that the page linked below concerns only polynomials, and excludes all other linear models that can be fit with lm(). Even models that are polynomials but formulated not as a regular polynomial equation (e.g. x ~ I(x^2) + x instead of the expected x + I(x^2) will quietly fail! In contrast, use of poly() as in y ~ poly(x, 2) is fine.

I used Rmarkdown in RStudio to generate a page with knitted examples, if interested the source file is also available.