Closed plijnzaad closed 10 months ago
Hi @plijnzaad, have you tried using geom_text()
rather than geom_label()
? The documentation (help(geom_label)
) indicates that the angle
aesthetic is only supported by the 'text' geom.
yes, geom_text
works, many thanks! Is there a way to make the rotation angle of 'unk' and 'dbl' different from the rest? I can't get my head around this, to be honest :-(
OK, cool. To rotate different elements differently, i think you'll need to either (a) create a variable in the data set indicating which ones to rotate differently and pass that variable to angle
in aes()
or (b) create a standalone vector of angles and pass it to angle
outside aes()
. See the geom_text
and related ggplot2 documentation for any more details on that!
@plijnzaad i assume that this is resolved, at least insofar as i can help, but please do reopen this issue if i is not!
I'm trying to rotate the labels in the axes in order to cram more information in it (e.g. the percentages of the counts per stratum in that axis). I intend to rename the actual data for this (surely there must be a more elegant way? I.e. lookup or calculate the percentage string on the fly??) but there is not enough room, so rotating the text could solve that. The code I have is:
which doesn't seem to work, it gives this:
I would like the first axis to have something like '0 (49.4%)', '1 (47.7%)', 'dbl (2.6%)' and 'unk (0.3%)' plotted vertically (OK, those last two won't fit) and likewise for the other axes. What am I doing wrong? This is R version 4.2.3 on Mac, ggalluvial version 0.12.5.
Kind regards,
Philip