Announcement

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

  • How to fix subscripts in Stata graphs

    Dear Statalisters,

    A previous post addressed a similar problem, but had no success in getting a solution:
    https://www.statalist.org/forums/for...some-instances

    In a nut shell: when we have multiple subscripts in a graph, only the first is OK. The remaining subscripts fail.

    Here is an example:

    Code:
    clear
    set seed 1234556
    set obs 200
    gene time = round(runiform()*7)
    gene group = runiform()>0.5
    gene y = cond(group==1,rnormal(100,5), rnormal(90,5))
    twoway qfitci y time if group==1 || qfitci y time if group==0, xlabel(0 "Baseline" 1 "T{subscript:1}" 2 "T{subscript:2}" 3 "T{subscript:3}" 4 "T{subscript:4}" 5 "T{subscript:5}" 6 "T{subscript:6}" 7 "T{subscript:7}")
    Has anyone found a solution for that? Is it a bug in Stata? I am under Stata SE 14.2 for Linux (Revision 16 Nov 2016).

    All the best,

    Tiago

  • #2
    Dear Tiago,

    this seems to execute correctly in Stata 16.0 on Windows. So it is either
    • already fixed, or
    • is platform-specific, or, perhaps,
    • is caused by some other factor that is not captured by your posted example.
    Best, Sergiy Radyakin

    Click image for larger version

Name:	subscript-superscript.png
Views:	1
Size:	81.5 KB
ID:	1568850



    Code:
    clear all
    set seed 1234556
    set obs 200
    gene time = round(runiform()*7)
    gene group = runiform()>0.5
    gene y = cond(group==1,rnormal(100,5), rnormal(90,5))
    twoway qfitci y time if group==1 || qfitci y time if group==0, xlabel(0 "Baseline" 1 "T{subscript:1}" 2 "T{subscript:2}" 3 "T{subscript:3}" 4 "T{subscript:4}" 5 "T{subscript:5}" 6 "T{subscript:6}" 7 "T{subscript:7}") name(g1) legend(rows(1))
    twoway qfitci y time if group==1 || qfitci y time if group==0, xlabel(0 "Baseline" 1 "T{superscript:1}" 2 "T{superscript:2}" 3 "T{superscript:3}" 4 "T{superscript:4}" 5 "T{superscript:5}" 6 "T{superscript:6}" 7 "T{superscript:7}") name(g2) legend(rows(1))
    graph combine g1 g2 , rows(2)

    Comment


    • #3
      Thank you so much for your prompt reply, Sergiy.

      It seems it has to do with either Stata 14 or linux. I will be checking the same code in a different platform.

      Thank you again.

      All the best,
      Tiago

      Comment


      • #4
        I get the same problem on Stata16 on linux, but only for subscripts.

        Click image for larger version

Name:	subscript.png
Views:	1
Size:	61.0 KB
ID:	1730504

        Comment

        Working...
        X