An R plot is not displayed completely using circular R package

483 Views Asked by At

I have circular data of wind direction in radians. Here we have part of November directions at 10 meters:

 nov<-c(5.4977871, 5.4977871, 5.4977871 ,5.4977871, 5.4977871 ,5.4977871, 5.4977871, 5.1050881, 5.4977871, 5.4977871, 5.8904862, 5.8904862 ,6.2831853,5.8904862, 5.8904862, 5.8904862, 6.2831853, 5.8904862, 5.8904862, 5.8904862, 5.8904862, 5.8904862, 5.8904862, 5.8904862, 5.8904862, 5.8904862)

I have plotted time series and a rose diagram, both for wind direction. This is the code:

library(circular)
par(mfrow = c(2, 1))  
ts.plot(nov, xlab="Hour", ylab="radians",main="Time series of wind direction") 
rose.diag(nov[-c(100:713)],bins=18, main="Rose Diagram",) 

enter image description here

As you can see there is a problem on bottom, in 3pi/2. The "2" is not displayed completely. I have done rose diagram based in ggplot2 but I need to conserve this kind of plot. CirStats package have a similar plot but in degrees. Is there a solution?

2

There are 2 best solutions below

0
On BEST ANSWER

The clipping on the rose diagram is very dependent on how big my graphics window is. I can make my plot like yours if I shrink my default-sized graphics window. I can make it look okay if I use a larger window.

Where's the final destination for this plot? If a PDF then you might not have a problem with it in that form.

Changing the character size with the cex parameter may help:

par(mfrow = c(2, 1))  
ts.plot(nov, xlab="Hour", ylab="radians",main="Time series of wind direction") 
rose.diag(nov[-c(100:713)],bins=18, main="Rose Diagram",cex=0.5) 

gives me smaller text labels that fit better. But its still a bit ugly, and the text can clash with the circle and the tick marks.

0
On

It is probably due to clipping to the plot region. The bottom of the 2 is going into the margin area and therefore by default is clipped. Since you don't have Cartesian axes on the plot, it will not hurt to allow the text to extend into the margin. Try running the following command before creating your plot:

par(xpd=TRUE)

This will change the clipping (for all future plots on that device). See ?par and scroll down to the section on xpd for more details.