Announcement

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

  • Customizing axis labels in by() graphs (after xrescale)

    Hi Statalisters,
    is there a way to change the axis labels of individual by()-graph "sub"plots? The by()-option "xrescale" allows for differently scaled axes, but I want to customize them myself, i.e. change the labels for each graph individually.
    Thanks in advance!
    Sönke

  • #2
    I do not know of an option to do this directly, but you can change the labels using (code from) the graph editor.

    Code:
    sysuse auto, clear
    tw scatter mpg weight, by(rep78, yrescale iyaxes)
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	66.8 KB
ID:	1604639



    So if I want to change the y-labels in subgraph #2, to start from 14 to 29 in increments of 3, I would use the following code:

    Code:
    sysuse auto, clear
    tw scatter mpg weight, by(rep78, yrescale iyaxes)
    gr_edit plotregion1.yaxis1[2].reset_rule 14 29 3 , tickset(major) ruletype(range) yaxis1[2] edits
    Res.:

    Click image for larger version

Name:	Graph.png
Views:	1
Size:	68.1 KB
ID:	1604640

    Comment


    • #3
      Hi Andrew,
      Great, your suggestion works perfectly!
      It seems that going via the graph editor is the only way. I've been searching through the help documentation all day but couldn't find any other method.
      Thanks a lot for your help!

      Comment

      Working...
      X