Virata manual

graph line

Shows a number changing along another one, usually time. The chart for a trend.

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 line y x [if], [by(groupvar)]

Plots the mean of y at each value of x. by() draws one line per group, up to 8.

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
yeara numberalong the bottom; the line joins the average of mpce at each year
mpcea numberup the side
sectora categoryoptional: one line for each value

Three rows of it would look like this:

2004  2410.55  Rural
2004  3288.1  Urban
2006  2598.4  Rural

The example

. sysuse vira.sample01, clear
. graph line mpce year, 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.