Removing lines within filled.contour legend

前端 未结 2 1852
隐瞒了意图╮
隐瞒了意图╮ 2021-02-06 14:01

I might be missing something simple here... I can\'t find anyway to remove the lines that cross the legend differentiating different colours; following on the from the volcano t

相关标签:
2条回答
  • 2021-02-06 14:36

    You don't even need to change the filled.contour hardcode. Apparently the argument border in the function rect relies on par("fg"). Just set par(fg = NA) to remove those black lines.

    0 讨论(0)
  • 2021-02-06 14:45

    If you examine the code for filled.contour you'll see this line:

    rect(0, levels[-length(levels)], 1, levels[-1L], col = col)
    

    that draws the color key rectangle. It's vectorized, so it's drawing each of the individual color boxes. The function rect accepts an argument border, which if you set to NA will omit the internal borders of the rectangles. So create your own version of the function and change this line to :

    rect(0, levels[-length(levels)], 1, levels[-1L], col = col, border = NA)
    

    or make it an argument, rather than hard coding. When I do this, I get the following graph:

    enter image description here

    0 讨论(0)
提交回复
热议问题