0

I'm currently working with R trying to make some scatterplots that I'd like color coded. The graphs are plotting Risk from 1-10 on the y-axis and count of tornadoes within given parameters on the x-axis. The parameters are something like "tornadoes within 20 miles, 10 years, and have a magnitude of 3 or greater" In any case, the plots come out as shown in the image and the circles get darker as the count gets higher and I would like to get this color-coded...

My current code looks like this:

plot(dat$tornadoparameters, dat$Risk, xlab = Count of Tornadoes, ylab = Risk, main = Tornadoes within Tornado Parameters)

enter image description here

Miha
  • 2,351
  • 15
  • 26
  • 1
    This is too vague. Give a [mcve]. If you are using the base-R `plot` function, it has an optional parameter `col` which can be set equal to a vector, where the i^th component of `col` determines the color of the ith point. Decide on the logic of coloring and pass in the vector which implements that logic. – John Coleman Mar 19 '18 at 22:12
  • 1
    Maybe this is an answer? https://stackoverflow.com/questions/9946630/colour-points-in-a-plot-differently-depending-on-a-vector-of-values – Andrew Bannerman Mar 19 '18 at 22:12

0 Answers0