Re: Styling single bar in BarChart

*To*: mathgroup at smc.vnet.net*Subject*: [mg110057] Re: Styling single bar in BarChart*From*: Bob Hanlon <hanlonr at cox.net>*Date*: Sun, 30 May 2010 23:47:30 -0400 (EDT)

populations = Table[RandomInteger[{100, 200}], {20}]; Highlight position 19 mbar = BarChart[populations, Axes -> None, ChartStyle -> ReplacePart[ Table[LightGray, {Length[populations]}], 19 -> Red], BarSpacing -> Large] Highlight Max mbar = BarChart[populations, Axes -> None, ChartStyle -> ReplacePart[ Table[LightGray, {Length[populations]}], Thread[ Position[populations, Max[populations]] -> Red]], BarSpacing -> Large] Highlight Max and Min mbar = BarChart[populations, Axes -> None, ChartStyle -> ReplacePart[ Table[LightGray, {Length[populations]}], Join[ Thread[ Position[populations, Max[populations]] -> Red], Thread[ Position[populations, Min[populations]] -> Blue]]], BarSpacing -> Large] Bob Hanlon ---- dartar <dario.taraborelli at gmail.com> wrote: ============= I must be missing something trivial but I don't seem to be able to find a way to highlight a single value from a list in a BarChart. mbar = BarChart[{populations, populations[[19]]}, Axes -> None, ChartStyle -> {White, Black}, BarSpacing -> Large]; The above generates a bar chart of the population series with alternate black/white colour. mbar = BarChart[{populations, Style[populations[[19]], Red]}, Axes -> None, ChartStyle -> White, BarSpacing -> Large] This produces only white bars. Feedback welcome. Dario