0
ggplot(data.nona2,aes(x=uur.van.het.jaar,y=Verbruik.huis.overig.kWh))+
  labs(color='Scenario') +
  scale_x_discrete(limits=c(2736:2759),
                   breaks=c(2744,2748,2754,2759),
                   labels=c("08:00","12:00","18:00","24:00"),
                   name='tijd (uren)') + 
  scale_y_discrete(limits=c(0:0.5),
                   breaks=c(0,0.25,0.5),
                   labels=c('0','0.25','0.5'),name='kWh') +
  scale_colour_brewer(palette="Set1") + 
  coord_cartesian(xlim=c(2736,2759),ylim=c(0,0.5)) + 
  geom_ribbon(data=data.nona2,
              aes(x=uur.van.het.jaar,
                  ymin=0,ymax=Verbruik.boiler.kWh,scenario,
                  alpha=1,fill="verbruik boiler"),se=F) + 
  geom_ribbon(data=data.nona2,
              aes(x=uur.van.het.jaar,ymin=0,ymax=Verbruik.huis.overig.kWh,
                  scenario, alpha=.8,fill="verbruik huis"),se=F) + 
  facet_grid(scenario~.,scales='free_y') + 
  geom_ribbon(data=data.nona2,
              aes(x=uur.van.het.jaar,ymin=0,ymax=PV.opwek.kWh,scenario, 
                  alpha=0.7,fill="PV opwek"),se=F) + 
  scale_fill_manual(name = 'Energie verbruik',
                    values=c("verbruik boiler" = "darkred",
                             "verbruik huis" = "darkgreen",
                             'PV opwek' = 'darkblue')) + 
  theme_pander() + 
  guides(group=FALSE)

enter image description here

Unfortunately I cannot share my actual data, I know this would be much apreciated. I have searched a lot for the solution so as my last hope I stretch out to anyone reading this. (my values are continuous). How can I solve it?

zx8754
  • 52,746
  • 12
  • 114
  • 209
rsustain
  • 3
  • 1
  • 1
    We don't need your actual data but we do need some data to make this problem [reproducible](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) otherwise it is very difficult to help you. See the link provided on how to do that. – MrFlick Feb 11 '16 at 20:43

1 Answers1

2

Replacing c(0:0.5) with c(0, 0.5) in scale_y_discrete might help, because for limits you need to give a starting point and an ending point, whereas 0:0.5 returns simply 0.

Julius Vainora
  • 47,421
  • 9
  • 90
  • 102
  • Thank you Julius! Normally I can fix things by looking up previous Qstions. This time it took me hours, your help has been much apreciated. – rsustain Feb 12 '16 at 22:24