RE: combining graphics
- To: mathgroup@smc.vnet.net
- Subject: [mg11307] RE: [mg11223] combining graphics
- From: Ersek_Ted%PAX1A@mr.nawcad.navy.mil
- Date: Wed, 4 Mar 1998 01:40:11 -0500
Mark wrote: ---------- |From: "mahahn"@ccgate.com@PMDF@PAXMB1 To: mathgroup@smc.vnet.net |To: ersek ted; "mathgroup"@smc.vnet.net@PMDF@PAXMB1 |Subject: [mg11307] [mg11223] combining graphics |Date: Tuesday, March 03, 1998 3:37AM | |<<File Attachment: 00000000.TXT>> |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, This is a very common problem. You need to use Evaluate inside DisplayTogether (as below). You need to do this because you have to ensure {p1,p2} is explicitly an expression in terms of (x). Do you know about DisplayFunction? I use this to ensure the first two graphics are not displayed. Since graphics is not displayed in the first two commands, I need to use it again to override the earlier setting. In[1]:= <<Graphics`Graphics` In[2]:= p1=BarChart[{0.6,0.5,0.3,0.45,0.2,0.1}, DisplayFunction->Identity] Out[2]= -Graphics- In[3]:= <<Statistics`ContinuousDistributions` In[4]:= p2=Plot[PDF[WeibullDistribution[1,2],x],{x,-0,7}, DisplayFunction->Identity] Out[4]= -Graphics- In[5]:= DisplayTogether[Evaluate[{p1,p2}], DisplayFunction->$DisplayFunction] Out[5] -Graphics- You get the graphic you want in Out[5]. Ted Ersek