Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Graph legend labels: How to increase space between lines?

    How can the space between lines in multi-line legend labels be increased? According to help legend options, this is supposed to be controlled with the linegap() option. However, the two graphs below look the same. What am I doing wrong?
    Code:
    sysuse auto
    graph bar mpg weight, legend(label(1 "Line 1" "Line 2" "Line 3")) name(g1, replace)
    graph bar mpg weight, legend(label(1 "Line 1" "Line 2" "Line 3") linegap(*2)) name(g2, replace)
    I also tried rowgap() but according to the documentation it controls the space between legend rows and has no effect on the graph, either. In my example the legend has only one row.
    Code:
    graph bar mpg weight, legend(label(1 "Line 1" "Line 2" "Line 3") rowgap(*2)) name(g3, replace)

  • #2
    I found out that the linegap() option has no effect if it is specified via multiplication. For example, the option linegap(*2) does not change the appearance of the graph.
    Code:
    graph bar mpg weight, legend(label(1 "Line 1" "Line 2" "Line 3") linegap(*2)) name(g2, replace)
    The option linegap(2), without multiplication, changes the appearance of the graph.
    Code:
    graph bar mpg weight, legend(label(1 "Line 1" "Line 2" "Line 3") linegap(2)) name(g4, replace)
    I don't know if this is a bug but I will report it to Stata tech support.

    Comment


    • #3
      Hey, you can try -symysize()-. For more information, read page 6 in this document

      Code:
       
       graph bar mpg weight, legend(label(1 "Line 1" "Line 2" "Line 3") symysize (5)) name(g4, replace)

      Comment

      Working...
      X