Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: BoxWhiskerChart and a Vertical Line on same graph

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124444] Re: BoxWhiskerChart and a Vertical Line on same graph
  • From: Tomas Garza <tgarza10 at msn.com>
  • Date: Fri, 20 Jan 2012 01:47:33 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201201191011.FAA03691@smc.vnet.net>

Much to my surprise (I'm not very familiar with BoxWhiskerCharts) the ChartLegend option seems to be the cause of the problem. In addition. if you want the vertical line to be between the first and second pair of boxes, I can't see why you set xv = 10; it should be somewhere between 2.8 and 3. Try the following:
data = Table[   RandomVariate[NormalDistribution[RandomInteger[5], 1],     100], {2}, {2}];
grBox2 = BoxWhiskerChart[data,(*ChartLegends->{"a","b"},*)   AxesLabel -> {"Quintile", "Price"}, Frame -> False, Axes -> True,    AxesOrigin -> {0, 0}];
xv = 2.9;graphicLine = Graphics[Line[{{xv, 0}, {xv, 8}}]];Show[grBox2, graphicLine]
You must find out why the ChartLegend is causing havoc (check with Wolfram support - it might be , I hate to say, a bug).
-Tomas

> Date: Thu, 19 Jan 2012 05:11:41 -0500
> From: donabc at comcast.net
> Subject: BoxWhiskerChart and a Vertical Line on same graph
> To: mathgroup at smc.vnet.net
>
> Here is a BoxWhisker graph, which is only a slight variation on one of the
> examples for BoxWhisker graphs in the documentation.
>
> data=Table[RandomVariate[NormalDistribution[RandomInteger[5],1],100],{2},{2}];
>
> grBox1 = BoxWhiskerChart[data, ChartLegends->{"a","b"},AxesLabel->{"Quintile", "Price"},
>  Frame->False,  Axes->True, AxesOrigin->{0,0}
> ]
>
> I would like to superimpose a vertical line on the graph between
> the first and second PAIR of boxes (i.e. between the
> first two and the second two).
>
> My attempt to do this is the following:
>
> xv = 10;
> graphicLine = Graphics[Line[{{xv,0},{xv,8}}]] ;
> Show[grBox1,graphicLine]
>
> but this  produces no graph and an error message
> in the pink window which says:
>
> "Labeled is not a Graphics primitive or directive"
>
> But, I am not using anything in the code above which
> is called "Labeled".
>
> Is there a way to superimpose this line on the BoxWhisker Chart?
>
> Thank you in advance.
>
> Don
>


  • Prev by Date: Re: Tips for writing correct, non trivial Mathematica Libraries
  • Next by Date: Re: MatrixForm odd behaviour
  • Previous by thread: BoxWhiskerChart and a Vertical Line on same graph
  • Next by thread: KenKen Helper as a Mathematica CDF