I am trying to create a graph using the command xtline. The graph contains a line for the variable y for each one of the three groups in my panel (group is the panel var). However, I am interested in creating a graph that shows the same information as what I would obtain using xtline, but without connecting the data points, just showing the points the way they are, and showing a different symbol for each one of the groups. I tried to use the option connect(none), but it seems to do not be an available option for xtline (or I did not know how to add it to the command).
These are the instructions I am using to generate a graph that contains the three lines that plot the mean value of a variable "y" across time, for each of the groups.
Code:
collapse y [weight=weighta], by(group year) xtset group year xtline y, overlay legend(lab(1 "Group1") lab(2 "Group2") lab(3 "Group3") position(6) order(3 1 2))
Code:
xtline y, plot(connect(none)) overlay legend(lab(1 "Group1") lab(2 "Group2") lab(3 "Group3") position(6) order(3 1 2))
connect(none) is not a twoway plot type
The following is a sample of my dataset:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(y weighta group) int year 11.428572 10570 2 2010 11.842364 10150 2 2011 12.320623 9756 2 2012 13.00975 9024 2 2013 12.222222 9180 2 2014 11.46325 8898 2 2015 11.49895 9053 2 2016 10.81656 6111 1 2010 12.635822 5706 1 2011 13.122416 5563 1 2012 12.733035 5364 1 2013 13.802083 4992 1 2014 14.136683 4697 1 2015 16.248613 4505 1 2016 11.788158 128171 2 2010 11.582245 122895 2 2011 11.096654 114512 2 2012 11.414516 109974 2 2013 11.05669 107799 2 2014 10.2708 101034 2 2015 10.124253 94565 2 2016 9.078657 24486 1 2010 8.650405 21236 1 2011 9.480315 19050 1 2012 8.55654 17846 1 2013 8.724371 18924 1 2014 9.667835 20532 1 2015 10.1494 22356 1 2016 9.218224 5641 2 2010 9.778789 4837 2 2011 7.886231 4641 2 2012 6.324973 4585 2 2013 5.9375 4480 2 2014 2.773284 4327 2 2015 3.17662 3935 2 2016 12.498936 35227 2 2010 12.42346 34459 2 2011 12.072604 33166 2 2012 12.735373 30749 2 2013 12.47237 30764 2 2014 12.01376 30232 2 2015 12.168823 29214 2 2016 6.757194 12372 0 2010 6.576466 12195 0 2011 6.452705 11809 0 2012 6.471396 10925 0 2013 6.692101 9698 0 2014 7.399577 8987 0 2015 11.356073 9616 0 2016 11.248214 20990 2 2010 12.83428 19557 2 2011 12.732884 17820 2 2012 11.994135 17050 2 2013 12.228617 17549 2 2014 11.605978 16862 2 2015 11.81248 16745 2 2016 end
0 Response to Creating a graph using xtline without connecting the data points. Shading some areas of the graph
Post a Comment