Announcement

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

  • Subscripts in Stata graphs fail in only some instances

    Hi All:

    I'm trying to make some graphs and have encountered a problem (what seems to be a bug) in the use of subscripts with text in Stata graphs. If anyone knows of a fix I'd appreciate the help. Below are a few examples of what I've encountered. Note: (1) the graphs do not require datat, (2) I'm using Stata 15.

    The Problem: Some subscripts appear as superscripts, or nearly superscripts (i.e., in the syntax below, the 2 for tau 2 and the 1 for the y 1 at xaxis=-10 appear as superscripts, while all of the other subscripts appear as expected).


    Code:
    graph twoway ///
        (function y=normalden(x,0,4), range(-16 16) lw(medthick)),     ///
        xline(3, lpattern(dash))                     ///
        xline(-5, lpattern(dash))                     ///
        text(.118 -5 "{&tau}{sub:1}", place(c) size(large))        ///
        text(.118 3  "{&tau}{sub:2}", place(c) size(large))        ///
        yscale(range(0 .11))                        ///
        xlabel("")                            ///
        ylabel("")                            ///
        ytitle("") xtitle("")                        ///
        yscale(off)                             ///                
        text(.107 -10 "y{sub:1} = 0", place(c) size(large))        ///
        text(.107 -1  "y{sub:1} = 1", place(c) size(large))        ///
        text(.107 8   "y{sub:1} = 2", place(c) size(large))        ///
        title({bf:B}, size(huge) ring(11) pos(11))             ///
        legend(off) name(panelB, replace)                ///
        graphregion(fcolor(white)) plotregion(style(none))
    Qualifications and tests:
    (1) If "size(large)" is removed from the "text" specification in the above only the tau 2 superscript problem remains.
    (2) If, instead of "text," I use "xlabel" to define the Tau labels at the bottom of the graph the problem described in (1) persists.
    (3) Syntax for a similar graph, but with one vertical line and thus one tau label, works just fine (see below for syntax).



    Syntax for (3)--below--works just fine:
    Code:
    graph twoway ///
        (function y=normalden(x,0,4), range(-16 16) lw(medthick)), ///
        xline(3, lpattern(dash))    ///
        xlabel(3 "{&tau}")        ///
        yscale(range(0 .11))        ///
        ylabel("")            ///
        ytitle("") xtitle("")            ///
        yscale(off)             ///        
        text(.107 -8 "y{subscript:1} = 0", place(c) size(large))    ///
        text(.107 8 "y{subscript:1} = 1", place(c) size(large))    ///
        title({bf:A}, size(huge) ring(11) pos(11))      ///
        legend(off) name(panelA, replace)        ///
        graphregion(fcolor(white)) plotregion(style(none))
    Last edited by dbraudt; 13 Aug 2017, 12:29. Reason: added tags

  • #2
    I'm unable to replicate this problem. Your first code produces subscripts in all the places called for.

    My first suggestion is to make sure that you have the latest update. -update query-. The next thing I would do is exit Stata, re-launch it and try again. If that doesn't work, try re-booting your computer and trying again. If that doesn't work, try re-installing Stata (and update it) and then try again. If none of that works, then I would probably send this to Technical Support. If you do that, be sure to also provide them with the output Stata gives you from -about-.

    Comment


    • #3
      Thanks for the quick check and reply Clyde! I tried updating, exiting Stata, and rebooting the PC, all without success. ... But, you're comments, and success in executing the code, made me think about if the OS was the problem. I've been working on a Linux build and so I switched to Windows 10 and the code ran perfectly. Out of curiosity, are you running Stata on Mac OS X? If so, I think we've narrowed down the problem to a single OS build of Stata.

      For any Stata reps reading this, I followed the instructions provided by Stata (here), updating the file path to stata15.

      Thanks again Clyde.

      Comment


      • #4
        Actually, I'm running Windows 7, 64-bit. But there are plenty of Stata Mac users out there--lets hope one of them sees this thread and gives it a try.

        Comment


        • #5
          I can reproduce the same behaviour with Stata 15.1 on Linux. Example code:

          Code:
          sysuse auto
          twoway scatter mpg headroom price , legend(order(1 "mpg{sub:1}" 2 "headroom{sub:1}"))
          Result:
          Click image for larger version

Name:	image_13672.png
Views:	1
Size:	25.5 KB
ID:	1487232

          Comment

          Working...
          X