删除twoord图中的所有轴值和标签 [英] Remove all axis values and labels in twoord plot

查看:92
本文介绍了删除twoord图中的所有轴值和标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除所有包括x,左和右y的轴,但保留绘图的边界. 我试图将xaxtyaxt设置为'n',但是没有运气.

I want to remove all the axis including x, left and right y but retain the boundary of the plot. I tried to set xaxt and yaxt to 'n' but no luck.

library(plotrix)

twoord.plot(2:10,seq(3,7,by=0.5)+rnorm(9),
        1:15,rev(60:74)+rnorm(15),
        type=c("bar","l"), 
        xaxt='n',
        yaxt='n')

有什么建议吗?预先感谢.

Is there any suggestion? Thanks in advance.

推荐答案

从我所看到的来看,我并不这么认为.无论如何,创建此图很容易:

I don't think so from what I saw. It's easy enough to create this plot anyway:

library('plotrix')
set.seed(1)
x1 <- 2:10
y1 <- seq(3,7,by=0.5)+rnorm(9)
x2 <- 1:15
y2 <- rev(60:74)+rnorm(15)

par(mfrow = c(1, 3), mar = c(3, 3,2,3))
twoord.plot(x1, y1, x2, y2, type=c("bar","l"), xaxt='n', yaxt='n', mar = c(3, 3,2,3))

## to recreate
plot(x1, y1, type = 'n', xlim = range(x2), ylim = range(y1))
rect(x1 - .4, 0, x1 + .4, y1, col = 'black')
par(new = TRUE)
plot(x2, y2, type = 'l', col = 'red', axes = FALSE)
axis(4, col.axis = 'red')

## again with no axes
plot(x1, y1, type = 'n', xlim = range(x2), ylim = range(y1), axes = FALSE)
rect(x1 - .4, 0, x1 + .4, y1, col = 'black')
par(new = TRUE)
plot(x2, y2, type = 'l', col = 'red', axes = FALSE)
box()

这篇关于删除twoord图中的所有轴值和标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