R: 边界显示问题 |
您所在的位置:网站首页 › r语言plot画图不全 › R: 边界显示问题 |
在R中绘制图形时,有时候会遇到图1所示情况,上边界为显示完全,是因为边界在坐标轴范围之外,所以未显示出来。 解决办法: 由图1可知,下边界显示正常,并且负向y轴的距离也合适,所以在利用ylim()设定坐标轴范围时,负轴设为“NA”,正轴最大值为15,则设为15。将下述代码加到原代码中再次运行,结果如图2,正常。 ylim = c(NA, 15)
注:当标签名称过长而与边界重叠时,也可通过调节坐标轴范围解决。 关于其他坐标轴调整及转换方式还包括: expand_limits()scale_x_continuous() 和scale_y_continuous()scale_x_log10(), scale_y_log10() : for log10 transformatioscale_x_sqrt(), scale_y_sqrt() : for sqrt transformationscale_x_reverse(), scale_y_reverse() : to reverse coordinatescoord_trans(x =“log10”, y=“log10”) : possible values for x and y are “log2”, “log10”, “sqrt”, …scale_x_continuous(trans=‘log2’), scale_y_continuous(trans=‘log2’) : another allowed value for the argument trans is ‘log10’ 具体内容可参考:【r |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |