Hi all,

I want to create an overlaid area plot, with different types of assets (and debts) as yvars and time on the x-axis, similar in style to the one in the photo I am attaching.
Array

I have tried to do this in Stata 17 using the following code, only for asset types, but it always depicts something that looks like modern art. Of course, I have researched the relevant Stata commands and follow those recommendations, but I cannot spot what is wrong.

Code:
twoway area housing_and_non_fin_assets stocks_and_business time if percrent==1 | percrent==2, sort
//This is for bottom half of the income distribution percrent=1 means bottom quartile and so on
1) Is it something to do with the fact that my time variable is discrete? Here, it only takes values == 2002(3)2017. I do not think it should be this, because for Stata this is a continuous variable if I am not wrong
2) What I would want to do is to plot the mean of the asset holdings for each type. Of course, one plot for each income group. I am not sure, however, whether the twoway area command is performing this operation.

Here is an example of my data:
Code:
* Example generated by -dataex-. For more info, type help dataex

clear

input float(housing_and_non_fin_assets stocks_and_business bonds_and_liquid_fin time housing_debt) double non_housing_debt

   269000   300000     1000 2017         0     0

  2734414 17640000    21068 2011     30000 30000

  1565000   982249    10000 2011    570000     0

    18030        0    32454 2002         0     .

   132000        0     3800 2011         0     0

  1012890   326475    36204 2011         0     0

 12020.24        0  3005.06 2005         0     0

  2375008   300000   183538 2014         0     0

   126202        0     1500 2008         0     0

    12000        0      500 2002         0     .

  2045876    10000   100000 2014      9682     0

   132300    24075    19200 2002         0     .

     8414        0      259 2002     83738     .

   377607        0    18000 2011         0     0

 16928.18        0     1602 2008         0     0

   525000   670000     3000 2011         0     0

   137801        0     1500 2014         0  7450

   748000   202000    38000 2005         0     0

   213803    14400    46594 2002         0     .

  1590000    30000    24000 2002         0     .

   640961    18000    20000 2011         0     0

 714708.5   475000    22000 2005         0 33000

   324000        0     3000 2005 120151.82     0

    30500     3000     1000 2002     60000     .

   287898        0    51086 2011         0     0

   351982    26000    35000 2017    169000     0

548748.75   270000    10000 2008         0     0

  1344025  2500000   125000 2017         0     0

   586576        0     5000 2017     78000  8475

   110985        0  1803.04 2005         0     0

      600        0    24000 2002         0     .

 652699.1        0  6010.12 2005         0     0

  2002825    14000     7890 2014         0     0

   727567   180304     9000 2011         0     0

   312124        0    43500 2011         0     0

   256750        0    10836 2017     50000     0

   203266     1500     2800 2014         0     0

195323.88     5229     3000 2005     80000     0

     9500        0     1000 2002         0     .

    12000        0    25200 2002         0     .

   828000    12000    26000 2011    410000 17500

   798000   946769     3000 2008    135000     0

   287000     3000     2000 2005         0     0

    23753     9015    30217 2002         0     .

  3035594  4500000   170000 2017    370000     0

  2091522 12026252 12020.24 2005         0     0

 29449.59        0    34000 2005  30050.61     0

  1310108   213820    10000 2017    148732  5686

  1462000        0   100000 2014         0     0

  1623860    35809    12000 2011      6010     0

   786769  1506000    27000 2014    230000     0

    21000        0     1716 2002         0     .

   611012        0      200 2008     85000     0

   567229    55433     6227 2005         0     0

   632984   695784   430000 2011         0     0

   315106        0     5000 2017         0     0

   117162        0      150 2011     12000   820

    80000    50000     5000 2017     21550 30408

   529682        0    20000 2011     42071     0

   299405     1500     8764 2011         0     0

    10478        0      120 2002         0     .

   786000   252000    15000 2017       339  1200

   426000        0     1810 2017     50000 50000

    15000        0        0 2005         0     0

   350200    85031   107000 2011         0     0

   810800    22000   324227 2011         0     0

    31010        0    13000 2014         0     0

   310455     3000    32500 2011         0     0

    48000        0   299679 2002         0     .

  1074900   462958    22000 2008     48081     0

    69000        0      646 2002         0     .

   295495        0    52984 2011         0     0

   282475        0     1500 2008         0  6500

    87685    48500    54000 2017         0     0

  2150562   600000    30000 2008         0     0

 25030.36     8000    12500 2005  42070.85     0

   151455        0    10000 2008     18030     0

   335557        0    37500 2014         0     0

 439940.7        0   312000 2008         0     0

     6000        0       30 2002         0     .

   126500        0      190 2011    150000  2500

   134700    20653      390 2011     40000     0

    16000    12740     1000 2002         0     .

    24040        0    25843 2002         0     .

  2810000  8000000  2400000 2014    150253     0

    13380        0     1800 2002         0     .

   166253        0     5000 2011         0     0

   649257        0    20600 2017         0     0

   618225   226553   225796 2005         0     0

   246040        0    12000 2014     42000 42000

   431761     4700    55000 2017         0   250

 732981.8  3188000   170000 2005         0     0

  4515075   406570    24107 2008   1500000     0

  1250351   118000    23500 2017         0 16622

   320506        0    10000 2008     68066  7000

    57355        0     7100 2002         0     .

 363607.5   150253    32000 2011      3000 55000

   608212     6069   103000 2017    147000     0

   445400    80000    12000 2014    118000     0

   939614        0    10000 2008         0 10600

end

Best regards,