Janak Janak - 1 year ago 77
R Question

Adding greek symbol (pi) on the axis tick mark of a plot

I want to print the greek alphabet (multiple of) pi in the x-label tick mark of a histogram in R.
Specifically, let us consider the example:

hist(x,freq = F)

enter image description here

Now how to print actual expression of (0,pi/7,pi/6,pi/5,pi/4,pi/3,pi/2,pi)
at the x axis tick mark instead of (0,0.5,1,1.5,2,2.5,3,3.5) in the above plot?

Answer Source

I understand, that with "label" you actually mean "tick mark". Otherwise see the answer given by ira. You may want to change the at= part to something more appropriate.

hist(x, xaxt="n")
axis(side=3, at=c(0,0.5,1,1.5,2,2.5,3,3.5),
axis(side=1, at=c(0,0.5,1,1.5,2,2.5,3,3.5),
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download