Adjust plot title (main) position

前端 未结 3 1456
眼角桃花
眼角桃花 2020-12-02 18:18

I have been unable to find a way to adjust the (vertical) distance between plot and main title in R using par. In this example:

plot(1, 1, main = \"Title\")
         


        
3条回答
  •  萌比男神i
    2020-12-02 19:02

    To summarize and explain visually how it works. Code construction is as follows:

    par(mar = c(3,2,2,1))
    barplot(...all parameters...)
    title("Title text", adj = 0.5, line = 0)
    

    explanation:

    par(mar = c(low, left, top, right)) - margins of the graph area.
    
    title("text" - title text
          adj  = from left (0) to right (1) with anything in between: 0.1, 0.2, etc...
          line = positive values move title text up, negative - down)
    

提交回复
热议问题