[R] inverted axis

Ott Toomet siim at obs.ee
Wed Mar 20 11:34:55 CET 2002


HI,

On Wed, 20 Mar 2002, Juhana Vartiainen wrote:

  |Hello everybody!
  |
  |Spse I have the following
  |
  |X <- seq(1:100)     #(a dim(100) sequence of integers 1:100 representing
  |the possible actions of player 1 and player2 in a game)
  |BR2X<- br2(X)      #(a dim(100) sequence of points on range (1,100)
  |representing the best response function of player 2 to player 1:s
  |actions)
  |BR1X<- br1(X)      #(a dim(100) sequence of points on range (1,100)
  |representing the best response function of player 1 to player 2:s
  |actions)
  |
  |To illustrate Nash equilibrium , I would like to plot these  in the same
  |picture, with inverted axes, so that
  |
  |(X,BR2) is plotted with X on horizontal and BR2 on vertical axis
  |(X, BR1) is plotted with X on vertical axis and BR1 on horizontal axis.
  |
  |How can I do that ?

You should do something like this:

plot(X, BR2)
lines(BR1, X) # or points(BR1, X)

Note that plot() removes everything that were in the plot window before and
calculates new axes etc., but lines() keeps the previous graph and uses the
same axes.  You may consider using plot(..., lwd=2) to get the BR-lines
thicker than the axes.

Note also that you may use

X <- 1:100
instead of seq(1:100)

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list