You can try something like about this:

r[upper.tri(r)] <- NA
matplot(t(r), lty = 1, type = 'p', pch = 1, ylim = c(0.4, 1.2), col =
'black')


On Fri, Sep 5, 2008 at 12:27 PM, Zhang Yanwei - Princeton-MRAm <
[EMAIL PROTECTED]> wrote:

> Dear list,
>
>  I have the following matrix. How can I make the following plot?
>  1. The x-axis has index 1:7, and the first column is plotted against index
> 1, second against 2, and so on.
>  2. I want the points from the left upper conner including the antidiagonal
> to be plotted with col=2, and the rest with col=3
>      [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]
> [1,] 0.589 0.857 0.923 0.944 0.954 0.963 0.980
> [2,] 0.470 0.763 0.877 0.900 0.911 0.957 0.974
> [3,] 0.486 0.863 0.905 0.960 0.968 0.998 1.015
> [4,] 0.653 0.888 0.943 0.952 0.962 0.992 1.009
> [5,] 0.664 0.774 0.958 0.986 0.996 1.027 1.045
> [6,] 0.546 0.910 1.011 1.041 1.051 1.083 1.102
> [7,] 0.407 0.600 0.667 0.686 0.693 0.715 0.727
>
>
> The following the my code to do the above with the matrix called "r". How
> can I simply the code?
>
>
> plot(r[,1],type="n",ylim=c(0.4,1.2))
> for (i in 1:7)
>  {points(rep(i,8-i),r[,i][1:(8-i)],col=2) }
> for (i in 2:7)
>  {points(rep(i,(i-1)),r[,i][(9-i):7],col=3)}
>
> Thanks
>
>
> Sincerely,
> Yanwei Zhang
> Department of Actuarial Research and Modeling
> Munich Re America
> <mailto:[EMAIL PROTECTED]>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
  • [R] Plot by column Zhang Yanwei - Princeton-MRAm
    • Re: [R] Plot by column Henrique Dallazuanna

Reply via email to