问题描述
我试图用对来绘制一些散点图。我的数据框看起来像:
> e
XYZ
0 0 0
2 3 4
0 3 4
3 3 3
标准数据框在这里。
我用这个来绘制我的散点图,再也没有什么好奇的:
pair(〜X + Y + Z,data = e,log =xy)
它的效果很好,但它并不绘制标签。但是,如果我删除命令中的log =xy,那么标签很好地绘制。所以我想这是与我想要我的散点图成对数的事实有关。
所以我的问题是我该怎么办?
我要用手之前删除所有的行(如何做?)
有没有魔术可以让我有log =xy和我的散点图标签?
感谢您的帮助,
如果不清楚请让我知道。
你忽略了这个(在那里我打电话给你的数据框架 DF
):
R>对(〜X + Y + Z,data = df,log =xy)
有30个警告(使用warnings()来查看它们)
如果你看这三十个警告,你会看到
-
log
不是pair()的公认参数()
所以如果你想在日志中使用对,你可能需要自己记录日志(并且添加一个小的epsilon或者使用像 log(1 + x)
并为该数据调用 pair()
。
编辑最简单的可能是 pair(〜X + Y + Z,data = log(1 + DF))
I am trying to plot some pairs of scatterplots using "pairs".My dataframe look like :
>e
X Y Z
0 0 0
2 3 4
0 3 4
3 3 3
A completely standard dataframe here.
I use this to plot my scatter plots, again nothing fancy:
pairs(~X+Y+Z, data=e, log="xy")
It works great, but it doesn't plot the labels. However if I remove the log="xy" in the command, then the labels are plotted nicely. So I guess it has to do with the fact that I want my scatterplots to be in log scale.
So my question is what shall I do ?Shall I remove all lines with zeros in it before hand (how do you do that?)Is there a magic trick that will let me have log="xy" and my scatterplots labeled ?
Thanks for you help,Please let me know if it is not clear.
You ignored this (where I called your data frame DF
):
R> pairs(~X+Y+Z, data=df, log="xy")
There were 30 warnings (use warnings() to see them)
and if you look at these thirty warnings, you will see that
you cannot plot data containing zeros on a log scale (and I guess you know why)
log
is not a recognised parameter forpairs()
So if you want a pairs plot in logs, you may have to takes logs yourself (and either add a small epsilon or use a transformation like log(1 + x)
and call pairs()
on that data.
Edit The easiest is probably pairs(~X+Y+Z, data=log(1+DF))
这篇关于在R中以对数方式绘制散点图,数据包含零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!