I would like to know the code to create a graph (lines) with the y values (in this case "diff12") in another color (for example in red) when y<0,
I send the example of the data below:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int year float diff12 1995 .5012169 1995 .5012169 1995 .5012169 1995 .5012169 1995 .5012169 1995 .5012169 1995 .5012169 1995 .5012169 1996 . 1997 . 1997 . 1997 . 1997 . 1998 . 1999 .832201 1999 .832201 1999 .832201 1999 .832201 2000 -.3124819 2000 -.3124819 2000 -.3124819 2000 -.3124819 2000 -.3124819 2000 -.3124819 2000 -.3124819 2000 -.3124819 2000 -.3124819 2000 -.3124819 2003 .4381542 2003 .4381542 2003 .4381542 2003 .4381542 2003 .4381542 2003 .4381542 2003 .4381542 2003 .4381542 2003 .4381542 2003 .4381542 2003 .4381542 2003 .4381542 2004 -.623652 2004 -.623652 2004 -.623652 2004 -.623652 2004 -.623652 2004 -.623652 2004 -.623652 2004 -.623652 2004 -.623652 2004 -.623652 2004 -.623652 2004 -.623652 2004 -.623652 2004 -.623652 2004 -.623652 2004 -.623652 2004 -.623652 2005 -.4752033 2005 -.4752033 2005 -.4752033 2005 -.4752033 2005 -.4752033 2005 -.4752033 2005 -.4752033 2005 -.4752033 2005 -.4752033 2005 -.4752033 2005 -.4752033 2005 -.4752033 2005 -.4752033 2005 -.4752033 2005 -.4752033 2005 -.4752033 2005 -.4752033 2006 -.2263384 2006 -.2263384 2006 -.2263384 2006 -.2263384 2006 -.2263384 2006 -.2263384 2006 -.2263384 2006 -.2263384 2006 -.2263384 2006 -.2263384 2006 -.2263384 2006 -.2263384 2006 -.2263384 2006 -.2263384 2006 -.2263384 2006 -.2263384 2006 -.2263384 2007 -1.281406 2007 -1.281406 2007 -1.281406 2007 -1.281406 2007 -1.281406 2007 -1.281406 2007 -1.281406 2007 -1.281406 2007 -1.281406 end format %ty year
0 Response to Create graph with different colors when y<0
Post a Comment