Re: Label Bar Chart from data
- To: mathgroup at smc.vnet.net
- Subject: [mg99784] Re: [mg99757] Label Bar Chart from data
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Thu, 14 May 2009 01:42:26 -0400 (EDT)
- Reply-to: hanlonr at cox.net
mydata = {{44970, 2357.7}, {54324, 1859.34}, {49500, 1797.44}, {54161, 1432.26}, {49505, 1421.2}, {49605, 1292}, {54640, 1260}, {39503, 760}, {49525, 711.31}, {43324, 617.1}}; BarChart[#[[2]] & /@ mydata, ChartLabels -> (#[[1]] & /@ mydata)] BarChart[Last /@ mydata, ChartLabels -> First /@ mydata] BarChart[Last /@ #, ChartLabels -> First /@ #] &[mydata] BarChart[mydata[[All, 2]], ChartLabels -> mydata[[All, 1]]] BarChart[#[[All, 2]], ChartLabels -> #[[All, 1]]] &[mydata] % === %% === %%% === %%%% === %%%%% True However, to find anything on this chart by label (particularly if "actual data is much larger"), then sorting might be useful. sortedData = Sort[mydata]; BarChart[Last /@ #, ChartLabels -> First /@ #] &[sortedData] Bob Hanlon ---- "Charles L. Snyder" <clsnyder at gmail.com> wrote: ============= Given mydata={{44970, 2357.7}, {54324, 1859.34}, {49500, 1797.44}, {54161, 1432.26}, {49505, 1421.2}, {49605, 1292}, {54640, 1260}, {39503, 760}, {49525, 711.31}, {43324, 617.1}} This should be simple, but I can't seem to find the answer. I want a BarChart of the second values {2357.7, 1859.34,....}, labeled with the corresponding first value. This comes close, but all "bars' are labeled with 44970, not sequentially. ; BarChart[{#[[2]]} & /@ mydata, ChartLabels -> {#1} & /@ mydata] The actual data is much larger, precluding simply entering the ten values given above. Can someone point me in the right direction? Thanks in advance -- Bob Hanlon