Setting Defaults for geoms and scales ggplot2

后端 未结 2 1501
野的像风
野的像风 2020-11-29 08:41

Theming for ggplot2 makes it quite easy to relegate the need for multiple or repetitive + opt()... lines. However, I would like to know if there is a way to def

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-29 09:12

    I can't think of anything useful for the geoms, but for the scales, one option would be to use the fact that components of ggplots are all simply R objects that can be saved, stored and reassigned like any other.

    So you could perhaps create your own collection of "default" versions of many scales, like:

    sfmDefault <- scale_fill_manual(...)
    scmDefault <- scale_colour_manual(...)
    

    etc. with your desired default values. Put them in your .RProfile or wherever and use them as needed.

提交回复
热议问题