Announcement

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

  • Histogram, by() and graph region color

    Hello,

    I've recently discovered the by() option can be used with histogram (after the comma rather than bysort before the command) to quickly split graphs by groups. However I often use the graphregion(color()) command for publishing reasons and I've found that it doesn’t work with histogram, by() for some reason. It doesn’t give any sort of error it just doesn’t change the color. I can get around it using loops and graph combine but it’s an annoying little niggle in what should be a convenience feature – can anyone shed any light on this issue?

  • #2
    You don't show us any code to comment on (FAQ Advice #12). But the following may show you what you're doing wrong.

    Code:
    sysuse auto, clear
    set scheme s1color
    histogram mpg, by(foreign) freq
    histogram mpg, by(foreign) freq graphregion(color(gs15))
    histogram mpg, by(foreign, graphregion(color(gs15))) freq
    FWIW, I don't find it easy to remember or even to understand when options are tucked inside by() and when not.

    Comment


    • #3
      Hi Nick,

      Thanks for the answer - that's solved it for me! I didn't even know you could put options inside by()

      Sorry for the code omission, I would provide some now but your last example above was exactly what I was after.

      Comment

      Working...
      X