ACEnglish
ACEnglish

Reputation: 115

R multi log-log plot

I am trying to make a graph of a table and graph it in log space.

First of all, plot(dat) gives me the grid of graphs

Second of all, plot(dat, log="xy") gives me the correct plots of data in log space

However, plot(dat, log="xy") ruins the main diagonal's labels of names(dat)

R version 2.11.0

Sample Data:

           cold cold_control drought_1 drought_2 drought_control_1 drought_control_2   pollen
locusA  1.586772     2.681969  2.158070  0.565037          3.012266          3.673228 0.000000
locusB  0.000000     0.000000  0.063385  0.000000          0.000000          0.000000 0.000000
locusC  0.000000     0.000000  0.000000  0.000000          0.000000          0.000000 0.049587
locusD 66.811446   142.196072 74.329916 35.878431        106.071526        150.266891 0.000000
locusE 10.310947     6.489778 20.680820 31.699902         19.353401         21.345744 0.033246
locusF 26.928376    11.339193 21.226212 24.858953         10.085712         15.587217 0.412588

Also, I get these warnings with log="xy"

1: In xy.coords(x, y, xlabel, ylabel, log) : 2 x values <= 0 omitted from logarithmic plot

2: In xy.coords(x, y, xlabel, ylabel, log) : 2 y values <= 0 omitted from logarithmic plot

3: In xy.coords(x, y, xlabel, ylabel, log) : 2 x values <= 0 omitted from logarithmic plot

4: In xy.coords(x, y, xlabel, ylabel, log) : 2 y values <= 0 omitted from logarithmic plot

5: In axis(side = side, at = at, labels = labels, ...) : "log" is not a graphical parameter

6: In plot.xy(xy.coords(x, y), type = type, ...) : "log" is not a graphical parameter

Upvotes: 1

Views: 6279

Answers (1)

nico
nico

Reputation: 51680

You should use xlog=TRUE, ylog=TRUE, instead of log="xy". The names will show up and the log is not a graphical parameter warnings will disappear.

Anyway you have some 0 values, and you cannot plot log(0), that's the reason of the other warnings

Upvotes: 1

Related Questions