Q> on COMBINING PLOTS w/ diff. axes.
- Subject: [mg2607] Q> on COMBINING PLOTS w/ diff. axes.
- From: berriz at husc.harvard.edu (Zorro)
- Date: Mon, 27 Nov 1995 21:35:34 -0500
- Approved: email@example.com
- Distribution: local
- Newsgroups: wri.mathgroup
- Organization: Harvard University, Cambridge, Massachusetts
I often want to superimpose two graphs that have different vertical or horizontal axes. Typically, I want to show how two physical quantities, with different units, vary as a function of the same independent variable. Since the ordinate units are different, I would like to be able to show two different scales on the ordinate axis. Less frequently, the plots have the same ordinate units, but differ in the abscissa variable. The latter situation happens, for example, when I try to superimpose experimental frequency histograms produced with the graphics package function BarChart, onto the graph of the analytical expression for the corresponding probability density function. This is because BarChart uses the bin number as the abscissa variable, regardless of the actual physical range it represents. Therefore, as a rule, the histogram abscissa will conflict with the domain of the probability distribution function. For example, say I have an expression for a function P:[0,1] -> R representing a probability density on the interval [0,1], and in addition, I have experimental data of frequencies, that I can convert to a histogram. If the histogram has, say, 20 bins, then Mathematica defines the "abscissa range" of the resulting histogram plot to be something like [1,20], instead of having the same domain as P, which is, obviously, [0,1]. So my question are 1) in general, how does one get Mathematica to superimpose plots with different units on the vertical or horizontal axis, and 2) in particular, how does one get it to display histograms and functions together? Any words of wisdom? Thanks. Z.