Virata manual

graph slope

One line per category, from its value in the first group to its value in the second. Shows who rose and who fell, and where the order changed.

What we have

  • statistics: count, max, mean, median, min, sum
  • over() for the categories and by() for a second split
  • title(), ytitle() and saving()
  • one self-contained .html file: no server, no internet, nothing to install
  • a table view beside the chart, so the numbers can be read off

Coming later

  • saving as PNG or SVG — graph export does not exist yet
  • graph twoway and graph matrix, which are refused
  • 84 more of the 105 catalogue chart types

How you write it

graph slope [(stat)] varname [if] [weight], over(catvar) by(groupvar)

One line per category from its value in the first group to its value in the second. by() must have exactly two groups; up to 12 lines. Click a line to emphasise it.

What your data has to look like

One row per person or record, with these columns (named here as they are in vira.sample01):

ColumnHoldsWhat it does in the chart
statea categoryone line for each state (over), at most 12
sectora categoryexactly two values: the left and right ends (by)
mpcea numberthe height at each end (the average)

Three rows of it would look like this:

Bihar  Rural  2410.55
Bihar  Urban  3288.1
Kerala  Rural  4102.8

The example

. sysuse vira.sample01, clear
. graph slope mpce, over(state) by(sector)

That is the real file the command wrote — open it on its own. It is one self-contained page with no internet connection needed, so you can email it or drop it into a report.