Announcement

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

  • Reducing size of graph title while using by option in histogram

    Click image for larger version

Name:	hist_combined_belief_verbabuse_vpast.png
Views:	2
Size:	77.1 KB
ID:	1732065
    I generated this graph using the following code:
    local k=0
    ds vpast*
    foreach i of varlist `r(varlist)'{
    local k = `k'+1
    hist p170, percent by(`i',note("") compact) name(hist`k') xtitle("")
    graph save hist`k' "$gwave1\past_violence\hist_belief_verbabuse_`i'.g ph" , replace
    }

    graph combine hist1 hist2 hist3 hist4, name( verbabuse_vpast) title("Belief about patner being verbally abusive to you in the next 12 month")
    graph export "$gwave1\past_violence\hist_combined_belief_verbab use_vpast.png", replace
    I want to reduce the size of the title of each subgraph in this figure to avoid the cluttering of titles that can be seen in the first panel of the figure. I tried changing the by option in the following way: by(`i',note("") compact title(,size(small))) . However, this didn't work. I have tried similar variations like subtitle and caption also. None of this worked. How can I solve this issue? Thanks in advance.
    Attached Files

  • #2
    you'd think , subtitle(, size(tiny)) would work but it doesn't.

    you can change it in the data editor, save it, then re-run it when needed.

    but I suspect there's a direct trick, but can't figure it out.

    Comment


    • #3
      Originally posted by George Ford View Post
      you'd think , subtitle(, size(tiny)) would work but it doesn't.
      This works for me. The option should be placed outside -by()-.

      Code:
      webuse census, clear
      hist pop, by(region) subtitle(, size(tiny))

      Comment


      • #4
        Doh! Thanks Andrew.

        Comment


        • #5
          You could shorten it too.

          Comment


          • #6
            Thank you so much everyone! Andrew's solution worked smoothly

            Comment


            • #7
              In your best interests I suggest fixing the typos

              Code:
              Belief about patner being verbally abusive to you in the next 12 month
              and shortening to say

              Code:
              Will partner be verbally abusive in next year?
              It would be good practice no doubt to give the exact wording somewhere, but once you do that no-one should mind concise equivalents in graph titles.

              Comment

              Working...
              X