Announcement

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

  • Size of legend box

    Hi,
    I am using tabplot command and would like to reduce the size of the legend box. Any ideas of how i can achieve this in Stata?

    Thanks in advance.

  • #2
    tabplot is a package from SSC. There are various settings for legends that can be changed.
    Code:
    help legend_options

    Comment


    • #3
      tabplot is best described as from Stata Journal given the paper on it in 2016.

      That aside, legends are not usual with tabplot, so I am especially curious to see what data and what command produced them.

      Comment


      • #4
        Below are the codes

        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input int year str25 subgroup double(var2 var3 var4 var5 var6 var7 var8)
        2014 "Nairobi"       30.6 29.9 16.1 11.5   10 34.5 41.8
        2014 "Central"       20.9 18.5  5.9  3.9  2.4 20.5 29.1
        2014 "Coast"         16.3 16.9  6.2  3.8  2.7 19.2 25.3
        2014 "Eastern"       21.9 22.6  9.1  6.6  5.6 25.1 31.5
        2014 "Nyanza"        31.4   31   13 10.5  8.4 33.5 41.2
        2014 "Rift Valley"   19.6 18.6  6.3  4.9  4.2 20.1 27.2
        2014 "Western"         35 29.1 19.3 11.8  7.8 36.6 45.2
        2014 "North Eastern"  3.5  5.8   .4   .4   .4  5.8  7.4
        2009 "Nairobi"       21.6   21  8.6  7.8  6.7 21.8   28
        2009 "Central"       23.6 23.5 10.3  6.9  6.1 26.9 32.8
        2009 "Coast"           28 18.2 11.2  7.3  6.6 22.1   33
        2009 "Eastern"         25 22.4 13.8 10.4  8.8 25.7 34.5
        2009 "Nyanza"        34.2 40.8 18.6 15.5 12.5 43.8 49.3
        2009 "Rift Valley"   24.5 32.1 15.5 13.4  9.7 34.1 39.2
        2009 "Western"       23.9 33.9 16.5 14.9 12.5 35.5   40
        2009 "North Eastern" 12.1 26.8  2.5  2.4  1.4 26.9 29.1
        2003 "Nairobi"       14.4 18.5  6.5  3.8  2.5 21.2 25.2
        2003 "Central"         12 16.8  7.7  4.6  3.5 19.9 23.5
        2003 "Coast"         13.1 13.5  5.8  4.4    4 14.9 18.9
        2003 "Eastern"       12.1 19.8 14.7  8.5  4.5   26 28.8
        2003 "Nyanza"        27.3 37.4 19.9 15.4 10.6 41.9   48
        2003 "Rift Valley"   17.5 25.8 11.1  7.7  3.9 29.2 35.3
        2003 "Western"       32.1 34.9 16.1   11  8.1   40 47.5
        2003 "North Eastern" 11.3 21.5   .9   .9   .3 21.5 23.6
        end
        Code:
        graph twoway (line var* year), legend(label(1 "Emotional") label(2 "Physical") label(3 "Sexual") label(4 "Physical and sexual") label(5 "Physical and sexual and emotional") label(6 "Physical or sexual") label(7 "Physical or sexual or emotional") col(3) size(vsmall) region(style(none))) ///
                     by(subgroup, title("Violence committed by husband/partner in the 12 months preceding the survey", size(medsmall)) subtitle("Percentage of ever married women", size(vsmall)) note("Source: Demographic and Health Survey")) ytitle("Percentage", size(vsmall)) ///
                     ylabel(,labsize(vsmall)) xlabel(,labsize(vsmall))

        Comment

        Working...
        X