Re: Plot axis length and size ratio (TwoPlot revive)
- To: mathgroup at smc.vnet.net
- Subject: [mg121571] Re: Plot axis length and size ratio (TwoPlot revive)
- From: "David Park" <djmpark at comcast.net>
- Date: Tue, 20 Sep 2011 06:09:40 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <27663898.180702.1316428706866.JavaMail.root@m06>
Matyi, This is how I would do it with the Presentations application. I would use a Frame plot rather than an Axes plot. I think if you look in scientific journals you will seldom see an axes plot where an axis cuts across the curves. << Presentations` yticks1 = CustomTicks[2.5 # &, {-8, 8, 4, 4}]; yticks2 = CustomTicks[Identity, {-30, 30, 10, 5}, CTNumberFunction -> (Style[#, Red] &)]; Draw2D[ {Draw[2.5 x Sin[x], {x, 0, 10}], Red, Draw[x (x - 10) Cos[x], {x, 0, 10}]}, AspectRatio -> 0.6, Frame -> True, FrameTicks -> {{yticks1, yticks2}, {Automatic, Automatic}}, FrameLabel -> {x, y1, None, Style[y2, Red]}, RotateLabel -> False, PlotLabel -> "Two Axis Plot", BaseStyle -> {FontSize -> 12}] First we define custom ticks for the two y axes. Then in a single Draw2D drawing statement we draw the two curves, scaling y1 by a factor of 2.5. Then we specify the overall look of the plot with options using the custom ticks defined initially. A notebook and PDF of this result will appear on the archive kept for me by Peter Lindsay at St. Andrews University Mathematics Department. http://www.st-andrews.ac.uk/~pl10/c/djmpark/ David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: matyigtm [mailto:matyigtm at gmail.com] Hi, I want to combine two plots with the same "x" axis into one graphic. Because the two plots have different magnitude, I choosed the "Inset" command inside of one of the two plots. I want to put the two "y" axes on left and right for the two plots, resp. (aka. TwoPlot) My problem is that the two plots take different sizes when the numbers written at the ticks on the "y" axis get different length, or when AxesLabel is used. I've understood the the area of the plot is extended by PlotRangePadding and with ImagePadding, but I cannot retrieve the latter from the plots to get the right sizes. The Inset command help a lot to position the origins of the two plots, but its "size" parameter looses any relation to the coordinates used in the plots. The following example illustrates the problem, the hardcoded number 1.045 is to be programmed to give good results. plt2 = Plot[x (x - 10) Cos[x], {x, 0, 10}, PlotStyle -> Red, AxesOrigin -> {10, 0}, AxesStyle -> Red]; Plot[x Sin[x], {x, 0, 10}, Epilog -> Inset[plt2, {0, 0}, {0, 0}, 10 * 1.045] Any idea to align the two plots is appreciated, Matyi