Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Graph inside another graph

2 views
Skip to first unread message

mar...@gmail.com

unread,
Aug 23, 2006, 7:34:00 AM8/23/06
to
Hello,
I am generating graphs in mathematica 5.0 that I export to eps for use
in latex.
I have two graphics objects each from MultipleListPlot[.], However I
cannot seem to find a way to place a graph inside another graph (the
inside graph
being smaller and in an upper corner having it's own axis but within
the frame of the larger graph). If anyone knows an easy method to do
this, or any method at all I would appreciate it.

Bob Hanlon

unread,
Aug 25, 2006, 5:38:23 AM8/25/06
to
Plot[E^x, {x, 0, 5},
PlotStyle -> Blue,
Epilog -> Rectangle[{.25, 5}, {3.25, 150},
Plot[E^x, {x, -0.1, 2.1},
PlotStyle -> Blue,
Frame -> True,
DisplayFunction -> Identity]],
Frame -> True];


Bob Hanlon

Jens-Peer Kuska

unread,
Aug 25, 2006, 5:39:24 AM8/25/06
to
Hi,

Block[{$DisplayFunction = Identity}, plt1 =
Plot[Sin[x], {x, -Pi, Pi}];
plt2 = Plot[Sin[x]/x, {x, -4Pi, 4Pi}]
];
Show[
Graphics[
{Rectangle[{0, 0}, {1, 1}, plt1],
Rectangle[{0.55, 0.15}, {0.95, 0.5}, plt2]
}]
]

Regards

Jens

<mar...@gmail.com> schrieb im Newsbeitrag
news:echef8$ope$1...@smc.vnet.net...

Jean-Marc Gulliet

unread,
Aug 25, 2006, 5:45:27 AM8/25/06
to

Use Rectangle as in

Block[{$DisplayFunction = Identity},

g1 = Plot[Sin[x], {x, 0, 2*Pi}]; g2 = Plot[Cos[x], {x, 0, Pi}]; ];
Show[Graphics[{Rectangle[{0, 0}, {5, 1}, g1], Rectangle[{3, 0}, {4, 2},
g2]}]];

HTH,
Jean-Marc

David Annetts

unread,
Aug 25, 2006, 5:55:34 AM8/25/06
to
Hi Maruth,

> I am generating graphs in mathematica 5.0 that I export to
> eps for use in latex.
> I have two graphics objects each from MultipleListPlot[.],
> However I cannot seem to find a way to place a graph inside
> another graph (the inside graph being smaller and in an upper
> corner having it's own axis but within the frame of the
> larger graph). If anyone knows an easy method to do this, or
> any method at all I would appreciate it.

Use Rectangle[]. It's explained in the online documentation where there are
a few examples.

Here is another. First generate some data.

lst1 = Random[] & /@ Range[10];
lst2 = Random[] & /@ Range[10];
lst3 = Random[] & /@ Range[10];

Plot them

p1 = MultipleListPlot[lst1, lst2, PlotStyle -> {Red, Blue},
PlotRange -> {0, 1}];
p2 = MultipleListPlot[lst2, lst3, PlotStyle -> {Blue, Green},
PlotRange -> {0, 1}];

Display the second plot in the top right of the first.

p3 = Show[p1, Epilog -> {Rectangle[{6, .6}, {10.5, 1}, p2]}];

Regards,

Dave.

Jose Luis Gomez

unread,
Aug 25, 2006, 6:04:39 AM8/25/06
to
You can do it with Rectangle[].
Example:

p1 = Plot[Sin[x], {x, 0, 2Pi}];
p2 = Plot[Cos[x], {x, 0, 2Pi}];
p12 = Show[p1, Graphics[{Rectangle[{3.5, 0.4}, {5.5, 1.2}, p2]}]]

Bye!
Jose

-----Mensaje original-----
De: mar...@gmail.com [mailto:mar...@gmail.com]
Enviado el: Miércoles, 23 de Agosto de 2006 06:16 a.m.
Para: math...@smc.vnet.net
Asunto: Graph inside another graph

Hello,

David Park

unread,
Aug 25, 2006, 6:05:40 AM8/25/06
to
Use the Prolog or Epilog option in one of the MultipleListPlots. In the
Epilog put a Rectangle with a 3rd argument, which will be the smaller list
plot.

David Park
dj...@earthlink.net
http://home.earthlink.net/~djmp/

bghi...@ucdavis.edu

unread,
Aug 26, 2006, 2:08:47 AM8/26/06
to
Will this work for you:


plt1 = Plot[Sin[2x], {x, 0, 2p},
PlotStyle -> Blue, Frame -> True, ImageSize -> 150]

Plot[BesselJ[0, x], {x, 0, 4p}, PlotStyle ->
Red, Epilog -> Rectangle[{6, 0.4}, {12, 1.0}, plt1], Frame -> True]

Cheers,

Brian

namrata...@gmail.com

unread,
Aug 29, 2006, 4:03:52 AM8/29/06
to
Thank you all! The results are very good.
0 new messages