aphalo/ggpp

Justification and the new nudge functions

Closed this issue · 3 comments

This issue belongs here in 'ggpp' although it is in 'ggpmisc' as it was openned before the package split: aphalo/ggpmisc#3

It needs to be explored if justification could be also adjusted for each text label dynamically in the position functions in the same way as the nudges are. This would be very useful when the length of the label text varies, as in this case constant nudge would result in varying distances.

I need to investigate if justification can be modified/set within position functions by editing the data object returned by the compute_layer() function... if this is true, it would provide a back door to implementing coordinated nudging and justification.

No backdoor needed. As position functions keep the original position in data the direction and angle of displacement can be used to set justification on the side or corner of the text or label nearest to its original position, solving the problem elegantly and rather painlessly. A simple approach, as implemented in the 0.4.5 RC seems to be a significant improvement although the algorithm could be tweaked to less easily chose the corner of the enclosing box as rooting point.

Implemented for geom_text_s() and geom_label_s(). Unnecesary for geom_point_s().