0

I don't seem to be able to move the text for my legend without it disappearing. The frame seems to be bound by the plot output.

Here is my code for it that I took from another site.

 clock.plot <- function (x, col = greys, ...) {
if( min(x)<0 ) x <- x - min(x)
if( max(x)>1 ) x <- x/max(x)
n <- length(x)
if(is.null(names(x))) names(x) <- 0:(n-1)
m <- 1.05
plot(0, type = 'n', xlim = c(-m,m), ylim = c(-m,m), axes = F,axis.title=element_text(size=14,face="bold"), xlab = 'Hours taken GMT', ylab = '', ...)
a <- pi/2 - 2*pi/200*0:200
polygon( cos(a), sin(a) )
v <- .02
a <- pi/2 - 2*pi/n*0:n
segments( (1+v)*cos(a), (1+v)*sin(a), (1-v)*cos(a), (1-v)*sin(a) )
segments( cos(a), sin(a),0, 0, col = 'light grey', lty = 3) 
ca <- -2*pi/n*(0:50)/50
for (i in 1:n) {
  a <- pi/2 - 2*pi/n*(i-1)
  b <- pi/2 - 2*pi/n*i
  polygon( c(0, x[i]*cos(a+ca), 0), c(0, x[i]*sin(a+ca), 0), col=col[i] )
  v <- .1
  text((1+v)*cos(a), (1+v)*sin(a), names(x)[i])
}  

legend(x=-1.1, y=1.3, legend = "Original Distribution", bty = "n", pch=20 , text.col = "black", cex=1.2, pt.cex=4) }

Screenshot

  • 1
    Please read [(1)](http://stackoverflow.com/help/how-to-ask) how do I ask a good question, [(2)](http://stackoverflow.com/help/mcve) How to create a MCVE as well as [(3)](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example#answer-5963610) how to provide a minimal reproducible example in R. Then edit and improve your question accordingly. I.e., abstract from your real problem... – Christoph Dec 12 '16 at 16:06
  • Apologies for the vague details and poor format. On the off chance it helps someone I just had to define a specific border for the plot to force it to a readable state. – Paul Kelly Jan 19 '17 at 15:11

0 Answers0