Re: combining graphics
- To: mathgroup@smc.vnet.net
- Subject: [mg11338] Re: combining graphics
- From: Allan Hayes <hay@haystack.demon.co.uk>
- Date: Fri, 6 Mar 1998 00:40:58 -0500
- References: <6dg63k$2od@smc.vnet.net>
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