Announcement

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

  • ITSA legend

    I would like to changed the legend of my post trend ITSA graph to be on the bottom rather than on the side of the graph


    The code I am using is below. When I run it with legend customizations, I get an error "Legend() not allowed", Can you help me?

    ----------------------- copy starting from the next line -----------------------
    Code:
    sysuse tsline2.dta
    tsset day
    display td(16mar2002)
    
    itsa calories, trperiod (15415) lag(1) fig posttrend legend(position(1))
    ------------------ copy up to and including the previous line ------------------



    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(day calories ucalories lcalories)
    15341   3750   3850   3650
    15342 3708.6 3808.6 3608.6
    15343 3844.8 3944.8 3744.8
    15344 3761.2 3861.2 3661.2
    15345 3579.8 3679.8 3479.8
    15346 3631.8 3731.8 3531.8
    15347 3575.6 3675.6 3475.6
    15348   3600   3700   3500
    15349 3682.2 3782.2 3582.2
    15350 3685.4 3785.4 3585.4
    15351   3591   3691   3491
    15352 3559.4 3659.4 3459.4
    15353 3543.2 3643.2 3443.2
    15354 3612.6 3712.6 3512.6
    15355 3580.8 3680.8 3480.8
    15356   3560   3660   3460
    15357 3656.4 3756.4 3556.4
    15358   3679   3779   3579
    15359 3579.2 3679.2 3479.2
    15360 3541.4 3641.4 3441.4
    15361 3583.4 3683.4 3483.4
    15362 3559.6 3659.6 3459.6
    15363 3505.6 3605.6 3405.6
    15364 3477.8 3577.8 3377.8
    15365 3580.2 3680.2 3480.2
    15366 3598.6 3698.6 3498.6
    15367 3582.2 3682.2 3482.2
    15368 3588.6 3688.6 3488.6
    15369 3493.4 3593.4 3393.4
    15370 3500.6 3600.6 3400.6
    15371   3525   3625   3425
    15372   3582   3682   3482
    15373 3557.8 3657.8 3457.8
    15374 3593.6 3693.6 3493.6
    15375 3652.2 3752.2 3552.2
    15376 3551.6 3651.6 3451.6
    15377 3653.4 3753.4 3553.4
    15378 3638.4 3738.4 3538.4
    15379 3571.8 3671.8 3471.8
    15380 3704.6 3804.6 3604.6
    15381 3704.2 3804.2 3604.2
    15382   3628   3728   3528
    15383 3583.4 3683.4 3483.4
    15384 3596.6 3696.6 3496.6
    15385   3598   3698   3498
    15386 3626.8 3726.8 3526.8
    15387 3567.4 3667.4 3467.4
    15388 3617.6 3717.6 3517.6
    15389 3552.4 3652.4 3452.4
    15390 3589.4 3689.4 3489.4
    15391 3639.8 3739.8 3539.8
    15392 3599.4 3699.4 3499.4
    15393 3608.4 3708.4 3508.4
    15394 3632.4 3732.4 3532.4
    15395 3614.2 3714.2 3514.2
    15396 3541.6 3641.6 3441.6
    15397 3670.6 3770.6 3570.6
    15398 3720.2 3820.2 3620.2
    15399 3635.4 3735.4 3535.4
    15400 3533.2 3633.2 3433.2
    15401 3550.8 3650.8 3450.8
    15402   3595   3695   3495
    15403 3593.6 3693.6 3493.6
    15404 3625.2 3725.2 3525.2
    15405 3621.6 3721.6 3521.6
    15406 3629.2 3729.2 3529.2
    15407 3582.8 3682.8 3482.8
    15408 3613.6 3713.6 3513.6
    15409 3649.2 3749.2 3549.2
    15410 3569.2 3669.2 3469.2
    15411 3554.4 3654.4 3454.4
    15412 3598.4 3698.4 3498.4
    15413 3569.4 3669.4 3469.4
    15414 3564.4 3664.4 3464.4
    15415 3618.2 3718.2 3518.2
    15416 3569.4 3669.4 3469.4
    15417 3532.8 3632.8 3432.8
    15418 3699.6 3799.6 3599.6
    15419 3850.6 3950.6 3750.6
    15420 3662.4 3762.4 3562.4
    15421   3625   3725   3525
    15422 3657.4 3757.4 3557.4
    15423 3548.2 3648.2 3448.2
    15424 3583.2 3683.2 3483.2
    15425 3582.2 3682.2 3482.2
    15426 3624.4 3724.4 3524.4
    15427 3735.2 3835.2 3635.2
    15428 3630.6 3730.6 3530.6
    15429 3498.6 3598.6 3398.6
    15430 3591.4 3691.4 3491.4
    15431   3673   3773   3573
    15432 3604.6 3704.6 3504.6
    15433   3549   3649   3449
    15434 3565.2 3665.2 3465.2
    15435   3551   3651   3451
    15436 3489.2 3589.2 3389.2
    15437 3629.6 3729.6 3529.6
    15438 3563.6 3663.6 3463.6
    15439   3518   3618   3418
    15440 3574.8 3674.8 3474.8
    end
    format %td day
    ------------------ copy up to and including the previous line ------------------

    Listed 100 out of 365 observations
    Use the count() option to list more

    .

  • #2
    from the help file, it appears that your code is not correct; I believe that you need to put any twoway graph options (such as legend), in parentheses that immediately follow the "figure" option

    also, your use of "trperiod" is incorrect

    the following works for me on your data:
    Code:
    itsa calories, trperiod(16mar2002) lag(1) figure(legend(position(1))) posttrend

    Comment


    • #3
      Rich, this worked perfectly, Thank you!

      Comment

      Working...
      X