[R] Howto reduce number of ticks in X, Y axis while still containing all the data

Gundala Viswanath gundalav at gmail.com
Fri Jun 20 09:36:20 CEST 2008


Hi Dieter,

I'm aware of the need to include lattice library.
I just didn't show it.

However my code still cant' produce the same results
as yours.

My data.mat contain this form of output
> print(data.matrix)

          11145      3545      8951     11097     16599     11100
8566 ...... (upto 100 more)
11145 1.0000000 0.9979445 0.9966705 0.9855180 0.9775806 0.9949439 0.9579916
3545  0.9979445 1.0000000 0.9973328 0.9910627 0.9847413 0.9947414 0.9521648
8951  0.9966705 0.9973328 1.0000000 0.9882817 0.9829629 0.9938390 0.9558376
11097 0.9855180 0.9910627 0.9882817 1.0000000 0.9969120 0.9846531 0.9490246
16599 0.9775806 0.9847413 0.9829629 0.9969120 1.0000000 0.9785536 0.9383424
....
(up to 100 more)

Which is different from yours, that gives:

               [,1]          [,2]          [,3]          [,4]          [,5]
  [1,]  1.0000000000  0.1348954834  0.0751601237  0.0348865551 -0.2111789755
  [2,]  0.1348954834  1.0000000000  0.0543903623 -0.0183413605 -0.1684300250
  [3,]  0.0751601237  0.0543903623  1.0000000000  0.1070384198 -0.0598198329
  [4,]  0.0348865551 -0.0183413605  0.1070384198  1.0000000000  0.0632082205
  [5,] -0.2111789755 -0.1684300250 -0.0598198329  0.0632082205  1.0000000000

Can you suggest how can I over come this problem?

- Gundala Viswanath
Jakarta - Indonesia


On Fri, Jun 20, 2008 at 3:38 PM, Dieter Menne
<dieter.menne at menne-biomed.de> wrote:
> Gundala Viswanath <gundalav <at> gmail.com> writes:
>
>> I am trying to plot 100 x 100 matrix data in a level plot.
>> The problem I have is that the x/y -axis label in ticks
>> are jumbled together. Thus I want X/Y axis to contain
>> 10 ticks only, yet still plotting all the 100 data.
>>
>> Is there a way to do it?
>> The code I have below doesn't work.
>>
>
> Well, the code did not work because you did not provide example data
> and forgot that levelplot is lattice, but when I add these two lines,
> it works for me. Scaling is 20,40,..., and all point are shown (hope so,
> I did not count).
>
> Dieter
>
> library(lattice)
> mat.data = matrix(rnorm(100*100),nrow=100)
>
> # Corr contains 100x100 matrix
> corr <- cor(t(mat.data), method ="pearson")
>
> # Plot them
> levelplot(corr, main="PCC of Top-100 Genes",
>                xlab="Gene",
>                ylab="Gene",
>                scale=list(y=list(tick.number=10)) # Doesn't work
>                )
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list