1

In legend have long text. This text is half visible after I add the numbers. My code:

library(plotrix)
x <- c(16.6, 8.3, 11.7, 10.6,38.5,14.3)
lbls <- paste(x,"%") 
labels <- c("TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT", "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT", "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT", 
            "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT", "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT",
            "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT")
colors<-c("#F69646","#B70000","#002060","#553C75","#632523","#00B0EF")
pie3D(x, labels=lbls,explode=0.1, height=0.05,  main='TEXTTEXTTEXTTEXTTEXTTEXT', col=colors)
legend(0.75,1.1, labels, cex = 0.46,fill = colors)

x

Nikita Kagan
  • 75
  • 1
  • 7

2 Answers2

1

I add

par(xpd=TRUE)

between schedule and legend

Nikita Kagan
  • 75
  • 1
  • 7
0

You need to tweak some of the legend parameters, especially xjust and adj:

pie3D(x, labels = lbls, explode = 0.1, height = 0.05, 
      main = 'TEXTTEXTTEXTTEXTTEXTTEXT', col = colors, mar = c(2, 4, 4, 4))
legend(0.75, 0.7, labels, cex = 0.46, fill = colors, xjust = 0.16, 
       inset = 0, adj = c(1, 0))

enter image description here

Allan Cameron
  • 147,086
  • 7
  • 49
  • 87