MathGroup Archive 2011

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

Search the Archive

Re: Problem with Coding for Box Whisker Chart

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123352] Re: Problem with Coding for Box Whisker Chart
  • From: Scott Colwell <srcolwell at gmail.com>
  • Date: Fri, 2 Dec 2011 07:23:12 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201112011050.FAA13756@smc.vnet.net>

That is perfect.  Thank you. I am hoping to post this as a
demonstration, would you like to come on as a co-author of it given
that you fixed my coding?

Scott

On 1 December 2011 10:08, Heike Gramberg <heike.gramberg at gmail.com> wrote:
> You could do something like
>
> DynamicModule[{loc1, loc2, n1, n2},
>  loc1 = RandomInteger[{1, 90}, 30];
>  loc2 = RandomInteger[{1, 90}, 30];
>  n1 = Length[loc1];
>  n2 = Length[loc2];
>  LocatorPane[
>  Dynamic[Join[Table[{0.5, i}, {i, loc1}],
>    Table[{2.5, i}, {i, loc2}]],
>     ({loc1, loc2} = {#[[;; n1, 2]], #[[n1 + 1 ;;, 2]]}) &],
>  Dynamic@
>   BoxWhiskerChart[{Min[#], Quartiles[#][[1]], Median[#],
>       Quartiles[#][[3]], Max[#]} & /@ {loc1, loc2},
>    {"Median", {"MedianMarker",
>      Directive[Thick, Black, CapForm -> None]}},
>    BaseStyle -> {Medium, FontFamily -> "Arial"},
>    PlotRange -> {{0, 3}, {0, 100(*fixes max*)}},
>    PlotRangePadding -> 0,
>    ImageSize -> Large,
>    FrameLabel -> {None, "Number of Text Messages"},
>    PlotLabel -> Style["Interactive Boxplot", Bold, 20],
>    ChartLabels -> {"Group A", "Group B"},
>    Frame -> {True, True, False, False},
>    ChartStyle -> Blue],
>  {{0, 0}, {3, 90}}]]
>
> As for the 75% percentile, that's probably because your data points are i=
ntegers. You could try something like
> loc=N@data if you want the statistics to be numbers rather than rationa=
ls.
>
> Heike.
>
> On 1 Dec 2011, at 11:50, Scott Colwell wrote:
>
>> Hello.  I wonder if you could help me with the following issues I am
>> having with the BoxWhiskerChart syntax.  I can not seem to get the
>> hang of this coding.  What I am trying to do is this:
>>
>> (1) I would like to have 2 boxplots (Group A and Group B) that are
>> each controlled by their own locators which are positioned next to
>> them.  I can get 1 plot to work, but can't get a second one within the
>> same.
>>
>> (2) I can't seem to change the median style function to have the
>> median represented as a thick black line.
>>
>> (3) For some reason, the 75th percentile comes up as a fraction rather
>> than a number.
>>
>> Here is the code that I have thus far.
>>
>> Manipulate[
>> BoxWhiskerChart[
>>  {Min[#], Quartiles[#][[1]], Median[#], Quartiles[#][[3]], Max[#]} &@
>>   loc[[All, 2]],
>>  BaseStyle -> {Medium, FontFamily -> "Arial"},
>>  PlotRange -> {{0, 2}, {0, 100(*fixes max*)}},
>>  PlotRangePadding -> .5,(*0 fixes locators to y axis*)
>>  ImageSize -> Large,
>>  FrameLabel -> {"Group A", "Number of Text Messages"},
>>  PlotLabel -> Style["Interactive Boxplot", Bold, 20],
>>  Frame -> {True, True, False, False},
>>  ChartStyle -> Blue],
>> {
>>  {loc, {
>>    {0, 13}, {0, 21}, {0, 22}, {0, 31}, {0, 35}, {0, 39}, {0, 42}, {0=
,
>>      43}, {0, 46},
>>    {0, 46}, {0, 47}, {0, 48}, {0, 50}, {0, 51}, {0, 58}, {0, 60}, {0=
,
>>      67}, {0, 70}, {0, 79}}},
>>  {0, 2}, {0, 90(*fixes max*)}, Locator}
>> ]
>>
>> Thank you in advance
>>
>



--
Scott R. Colwell, PhD



  • Prev by Date: Re: FindShortestTour Function - Roundtrip & Constructive Heuristic
  • Next by Date: Re: gives different result compared to 1/Diagonal[Normal@A] when A is sparse
  • Previous by thread: Re: Problem with Coding for Box Whisker Chart
  • Next by thread: Re: Laplace equation with gradient boundary conditions