Re: AW: Same scaling for plots/ charts
- To: mathgroup at smc.vnet.net
- Subject: [mg62316] Re: AW: [mg62278] Same scaling for plots/ charts
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sat, 19 Nov 2005 23:18:52 -0500 (EST)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
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: [mg62316] 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: [mg62316] [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. > > > > > > >