Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5092 > unrolled thread

Re: Plot axis length and size ratio (TwoPlot revive)

Started by"David Park" <djmpark@comcast.net>
First post2011-09-20 10:13 +0000
Last post2011-09-21 09:32 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Plot axis length and size ratio (TwoPlot revive) "David Park" <djmpark@comcast.net> - 2011-09-20 10:13 +0000
    Re: Plot axis length and size ratio (TwoPlot revive) matyigtm <matyigtm@gmail.com> - 2011-09-21 09:32 +0000

#5092 — Re: Plot axis length and size ratio (TwoPlot revive)

From"David Park" <djmpark@comcast.net>
Date2011-09-20 10:13 +0000
SubjectRe: Plot axis length and size ratio (TwoPlot revive)
Message-ID<j59p12$q7$1@smc.vnet.net>
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@comcast.net
http://home.comcast.net/~djmpark/  


From: matyigtm [mailto:matyigtm@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




[toc] | [next] | [standalone]


#5109

Frommatyigtm <matyigtm@gmail.com>
Date2011-09-21 09:32 +0000
Message-ID<j5cb0a$cq9$1@smc.vnet.net>
In reply to#5092
David,

I thank you for your ideas. I thought to underlay two plots because it
handles automatically the ticks, the ratios, extrema etc. of the plot.
I hoped (and still hope) that with an idea similar to the presented
one I could achieve my goal. Don't you have some guest without an
external, third part package (maybe later)?

Matyi

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web