From: dartar on
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

From: Peter Pein on
Hi Dario,

try
mbar = BarChart[MapAt[Style[#, Red] &, populations, 19], Axes -> None,
ChartStyle -> White, BarSpacing -> Large]

this changes the 19th element in a copy of populations to
"Style[populations[[19]],Red]".

Peter

Am Sun, 30 May 2010 10:46:27 +0000 (UTC)
schrieb dartar <dario.taraborelli(a)gmail.com>:

> 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
>



From: David Park on
populations = RandomReal[{15, 25}, 30];

mbar[m_] :=
BarChart[populations, Axes -> None,
ChartStyle -> Table[If[i == m, Black, White], {i, 30}],
BarSpacing -> Large]

mbar[19]


David Park
djmpark(a)comcast.net
http://home.comcast.net/~djmpark/


From: dartar [mailto:dario.taraborelli(a)gmail.com]

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



From: Bob Hanlon on

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(a)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