如何缩放这条曲线?

问题描述 投票:0回答:1

我的体重秤有问题。我该如何解决?

b<- data.frame(OBS=c(1,2,3,4,5,6,7,8,9,10),
               MB= c(0.3042,0.3009,0.29,0.295,0.292,0.290, 0.28,0.26,0.242,0.24),
               MC=c(0.282,0.286,0.289,0.293,0.296,0.299,0.30, 0.32, 0.325,0.34),
               END=c(0,0.008,0.0154,0.023,0.030,0.038,0.0463,0.06,0.19,0.231))

B_plot<- ggplot(b, aes(x= END,y= MB/MC, color= Legenda))+
  geom_line(aes(y= MB, col="MB"))+
  geom_line(aes(y= MC, col="MC"))+
  labs( x= "END", y= "MB / MC")+
  scale_x_continuous(breaks = seq(0:0.12,3)) + 
  scale_y_continuous(breaks = seq(0.28:0.32,4))+
  geom_vline(xintercept = 0.05765 )

我需要 x [0, 0.12] 和 y [0.28,0.32]

r ggplot2
1个回答
0
投票

如果您想要一个从 0 到 0.12 且有 3 个中断的序列,您可以使用

  scale_x_continuous(breaks = seq(0,0.12,length.out = 3)) + 
  scale_y_continuous(breaks = seq(0.28,0.32,length.out = 4))

如果您还想限制轴,可以在

limits
函数中使用参数
scale_

© www.soinside.com 2019 - 2024. All rights reserved.