ggplot multiple line charts on top of each other (with different y-axis scales)


I would like to show multiple linecharts together in one chart (like you see in the picture)
. but the values of each charts are different (range from 50'000 to 1'200'000) so they look twisted. Is there a way to plot them without a y-axis for all of them together so they remain with the automatic shape?

I hope you can melp me thanks a lot

wouldnt that render the Y axis meaningless ? in principle would you hide the y axis so that people dont draw false conclusions ?
you could use simple arithmetic to rescale any line so you have complete freedom how things get drawn. What it 'means' or how it should be interpreted is what is at risk.

Yeah the y-axis scale is irrelevant to me. It's about the relativity so if the values go up or down is important

I though about just mulpily each Group with a numer so i.e if a value is 100'000 i multiply each with 10x so they appear on the same scale as the 1'000'000 one. But isn't there an way where this happens automatic? Is that what you meant by simple arithmetic?

you could through scale() in there


two_diff_y_df <- data.frame(

ggplot(data=two_diff_y_df) + 
  aes(x=x) + 
  geom_line(aes(y=y1),color = "red") + 

ggplot(data=two_diff_y_df) + 
  aes(x=x) + 
  geom_line(aes(y=scale(y1)),color = "red") + 
  geom_line(aes(y=scale(y2)),color="blue") + theme(axis.text.y = element_blank(),
                                                   axis.title.y = element_blank())


Thank you, now it worked but it looks still strange. Do you have any tipps on how to make it look more clean and nicer? Changin colors i.e will I do for sure but I mean more grafically.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.