新手用户请亲切温柔! :)
我正在处理以下数据集和R脚本:
var express = require("express");
var router = express.Router();
router.post('/api/signup', (req, res) => {
res.send('HELLO WORLD');
});
module.exports = router;
上述数据集和R脚本产生以下图:
对图像进行检查后发现左侧面板边框(或垂直轴)缺失。我希望左面板边框包含在图中。但是,我想排除左面板边框(或垂直轴)上的刻度线。总之,我想要的情节会
上面的R脚本负责此列表中的#2-5。但是,我已经尝试过并尝试过,并且无法弄清楚如何处理此列表中的#1 - 尽管在我的R脚本中包含以下内容:
#Create pvalue ranges
pvalue <- c(".000 - .005",".005 - .010",".010 - .015",".015 - .020",".020 - .025",".025 - .030",".030 - .035",".035 - .040",".040 - .045",".045 - .050")
#Create frequency counts
count <- c(5000,4000,3100,2540,2390,2260,2150,2075,2050,2025)
dat <- data.frame(pvalue = pvalue, count = count)
#Create plot
myPlot <- ggplot(data=dat, aes(x=pvalue, y=count, group=1)) +
geom_line() +
geom_point() +
geom_vline(xintercept=which(dat$pvalue == '.045 - .050'), linetype = "dashed") +
theme_bw() +
theme(axis.text.x = element_text(angle=90),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank()) +
theme(panel.border = element_blank()) +
ggtitle(paste("Insert Plot Title Here")) +
labs(x = "insert x-axis title here", y = "insert y-axis title here") +
theme(plot.title = element_text(lineheight=0.5,family = "TNR")) +
theme(axis.line.x = element_line(color="black"),
axis.line.y = element_line(color="black")) +
scale_y_discrete(breaks=NULL)
myPlot
有人可以帮助我制作出想要的图片吗?非常感谢:)
答案 0 :(得分:4)
scale_y_discrete(breaks = NULL)
打破y轴,因为它解释为什么都不显示。
删除该行,我们有y axis
,然后我们可以移除ticks
和text
:
library(ggplot2)
ggplot(data=dat, aes(x=pvalue, y=count, group=1)) +
geom_line() +
geom_point() +
geom_vline(xintercept=which(dat$pvalue == '.045 - .050'), linetype = "dashed") +
ggtitle(paste("Insert Plot Title Here")) +
labs(x = "insert x-axis title here", y = "insert y-axis title here") +
theme_bw() +
theme(plot.title = element_text(lineheight=0.5,family = "TNR"),
axis.line = element_line(),
axis.ticks.y = element_blank(), ## <- this line
axis.text.y = element_blank(), ## <- and this line
axis.text.x = element_text(angle=90),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
panel.border = element_blank())