yarrr icon indicating copy to clipboard operation
yarrr copied to clipboard

How to change group names color in pirateplot?

Open ghost opened this issue 2 years ago • 3 comments

Also, how to change axis colors ? (line , tick, label)

image

ghost avatar Apr 09 '22 11:04 ghost

Since this uses base R functionality, you can customize labels by first removing what's there and then adding what you want. I'm removing the x-axis tick labels with xaxt = 'n'. I'm adding the labels with the function axis(), the 1 indicates the first or x-axis.

pirateplot(formula = weight ~ Diet, 
           data = ChickWeight,
           xaxt = 'n')
axis(1, labels = paste0("Diet ", 1:4), at = 1:4)

image

fraupflaume avatar Apr 16 '22 19:04 fraupflaume

@fraupflaume and maybe change their colors using col.lab ? But does col.lab work if it is defined inside axis?

ghost avatar Apr 16 '22 20:04 ghost

Sorry about the delayed response, I didn't realize that I had this waiting for me. The color of the labels can change with the parameter col.axis within a plot() or axis() call. For example:

pirateplot(formula = weight ~ Diet, 
           data = ChickWeight,
           xaxt = 'n')
axis(1, labels = paste0("Diet ", 1:4), at = 1:4, col.axis = "#b21e29")

image

fraupflaume avatar Apr 28 '22 03:04 fraupflaume