Plotting discrete and continuous scales in same ggplot

前端 未结 3 1079
一整个雨季
一整个雨季 2021-02-19 22:59

I would like to plot some different data items using ggplot2, using two different colour scales (one continuous and one discrete from two different df\'s). I can plot either exa

3条回答
  •  不思量自难忘°
    2021-02-19 23:10

    The problem isn't so complicated as you might think. In general, you can only map an aesthetic once. So calling scale_colour_* twice makes no sense to ggplot2. It will try to force one into the other.

    You can't have multiple colour scales in the same graph, regardless of whether either one is continuous or discrete. The package author has said that they have no intention of adding this, either. It is rather complicated to implement and would make it too easy to make incredibly confusing graphs. (Multiple y axes will never be implemented for similar reasons.)

提交回复
热议问题