scale_y_discrete忽略中断/标签 [英] scale_y_discrete ignores breaks/labels

查看:34
本文介绍了scale_y_discrete忽略中断/标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

臭虫?可能与此相关的

解决方案

  ggplot(dat,aes(x,y,group = grp))+ geom_step()+scale_y_discrete(breaks =级别(dat $ y),标签=级别(dat $ y),drop = FALSE) 

Bug? Possibly related to this..

dat = data.frame(x = 1:4, y = ordered(c(4,'>5',1,1), levels = c(1:5, '>5')), grp = 1)

ggplot(dat, aes(x, y, group=grp)) + geom_step() + 
  scale_y_discrete(breaks = levels(dat$y), labels = levels(dat$y))

解决方案

ggplot(dat, aes(x, y, group=grp)) + geom_step() + 
  scale_y_discrete(breaks = levels(dat$y), labels = levels(dat$y), drop = FALSE)

这篇关于scale_y_discrete忽略中断/标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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