全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
3515 4
2016-11-05

如下图红箭头所示,左右框和曲线间有一段空白区域,我想去掉这个区域,曲线直接从边框起始,用什么参数?谢谢

QQ截图20161105110128.jpg
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2016-11-5 11:28:28
再做一个简单的图plot(0:10,3:13,type = "l"),也还是这样,横坐标的0为什么不从最右端开始呢?
附件列表
QQ截图20161105112729.jpg

原图尺寸 11.87 KB

1

1

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-11-5 22:05:17
问题提得很清楚,赞。这种有违数学上常见的坐标轴一直也困扰着我(不过R的作者应该也有自己的考量)~
也许没有简单直接的解决方案,我的解决方法是一开始限制R自动给出坐标轴,稍后自己用lines加arrows手动画上坐标轴。
见下面的例子:
复制代码


这段代码给出的图片输出如下:

代码可能会有点烦,不知道这个问题在最近流行的ggplot2, ggvis包里有没有得到更好的处理。权作抛砖引玉吧。
附件列表

pmfcdf.pdf

大小:4.76 KB

 马上下载

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-11-10 16:06:25
Try setting xaxs="i"?
According to R help:

xaxs

The style of axis interval calculation to be used for the x-axis. Possible values are "r", "i", "e", "s", "d". The styles are generally controlled by the range of data or xlim, if given.
Style "r" (regular) first extends the data range by 4 percent at each end and then finds an axis with pretty labels that fits within the extended range.
Style "i" (internal) just finds an axis with pretty labels that fits within the original data range.
Style "s" (standard) finds an axis with pretty labels within which the original data range fits.
Style "e" (extended) is like style "s", except that it is also ensures that there is room for plotting symbols within the bounding box.
Style "d" (direct) specifies that the current axis should be used on subsequent plots.
(Only "r" and "i" styles have been implemented in R.)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-12-1 15:33:16
非常感谢两位的解答!!!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群