MathGroup Archive 2007

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

Search the Archive

Re: Adding coloured Polygon to a BarChart

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84033] Re: Adding coloured Polygon to a BarChart
  • From: tomfabtastic at hotmail.com
  • Date: Fri, 7 Dec 2007 03:06:27 -0500 (EST)
  • References: <fj65e2$fnd$1@smc.vnet.net> <fj8a95$ahr$1@smc.vnet.net>

On Dec 6, 7:01 pm, "David Park" <djmp... at comcast.net> wrote:
> Your only problem was that you put an extra level of Graphics in the Epilog
> list. The following works:
>
> BarChart[{1, 2, 3},
>  Epilog -> {Style[Text["First", {1, 2}, {0, -1}], 12, Red,
>     Bold], {Red,
>     Polygon[{{1.25, 2}, {1.5, 2}, {1.5, 2.25}, {1.25, 2.25}}]}}]
>
> But Epilog is a little inconvenient. If you want to add many things Epilog
> becomes the tail that wags the dog. And suppose you wanted to add a curve to
> the plot? With the Presentations package all elements are combined in one
> drawing statement. Here is a bar chart with a curve and your extra label and
> polygon.
>
> Needs["Presentations`Master`"]
>
> Draw2D[
>  {BarChart[{1, 4, 9}] // DrawGraphics,
>   Style[Text["First", {1, 2}, {0, -1}], 12, Red, Bold],
>   Red,
>   Polygon[{{1.25, 2}, {1.5, 2}, {1.5, 2.25}, {1.25, 2.25}}],
>   Draw[x^2, {x, 0, 3.2}]},
>  AspectRatio -> 1,
>  Axes -> True, AxesOrigin -> {0, 0},
>  Ticks -> {CustomTicks[Identity, {1, 3, 1, 1}], Automatic}]
>
> --
> David Park
> djmp... at comcast.nethttp://home.comcast.net/~djmpark/
>
> <tomfabtas... at hotmail.com> wrote in message
>
> news:fj65e2$fnd$1 at smc.vnet.net...
>
>
>
> > Hi,
>
> > The below chart successfully uses Epilog to include some text on the
> > BarChart:
>
> > Needs["BarCharts`"]
> > barShape1 =
> > BarChart[{1, 2, 3},
> >  Epilog -> {Style[Text["First", {1, 2}, {0, -1}], 12, Red, Bold]}]
>
> > However, I want to add a small Polygon to the graph. Again this works
> > well as long as the Polygon is black:
>
> > barShape2 =
> > BarChart[{1, 2, 3},
> >  Epilog -> {Style[Text["First", {1, 2}, {0, -1}], 12, Red, Bold],
> >    Polygon[{{1.25, 2}, {1.5, 2}, {1.5, 2.25}, {1.25, 2.25}}]}]
>
> > But I would like to make the Polygon a red colour. But the below does
> > not work :
>
> > barShape3 =
> > BarChart[{1, 2, 3},
> >  Epilog -> {Style[Text["First", {1, 2}, {0, -1}], 12, Red, Bold],
> >    Graphics[{Red,
> >      Polygon[{{1.25, 2}, {1.5, 2}, {1.5, 2.25}, {1.25, 2.25}}]}]}]
>
> > Does anyone have a suggestion for adding a coloured Polygon to a
> > BarChart ?
>
> > Regards,
> > Tom- Hide quoted text -
>
> - Show quoted text -

Fantastic - thanks.


  • Prev by Date: Re: Re: FindInstance what inspite ?
  • Next by Date: Re: Finding position of an element in a list:
  • Previous by thread: Re: Adding coloured Polygon to a BarChart
  • Next by thread: Printing Subscripted Variable on Screen?