# Is there a “hello, world” for statistical graphics?

In computer programming, there is a classic first program for learning/teaching a new language or system, called "hello, world". http://en.wikipedia.org/wiki/Hello_world_program

Is there a classic first data visualization for using a graphing package? If so, what is it? And if not, what would good candidates be?

-
Welcome to our site! Our faq does ask that "You should only ask practical, answerable questions based on actual problems that you face." Could you elaborate on what your actual problem is? –  whuber Jan 3 '13 at 17:48
I would like to identify the "standard test item" for statistical graphics, if one exists, to include in training material I am developing. –  Abraham D Flaxman Jan 3 '13 at 17:54
Because graphical applications vary so widely, it is hard to conceive of some standard or universal graphic. There are some standards for certain types of graphing packages, such as historically famous bunnies and teapots for 3D graphics. For your question to be answerable, then, it would help for it to be more specific about which package(s) your training material will be intended to cover. –  whuber Jan 3 '13 at 17:57
Good point, thanks. I will include at least something about statistical graphics in R, STATA, Python, and Javascript. –  Abraham D Flaxman Jan 3 '13 at 18:01
@AbrahamDFlaxman I am curious about this "training material" and who and what it is intended for. Can you say more? –  Peter Flom Jan 3 '13 at 20:07

Two thoughts:

A. When I try to get at the essence of "Hello World", it's the minimum that must be done in the programming language to generate a valid program that prints a single line of text. That suggests to me that your "Hello World" should be a univariate data set, the most basic thing you could plug into a statistical or graphics program.

B. I'm unaware of any graphing "Hello World". The closest I can come is typical datasets that are included in various statistical packages, such as R's AirPassengers. In R, a Hello World graphing statement would be:

plot (AirPassengers)  # Base graphics, prints line graph


or

qplot (AirPassengers) # ggplot2, prints a bar chart


or

xyplot (AirPassengers) # lattice, which doesn't have a generic plot


Personally, I think the simplest graph is a line graph where you have N items in Y and X ranges from 1:N. But that's not a standard.

-
The consensus from this and other answers is that there is not a "hello, world" of statistical graphics, currently. I think that your suggestion of a univariate dataset, with N items in Y and X ranging from 1:N is compelling. In further analogy to "hello, world", it would be nice to have a small N, and memorable Y. What do you think of N=5 and Y=(3,1,4,1,5,9) (i.e. digits of pi)? Maybe that is too mathy. –  Abraham D Flaxman Jan 4 '13 at 22:58
@AbrahamDFlaxman: I don't think it's to mathy, I think it's great. Memorable, short, and the graph is not just a straight line or anything. The data's well-known and not tied to any particular program, and can be arbitrarily extended by anyone wanting more points. I vote for it! –  Wayne Jan 5 '13 at 0:57

I would probably start with scatterplots and demonstrate the four ugly correlations.

-
+1. But you might want to consider something a little more general, such as some form of line plot. After all, as soon as you can draw a line segment, you can draw anything. This echoes the idea behind "Hello, world!": once you can get readable output from a program, you know you can communicate with the computer and the rest is just details :-). (The details can be hard. When learning to write Assembly code for the IBM 360 mainframe, the simplest way to get output was to store it in RAM and create an error at the end of execution, causing the system to print a hexadecimal core dump!) –  whuber Jan 3 '13 at 18:10
I think Anscombe's quartet in total contains too much to be the used as the "hello, world" of statistical graphics, but Figure 1 from his paper could be a good candidate. Other answers have made the case for a univariate data set, however, which I am leaning towards. –  Abraham D Flaxman Jan 4 '13 at 22:54

The histogram of a sample of a normally distributed random variable.

-
I like the way this would look, but maybe histograms require more data processing than scatters, and coming up with samples from the normal distribution may be distracting. –  Abraham D Flaxman Jan 4 '13 at 23:00
I just noticed that this is the first example from the Matplotlib web page: matplotlib.org –  Abraham D Flaxman Jan 18 '13 at 0:17

I think the answer is "no". That is, there is no generally agreed upon answer to your question.

But I'd consider what plot does in R: It depends on the data!

You could argue that univariate statistics are simpler than bivariate ones. So... perhaps the most basic thing is a histogram; or perhaps a bar plot; maybe a density plot.

If the point of "Hello, World!" is to show that you can make the computer do something then I'd say any plot would do.

-
Perhaps the absence of a standard test item indicates that you are correct, and it is more appropriate to use whatever plot is simplest in the system being demonstrated. That makes it hard to compare, however. –  Abraham D Flaxman Jan 4 '13 at 23:01

Not sure if it exactly qualifies as a hello world, but in R there are also demos built into many packages. e.g.

library(graphics)
demo(graphics)


will step the user through some basic graphics available in the package. Just mouse click over each image to step through basic graphics illustrations. With just two lines, the user is introduced into some of the inspiring capabilities of R graphics for statistics.

Corresponding code to generate the graphics is displayed in the R console.

-

I'd say there were two "Hello World" type programs for data visualization:

Print("Hello World"): Something like the histogram of a normally distributed variable, or perhaps a simple X,Y scatterplot.

For something slightly more complex, like the section where one takes the principles of Hello World and starts playing with user input, escape characters and the like, I'd say it would be playing around with the Iris data set.

-