0

I am using the filled.contour3 function in the mannner described here. My code is like this

  plot.new()
  par(mfrow = c(3,3))
  pop_x <- 3.0
  pop_y <- 6.0
  for (i in 1:9){
    b_x <- calc_b_x(i)
    b_y <- calc_b_y(i)
    x <- calc_x(i)
    y <- calc_y(i)
    z <- calc_z(i)
    filled.contour3(x, y, z)
    text(x = pop_x, y = pop_y , 'x', cex = 1.5, font = 2)
    text(x = b_x, y = b_y , 'a', cex = 1.5, font = 2)
  }

This successfully plots 9 graphs in 3 rows. It also puts one 'x' on each graph in the correct position. However the second text call ends up putting 9 'a's on each plot, each in right position. But I only on want one 'a' on each graph, in the correct position for that graph. How do I fix this?

Obromios
  • 15,408
  • 15
  • 72
  • 127

1 Answers1

0

It turns out it was not a problem with filled.contour3. The b_x and b_y were mistakenly vectors rather than scalars, so a single call to

text(x = b_x, y = b_y , 'a', cex = 1.5, font = 2)

produced many points.

Obromios
  • 15,408
  • 15
  • 72
  • 127