Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: [Q] HELP! with plot within a BarChart[]

  • Subject: [mg3213] Re: [Q] HELP! with plot within a BarChart[]
  • From: ianc (Ian Collier)
  • Date: 18 Feb 1996 03:20:13 -0600
  • Approved: usenet@wri.com
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: Wolfram Research, Inc.
  • Sender: daemon at wri.com

In article <4frv74$k13 at dragonfly.wolfram.com>,
David.A.Johnson at news.acns.nwu.edu wrote:

> A while ago I posted a request for help to place a plot within a region
of a plot.
> 
> First I'd like to thank Dave Wagner for his suggestion of
Epilog->Rectangle[{x1,y1}, {x2, y2}, ListPlot[data]]
> However the problem I am now having is that Epilog is not a valid option
of BarChart.
> 
> What I'm trying to accomplish would be something like
> p1 = ListPlot[data1];;
> p2 = ListPlot[data2];;
> BarChart[ data3,    
>                    BarGroupSpacing -> 0,
>                    Epilog->Rectangle[{ x1, y1},{x2,y2},
GraphicsArray[{{p1,p2}}]]
> 
> if BarChart offered the Epilog functionability.
> 
> I'm running Mma V 2.2 on NeXTStep/FIP if it matters (for version differences).
> 
> Thank's in advance,
> 
> 
> David A. Johnson

You can use the technique for making plots within plots described
in section 2.9.6 of Mathematica A System for Doing Mathematics by
Computer.

All you do is use separate Rectangle primitives to contain both 
the BarChart and the Graphics Array. Here is an example. You may 
need to tweak the coordiantes of the Rectangles to get your
example to work correctly.

In[36]:=
    data1 = Table[ {x, Sin[x]/x}, {x, -10,10, .4}];
In[37]:=
    data2 = Table[ {x, Cos[x]}, {x, -10,10, .4}];
In[38]:=
    data3 = Table[  x^2/100, {x, -10,10}];
In[39]:=
    p1 = ListPlot[data1];

In[40]:=
    p2 = ListPlot[data2];

In[41]:=
    p3 = BarChart[ data3,    
                   BarGroupSpacing -> 0]
Out[41]=
    -Graphics-

In[42]:=
    Show[Graphics[ {Rectangle[{0, 0}, {1, 1}, p3], 
            Rectangle[{0.6, 0.6}, {1.2, 1.4}, 
                GraphicsArray[{{p1,p2}}]]} ]]
Out[42]=
    -Graphics-

I hope this helps.

--Ian

-----------------------------------------------------------
Ian Collier
Wolfram Research, Inc.
-----------------------------------------------------------
tel:(217) 398-0700   fax:(217) 398-0747    ianc at wolfram.com
Wolfram Research Home Page:         http://www.wolfram.com/
-----------------------------------------------------------


  • Prev by Date: Re: [Q] HELP! with plot within a BarChart[]
  • Next by Date: Re: array ordered
  • Previous by thread: Re: [Q] HELP! with plot within a BarChart[]
  • Next by thread: [Q] HELP! with plot within a BarChart[]