[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Adding a Reference Point to a -tabplot- Graph

From   "Nick Cox" <>
To   <>
Subject   st: RE: Adding a Reference Point to a -tabplot- Graph
Date   Fri, 24 Jul 2009 18:13:45 +0100

You'd need to replicate -tabplot-'s internal logic. So for example the
height of the top of each bar is in essence 

category_code (1, 2, 3, etc.) 


[(Frequency in cell)/(Maximum frequency over all cells)] 
* Maximum height of bar 

So you'd need to replicate that kind of calculation for whatever you
were superimposing on top. 

My guess is that this is entirely possible but not trivial. 


Marshall Garland

I'm attempting to generate graphs across multiple levels (schools)
that display the percentage of students within a particular school and
within a particular subgroup (let's say, gender, or ethnicity, etc.)
that accomplished a particular task. The data are longitudinal, so
these outcomes are captured across multiple years (two, to be
precise). Thus, my X and Y variable are both categorical. -tabplot-,
of course, works brilliantly for this.

However, I would also like to add a reference point to each category
that shows the aggregate percentage (that is, across all schools in a
given year, not just a particular one) for each task for each student
subgroup. It seems as though some overlay using the addplot option for
-tabplot- would work, but I can't seem to figure out how to do this.
I've experimented with using -combine graph- to add additional figures
of the aggregate results for each year, but I'm unhappy with the

Here's my syntax thus far:

***figure 2***
levelsof school_name, local(levels)
foreach school_name of local levels {
	tabplot ethniccode enroll_type_final, by (hs_grad_year)
percent(ethniccode hs_grad_year) ytitle(, orient(hor)) ///
	scheme(s2color) showval ///
	ylabel(, nogrid) legend(nostack rows(1) size(small) nobox
region(lcolor(white) lwidth(vvvthin))) ///
	xtitle(`school_name') xtitle(, justification(center)) ///
	by(, note(, color(white)))

My data look like this:

Student	School	Year	Y	X
1	A	2007	1	3
2	A	2008	3	2
4	B	2008	4	5
5	B	2007	1	4
7	C	2007	2	2
8	C	2008	4	4

Any ideas or recommendations would be greatly appreciated.



-tabplot- reference:
*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index