Announcement

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

  • scale of x axis

    Dear All,

    I have the following data:

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int Year double GlobalExport
    1950    150.4164
    1951    164.7418
    1952    171.9045
    1953    186.2299
    1954    200.5552
    1955    222.0433
    1956    236.3687
    1957    257.8567
    1958    250.6941
    1959    279.3448
    1960    315.1582
    1961    329.4836
    1962    350.9717
    1963    393.9478
    1964    436.9239
    1965    465.5747
    1966    501.3881
    1967    530.0389
    1968    587.3403
    1969    658.9672
    1970    716.2687
    1971    766.4075
    1972    830.8717
    1973    931.1493
    1974    981.2881
    1975    909.6613
    1976    1017.102
    1977    1060.078
    1978    1110.217
    1979    1167.518
    1980    1194.795
    1981    1187.985
    1982    1161.493
    1983    1191.692
    1984    1291.794
    1985     1325.38
    1986    1378.396
    1987    1454.207
    1988    1577.815
    1989    1678.795
    1990    1744.268
    1991    1808.806
    1992    1895.629
    1993    1979.036
    1994    2163.087
    1995    2323.155
    1996    2441.636
    1997    2688.241
    1998      2811.9
    1999    2941.248
    2000    3258.903
    2001     3252.12
    2002    3364.484
    2003    3552.919
    2004     3898.92
    2005    4154.229
    2006    4511.168
    2007    4803.425
    2008    4914.792
    2009    4320.877
    2010    4928.651
    2011  4557.16635
    2012 4418.939503
    2013 4444.857037
    2014 4427.578681
    end
    I would like to change the scale of the x axis from 1945 to 2015. I tried the following:

    Code:
    twoway(line GlobalExport Year, color(black)), legend(off) title({bf: Figure 9.6}: Rise of globalization (1950-2008), size(medsmall) justification(left) position(11) ring(100)) ytitle(Export, size(small)) xtitle(Time, size(small)) xscale(r(1945(10)2010))
    However it does not work. Do you have any suggestion?

    Thanks for any help you may provide.

    Dario

  • #2
    You are confusing or rather conflating the syntax of xscale() and that of xlabel(). (The same distinction would apply to any other pair of axis scale and axis label options.)

    Trivially as well 2010 is here a slip for 2015.

    This seems closer to your intent.

    Code:
    twoway(line GlobalExport Year, color(black)), legend(off) title({bf: Figure 9.6}: Rise of globalization (1950-2008), size(medsmall) justification(left) position(11) ring(100)) ytitle(Export, size(small)) xtitle(Time, size(small)) xlabel(1945(10)2015)

    Comment


    • #3
      Nick Cox Thanks a lot!

      Comment

      Working...
      X