1

I have two datasets which contain values for a radial plot and colors for the radial grid lines of this plot.

First dataset:

#data 1
values  <- c(0.179615044,  0.011908401, -0.342792441,  -0.154263864,
           -0.251553369, -0.234413350,   0.150411419)
colors <- c("black", "black", "red", "red", "red", "black", "black")

Second dataset:

#data 2
values  <- c(0.88582075,  0.80089077,  0.79452764,  0.77835694, -0.06816896, 0.24024556, -0.02023557, 
              0.28804668, -0.88184648,  0.93711689)


colors <- c("red",  "red",   "red",   "red", "black", "black", "black", "black", "red",   "red")

When I make the radial plots with the following function, I get plots with either colored circular grid lines or non colored circular grid lines. Both plots have the correct radial grid lines colored red.

library(plotrix)

#plotrix radial plot
radial.plot(values, grid.col=colors, rp.type="p")

How do I get the radial grid lines the get colored and not the circular grid lines? Is grid.col the wrong argument the use here?

correct image from dataset 1 (black circular grid + highlighted radial grid lines):

https://i.stack.imgur.com/p66Mt.png

incorrect image from dataset 2 (red circular grid + highlighted radial grid lines):

https://i.stack.imgur.com/uzchS.png

Mehdi Nellen
  • 8,486
  • 4
  • 33
  • 48

2 Answers2

1

I have found a bug in the radial.plot code. The new code fixes this problem and only colors the radial segment lines.

For the code: https://github.com/kroeliebuschie/radial.plot/blob/master/radial.plot.R

A new argument (seg.col) specifies the radial segment lines.

#seg.col specifies the line colors
radial.plot(values, seg.col=colors, rp.type="p")

edit

The circumferential lines can be changed now. Jim Lemon has added this feature and has called it grid.col

see link: http://www.inside-r.org/packages/cran/plotrix/docs/radial.plot

Mehdi Nellen
  • 8,486
  • 4
  • 33
  • 48
-1

Try the line.col argument like this:

#data 1
values1  <- c(0.179615044,  0.011908401, -0.342792441,  -0.154263864,
           -0.251553369, -0.234413350,   0.150411419)
colors1 <- c("black", "black", "red", "red", "red", "black", "black")

#data 2
values2  <- c(0.88582075,  0.80089077,  0.79452764,
              0.77835694, -0.06816896, 0.24024556, -0.02023557,
              0.28804668, -0.88184648,  0.93711689)


colors2 <- c("red",  "red",   "red",   "red", "black",
             "black", "black", "black", "red",   "red")

library(plotrix)

#plotrix radial plot
radial.plot(values2, line.col = colors2, grid.col = "black", rp.type = "p")

This generates the image below:

screenshot

SlowLearner
  • 7,907
  • 11
  • 49
  • 80
  • 1
    Dear SlowLearner, I actualy mean the lines that run from the center of the circle to the outside. they need to look like this: http://i.imgur.com/5e9mJys.png And the circular lines need to stay black and not red: http://i.imgur.com/NRFPetY.png – Mehdi Nellen Aug 14 '13 at 11:14
  • Radial and not concentric huh? I did misread your question, apologies. – SlowLearner Aug 14 '13 at 12:13
  • No, I do not. I experimented using `ggplot`, which allowed me to changes the colours freely but I ended up with curved lines as per [this answer](http://stackoverflow.com/questions/9614433/creating-radar-chart-a-k-a-star-plot-spider-plot-using-ggplot2-in-r). – SlowLearner Aug 15 '13 at 05:58