MathGroup Archive 2005

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

Search the Archive

Re: AW: AW: Same scaling for plots/ charts

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62339] Re: AW: AW: [mg62278] Same scaling for plots/ charts
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Mon, 21 Nov 2005 03:54:22 -0500 (EST)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

Try something along this line

Needs["Statistics`"];
Needs["Graphics`"];

Module[{m1=315,s1=20,m2=645,s2=65,pr},
    pr=Max[
        PDF[NormalDistribution[m1, s1],m1],
        PDF[NormalDistribution[m2, s2],m2]];
    Show[Graphics[{
          Rectangle[{0, 0}, {s1/(s1+s2), 1},
            Plot[PDF[NormalDistribution[m1, s1],x],
              {x,m1-3s1,m1+3s1},
              AxesOrigin->{m1,0},
              PlotRange->{-0.04,1}pr,
              AspectRatio->(s1+s2)/s1/GoldenRatio,
              DisplayFunction->Identity]],
          Rectangle[{s1/(s1+s2), 0}, {1, 1},
            Plot[PDF[NormalDistribution[m2, s2],x],
              {x,m2-3s2,m2+3s2},
              AxesOrigin->{m2,0},
              PlotRange->{-0.04,1}pr,
              AspectRatio->(s1+s2)/s2/GoldenRatio,
              DisplayFunction->Identity]]}],
      ImageSize->600,
      DisplayFunction->$DisplayFunction]];


Bob Hanlon

