Function to build double y axis graph in ggplot2

后端 未结 3 1016

I am testing a function to build a double y axis graph in ggplot2. It works but I can\'t get some elements from the input graphics. I have built these two graphs with two data f

3条回答
  •  长发绾君心
    2021-02-20 01:38

    First steps towards a solution:

    g1.1 <- g1 + theme_bw() + theme(legend.position="top")
    g2.1 <- g2 + theme_bw() + theme(panel.grid=element_blank()) +
        theme(panel.background = element_rect(fill = NA))
    plot(double_axis_graph(g1.1,g2.1))
    

    enter image description here

    Now we need to fix:

    • Weird grey background everywhere - edit: fixed it!
    • The legend

    And survive Hadley's wrath for doing what is fundamentally flawed.

提交回复
热议问题