The book you described sounds like, 'Visualizing Categorical Data,' Michael Friendly.
The plot described in the 1st chapter that seems to match your request was described as a type of conceptual model for visualizing contingency table data (loosely described by the author as a dynamic pressure model with observational density), and can be seen in the google preview for Ch 1.
The book is geared towards SAS users.

A paper on the topic is referenced here:
www.datavis.ca/papers/koln/kolnpapr.pdf

'Conceptual Models for Visualizing Contingency Table Data,' Michael Friendly .

*incidentally, the author is also listed as one of the authors of the vcd package (as it was specifically inspired by his book mentioned above) --
maybe you could ask him directly if there's a simple modification to one of the built in functions that's not readily apparent.

** The coloring scheme seems to relate the color blue with positive deviations from independence, and red for negative deviations. Although the red scheme makes sense in that context, maybe it would have been more apt to have used green to represent positive deviations.

http://www.datavis.ca/papers/asa92.html

+1 to @NickSabbe, for 'the plot just tells you that "something is wrong"', which is often the best way to use a qq-plot (as it can be difficult to understand how to interpret them). It is possible to learn how to interpret a qq-plot by thinking about how to make one, however.

You would start by sorting your data, then you would count your way up from the minimum value taking each as an equal percentage. For example, if you had 20 data points, when you counted the first one (the minimum), you would say to yourself, 'I counted 5% of my data'. You would follow this procedure until you got to the end, at which point you would have passed through 100% of your data. These percentage values can then be compared to the same percentage values from the corresponding theoretical normal (i.e., the normal with the same mean and SD).

When you go to plot these, you will discover that you have trouble with the last value, which is 100%, because when you've passed through 100% of a theoretical normal you are 'at' infinity. This problem is dealt with by adding a small constant to the denominator at each point in your data before calculating the percentages. A typical value would be to add 1 to the denominator; for example, you would call your 1st (of 20) data point 1/(20+1)=5%, and your last would be 20/(20+1)=95%. *Now* if you plot these points against a corresponding theoretical normal, you will have a pp-plot (for plotting probabilities against probabilities). Such a plot would most likely show the deviations between your distribution and a normal in the center of the distribution. This is because 68% of a normal distribution lies within +/- 1 SD, so pp-plots have excellent resolution there, and poor resolution elsewhere. (For more on this point, it may help to read my answer here: PP-plots vs. QQ-plots.)

Often, we are most concerned about what is happening in the tails of our distribution. To get better resolution *there* (and thus worse resolution in the middle), we can construct a qq-plot instead. We do this by taking our sets of probabilities and passing them through the inverse of the normal distribution's CDF (this is like reading the z-table in the back of a stats book backwards--you read in a probability and read out a z-score). The result of this operation is two sets of *quantiles*, which can be plotted against each other similarly.

@whuber is right that the reference line is plotted afterwards (typically) by finding the best fitting line through the middle 50% of the points (i.e., from the first quartile to the third). This is done to make the plot easier to read. Using this line, you can interpret the plot as showing you whether the quantiles of your distribution progressively diverge from a true normal as you move into the tails. (Note that the position of points further out from the center are not really independent of those closer in; so the fact that, in your specific histogram, the tails seem to come together after having the 'shoulders' differ does not mean that the quantiles are now the same again.)

You can interpret a qq-plot analytically by considering the values read from the axes compare for a given plotted point. If the data were well described by a normal distribution, the values should be about the same. For example, take the extreme point at the very far left bottom corner: its $x$ value is somewhere past $-3$, but its $y$ value is only a little past $-.2$, so it is much further out than it 'should' be. In general, a simple rubric to interpret a qq-plot is that if a given tail twists off counterclockwise from the reference line, there is *more* data in that tail of your distribution than in a theoretical normal, and if a tail twists off clockwise there is *less* data in that tail of your distribution than in a theoretical normal. In other words:

- if both tails twist counterclockwise you have heavy tails (leptokurtosis),
- if both tails twist clockwise, you have light tails (platykurtosis),
- if your right tail twists counterclockwise and your left tail twists clockwise, you have right skew
- if your left tail twists counterclockwise and your right tail twists clockwise, you have left skew

## Best Answer

If $X$ has density (pdf) $f$ then $1/X$ does not have density $1/f$ (which is not even a density). Indeed, the change-of-variables formula teaches us that $Y:=h(X)$ has density $$\bigl|{(h^{-1})}'(y)\bigr|f(h^{-1}(y))$$ when $h$ is a "nice" invertible transformation.

I gave the formula for a general $h$, because $h^{-1}(y)=1/y$ when $h(x)=1/x$, and that could cause some confusion.

Then denoting by $f$ the density of your simulated Gamma distribution (

`rgamma`

), you have to compare your histogram with the density $$ \frac{1}{y^2} f\left(\frac{1}{y}\right)$$ :