pharmaverse / ggsurvfit

http://www.danieldsjoberg.com/ggsurvfit/
Other
67 stars 19 forks source link

Justification of text in risktables #165

Closed ddsjoberg closed 9 months ago

ddsjoberg commented 9 months ago

I think at the moment, the text in the risktable is centered and sometimes the first number is truncated a bit. Is there a better default?

image
psoldath commented 9 months ago

And the problem gets worse when the plot is set to not expand (coord_cartesian(expand = FALSE)).

I think a better default would be better if the risk table y-axis text (and probably also the risk table headings) was right-aligned and with a small right margin from the point of x = 0 like in the following plot. This would create more white space left of the plot, but it would get rid of the problem with truncated text especially when the plot is set to not expand.

Skærmbillede 2023-09-10 kl  02 58 55
ddsjoberg commented 9 months ago

@psoldath thanks for the suggestion. can you provide a code example?

psoldath commented 9 months ago

@ddsjoberg No I'm sorry, I'm a real novice to R and I don't know how to code it. I guess the risktable titles should be left-aligned set to the "plot" position, while the y-axis texts should be right-aligned, and then, if the y-axis texts are too long, a relative margin should be added to the left of the y-axis title of the plot to keep the risk table numbers aligned with the x-axis ticks of the plot without truncating the numbers?

ddsjoberg commented 9 months ago

To keep it simple, i'll probably just increase the default padding on the x=0 side.