> 
> From: "Kristoph " <kristophs.post at web.de>
To: mathgroup at smc.vnet.net
> Date: 2005/11/19 Sat PM 06:44:28 EST
> Subject: [mg62339] AW: AW: [mg62278] Same scaling for plots/ charts
> 
> I am sorry. You will find enclosed what I mean. The space between the
> labels is more spread in the first than in the second diagram. To be of
> same scale the second diagram should be more spread on the horizontal
> axes. Each ten-steps should be of equal distance in both diagrams.
> 
> Thanks for help ones again. Kristoph 
> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: hanlonr at cox.net [mailto:hanlonr at cox.net] 
> Gesendet: Samstag, 19. November 2005 20:41
> An: Kristoph ; mathgroup at smc.vnet.net
> Betreff: Re: AW: [mg62278] Same scaling for plots/ charts
> 
> I don't understand what you want done. You appear to have provided an 
> example of what you don't want, but not of what you do want. Perhaps
> this is 
> will be of use.
> 
> Needs["Statistics`"];
> Needs["Graphics`"];
> 
> data1=RandomArray[NormalDistribution[310, 13],{500}];
> m1=Mean[data1]; 
> s1=StandardDeviationMLE[data1];
> data2=RandomArray[NormalDistribution[646, 33],{1000}];
> m2=Mean[data2]; s2=StandardDeviationMLE[data2];
> 
> n=31;
> BarChart[
>     BinCounts[(#-m1)/s1&/@data1,{-3,3,6/n}]/
>                     Length[data1],
>     BinCounts[(#-m2)/s2&/@data2,{-3,3,6/n}]/
>                     Length[data2],
>         Frame->True,
>     FrameTicks->{
>         Join[
>           Table[{(n-1)((m1+k*s1)-(m1-3s1))/(6s1)+1,""},
>             {k,-3,3,1/4}],
>           Table[{(n-1)((m1+k*s1)-(m1-3s1))/(6s1)+1,
>               ToString[m1+k*s1]<>"\n"<>
>                 StringReplace[ToString["m1"+k*"s1"]," "->""],
>               {0.015,0},{Red}},{k,-3,3}]],
>         Automatic,
>         Join[
>           Table[{(n-1)((m2+k*s2)-(m2-3s2))/(6s2)+1,""},
>             {k,-3,3,1/4}],
>           Table[{(n-1)((m2+k*s2)-(m2-3s2))/(6s2)+1,
>               StringReplace[ToString["m2"+k*"s2"]," "->""]<>
>                 "\n"<>ToString[m2+k*s2],
>               {0.015,0},{Blue}},{k,-3,3}]],
>         Automatic},
>     ImageSize->600];
> 
> 
> Bob Hanlon
> 
> 
> > 
> > From: "Kristoph " <kristophs.post at web.de>
To: mathgroup at smc.vnet.net
> > Date: 2005/11/19 Sat AM 11:32:53 EST
> > Subject: [mg62339] AW: [mg62278] Same scaling for plots/ charts
> > 
> > Hi Bob,
> > 
> > Thanks for the nice notebook, unfortunately it does not solve my
> > problem. Histograms will not do the job because some of the data are
> > very close together so I can use more than one bar chart which
> overlaps
> > in a nice way. This way the comparison is more efficient and I save
> room
> > for other diagrams and stuff. But some data, as in this case, are
> spread
> > so widely that overlapping is not possible. 
> > 
> > I still have the same problem that the two bar charts have different
> > scaling on the horizontal axes. For example in the case with clustered
> > data the space in between each tick or bar is .1 cm and in the more
> > spread data the space is .001 cm. Mathematica seems to fit the chart
> to
> > its usual display size. I have enclosed a copy of the present diagram
> so
> > you get the picture. Sorry for the bad quality.
> > 
> > There must be a way to so this, but I can't figure out how.
> > 
> > Thanks for help. Kristoph
> > 
> > 
> >  
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: hanlonr at cox.net [mailto:hanlonr at cox.net] 
> > Gesendet: Samstag, 19. November 2005 15:32
> > An: kristoph; mathgroup at smc.vnet.net
> > Betreff: Re: [mg62278] Same scaling for plots/ charts
> > 
> > Needs["Statistics`"];
> > Needs["Graphics`"];
> > 
> > data1=RandomArray[NormalDistribution[1, 2],{200}];
> > data2=RandomArray[NormalDistribution[3, 4],{200}];
> > xmin=Floor[Min[data1,data2]];
> > xmax=Ceiling[Max[data1,data2]];
> > 
> > BarChart[
> >     Sequence@@(
> >         BinCounts[#,{xmin,xmax,(xmax-xmin)/20}]/
> >               Length[#]&/@{data1,data2}),
> >     ImageSize->400];
> > 
> > DisplayTogetherArray[
> >     {DisplayTogether[
> >             Histogram[#[[1]],
> >               HistogramScale->1,
> >               HistogramRange->{xmin,xmax},
> >               BarStyle->#[[2]]],
> >             Plot[
> >               PDF[
> >                 NormalDistribution[
> >                   Mean[#[[1]]],
> >                   StandardDeviationMLE[#[[1]]]],
> >                 x],
> >               {x,xmin,xmax},
> >               PlotStyle->{
> >                   AbsoluteDashing[{10,10}]}]]}&/@
> >       {{data1,Red},{data2,Blue}},
> >     ImageSize->400];
> > 
> > 
> > Bob Hanlon
> > 
> > > 
> > > From: "kristoph" <kristophs.post at web.de>
To: mathgroup at smc.vnet.net
> > > Date: 2005/11/19 Sat AM 05:53:59 EST
> > > Subject: [mg62339] [mg62278] Same scaling for plots/ charts
> > > 
> > > Please let me know if anybody knows a way how I can show bar charts
> > for
> > > different data with the same scale. When the data is more spread
> > > Mathematica scales the space between each chart down. This mean a
> > > comparision between two charts is not possible right away.
> > > 
> > > I need a way to compare two charts, therefore the scaling should be
> > the
> > > same for each chart.
> > > 
> > > Thank you very much for answer.
> > > 
> > > 
> > 
> > 
> > 
> 
> 
> 


  • Prev by Date: Re: Strange Min/Max result
  • Next by Date: Re: statistics questions
  • Previous by thread: Re: How to View Mathematica and Hardcopy Books
  • Next by thread: Modeling Saturation - Sensor or Acutuator