Featured image of post Direct labels using {geomtextpath}

Direct labels using {geomtextpath}

This is a quick post to try out {geomtextpath}.

I have skimmed through the package’s vignettes and it seems pretty cool. But what did catch my eye was mainly this example below.

And when I saw that, I thought that for me, the major use case for this package, would be direct labeling line plots. Perhaps it’s a more convenient alternative. So let’s see.

I would start with this quick-and-dirty line plot.

Reading the package’s vignette, my thought was that one could just use geom_textline() and play with vjust and hjust to automagically direct label the lines. So let’s try.

Ok, good enough. Now just use vjust and hjust to put the labels towards the end of the line and prevent the text to overplot the line (and also remove the legend for color, which would not be needed anymore).

mmm, ok, it kinda works, but for this particular dataset, the data towards the end of the lines do not help and labels end-up being unreadable.

So let’s try at the beginning of the lines?

Yeah, a bit better. Far from perfect, though.

But that was the idea of this post. Just to take a look at the package and see how easy and effective would be to use it to direct label line plots.

comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy