Search code examples
rpie-chartaxis-labels

Change color of labels and tick marks in pie chart in Base R


I have a pie chart:

x <- c(30, 70)
pie(x)

I want the labels to be red and the tick marks to be either red or transparent. How do I do that? xaxt = "n" and col.axis = "red" seem to have no effect.

pie(x, xaxt = "n", col.axis = "red")

Solution

  • You can change the colour of the ticks and labels by setting the col graphical parameter first:

    opar <- par(col="red")
    pie(x)
    

    enter image description here

    Then reset the color to the previous setting:

    par(opar)