quintinm
quintinm

Reputation: 129

Radar plot peripheral labels cutoff

As you can see in this example, I'm trying to plot multiple radar charts. However, the peripheral axis labels are getting cutoff. I've tried specifying mar and oma in par, but haven't had any luck.

Can anyone else figure this out?

require(fmsb)

df <- data.frame(
  a = c(0.5, 0, 0.3),
  stopcuttingmeoff = c(1.2, 0, 0.5),
  c = c(0.25, 0, 0.1),
  d = c(0.25, 0, 0.1),
  dontcutmeoff = c(4, 0, 2))

par(mfrow=n2mfrow(4))
radarchart(df, axistype = 2, centerzero = TRUE, palcex = 0.9)
radarchart(df, axistype = 2, centerzero = TRUE, palcex = 0.9)
radarchart(df, axistype = 2, centerzero = TRUE, palcex = 0.9)
radarchart(df, axistype = 2, centerzero = TRUE, palcex = 0.9)

enter image description here

Upvotes: 4

Views: 2138

Answers (1)

CL.
CL.

Reputation: 14987

A possible solution is using xpd = TRUE to prevent that the text is cut off at the margin. fsmb::radarchart internally uses text to add annotations, but unfortunately it does not allow you to pass parameters to text via ....

Therefore, you need to set the option globally:

par(xpd = TRUE, mfrow = c(2, 2), mar = c(2, 1, 2, 1))
radarchart(df, axistype = 2, centerzero = TRUE, palcex = 0.9)
radarchart(df, axistype = 2, centerzero = TRUE, palcex = 0.9)
radarchart(df, axistype = 2, centerzero = TRUE, palcex = 0.9)
radarchart(df, axistype = 2, centerzero = TRUE, palcex = 0.9)

Adjust mar to whatever values give you the desired margin on your device.

Upvotes: 7

Related Questions