Adjust spacing between text in horizontal legend

前端 未结 4 1264
甜味超标
甜味超标 2020-12-24 08:46

I have a plot with a horizontal legend:

 legend(\"bottomleft\", inset = c(0, -0.3), bty = \"n\",
        x.intersp=0, xjust=0,yjust=0,
        legend=c(\"AAP         


        
4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-24 09:03

    For my case, there were 5 legends in horizontal way. I have to customize the spacing between each legend. Following was the code snippet for this purpose.

    legend("topright",horiz = T, legend = df2, fill = col_box,
           inset = c(-0.2,-0.1), xpd = TRUE, bty = 'n', density = density_value, angle = angle_value, x.intersp=0.3,
           text.width=c(3.5,3.4,3.7,4.3,7))
    

    It was the text.width function that do the magic

提交回复
热议问题