MathGroup Archive 1998

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

Search the Archive

Re: combining graphics



Mark Hahn wrote:
> 
> how can I combine a barchart and a plot?  I doesn't work with
> Show[p1,p2]
> or with DisplayTogether[p1,p2].  Nothing is special about the plots.
> 
> I want to show a data bin count (bar chart) and weibull distribution
> over it.

Mark the following works for me

In[69]:=
<<Graphics`Graphics`

In[73]:=
bc =BarChart[{1,2,3,2}]

There is a difficulty because of the range

In[71]:=
FullOptions[%, PlotRange]

Out[71]=
{{0.4,4.6},{-0.075,3.075}}

So in first coordinate ranges from 0.4 to 4.6 (visually we see that the
bars are cented on 1,2,3,4.

To allow for this we can evaluate Plot over 0.4 to 4.6 (other
refinements related to this problem are possible)

In[74]:=
ps =Plot[Sin[x],{x,.4,4.6}]

Then the following works

In[75]:=
Show[bc,ps]

(ps must come after bc so that it is drawn in front)

-- 
Allan Hayes
Mathematica Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642




  • Prev by Date: Help: lost my expression formatting!
  • Next by Date: 3-D Wave equation
  • Prev by thread: Re: combining graphics
  • Next by thread: Good Programming Style