【问题标题】:Expand plot region in windroses using ggplot 2 and polar coordination system使用 ggplot2 和极坐标系在窗口中扩展绘图区域
【发布时间】:2015-05-19 15:06:13
【问题描述】:

我正在寻找以下问题的解决方案: 目前,我正在按照 Andy Clifton 在here 上提供的脚本使用 ggplot2 制作风玫瑰图。

这非常有效,我非常感谢提供的脚本。但是我有一个问题。 X 轴的标签会被绘图的边缘截断,尤其是在刻面绘图时。 有没有办法扩展情节以使文本完全显示?

(可以在上面的链接中找到示例图片)

【问题讨论】:

    标签: r ggplot2 rose-diagram


    【解决方案1】:

    为了练习风玫瑰,使用最后的数据框,我创建了下面的图,它没有 x 轴标签被截断的问题。诚然,它不涉及风速或 24 小时框架,因为它是针对支付给两种供应商的金额而设计的,但情节和数据可能会帮助其他人更轻松地做出反应。

    > dput(lfvendrose)
    structure(list(Time = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), Payee = structure(c(1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Firm", "Vendor"), class = "factor"), 
        Data1 = structure(c(12L, 10L, 8L, 13L, 7L, 9L, 14L, 3L, 5L, 
        17L, 6L, 11L, 2L, 15L, 18L, 2L, 4L, 19L, 1L, 16L, 18L, 2L, 
        15L, 18L), .Label = c("0, 1", "0, 13", "0, 15", "0, 2", "0, 20", 
        "0, 34", "0, 39", "0, 40", "0, 41", "0, 45", "0, 48", "0, 50", 
        "0, 64", "0, 68", "0, 9", "0, 90", "0, 94", "0,11", "0,16"
        ), class = "factor"), Month = structure(c(5L, 4L, 8L, 1L, 
        9L, 7L, 6L, 2L, 12L, 11L, 10L, 3L, 5L, 4L, 8L, 1L, 9L, 7L, 
        6L, 2L, 12L, 11L, 10L, 3L), .Label = c("Apr", "Aug", "Dec", 
        "Feb", "Jan", "Jul", "Jun", "Mar", "May", "Nov", "Oct", "Sep"
        ), class = "factor"), Month.1 = structure(c(5L, 4L, 8L, 1L, 
        9L, 7L, 6L, 2L, 12L, 11L, 10L, 3L, 5L, 4L, 8L, 1L, 9L, 7L, 
        6L, 2L, 12L, 11L, 10L, 3L), .Label = c("Apr", "Aug", "Dec", 
        "Feb", "Jan", "Jul", "Jun", "Mar", "May", "Nov", "Oct", "Sep"
        ), class = "factor"), Data2 = structure(c(11L, 10L, 6L, 12L, 
        8L, 4L, 13L, 3L, 7L, 15L, 9L, 5L, 2L, 14L, 16L, 1L, 11L, 
        10L, 6L, 12L, 8L, 4L, 13L, 3L), .Label = c("0, 13,1", "0, 13,50", 
        "0, 15, 30", "0, 40, 100", "0, 40,1", "0, 40,3", "0, 40,5", 
        "0, 45, 5", "0, 45,15", "0, 45,2", "0, 50,1", "0, 64, 4", 
        "0, 64,200", "0, 9,150", "0, 94,10", "0,11, 400"), class = "factor")), .Names = c("Time", 
    "Payee", "Data1", "Month", "Month.1", "Data2"), class = "data.frame", row.names = c(NA, 
    -24L)) 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-04-14
      • 1970-01-01
      • 2012-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-01
      相关资源
      最近更新 更多