Color coded bar to represent numeric values

I would like to present data color coded in a bar.

My data look like the following:

{-2.5,-1.0,0.1,0.5,-0.24,-0.58,-0.58,-0.25,-1.4,2.1,1.8,-2.5,1.97}

I would like to create a horizontal bar and each part of the bar should be colored according to the number value of each data point. The color scheme should be getting the bluer the smaller the value below zero and increasingly red for values larger than zero. (The color scheme is not important, I just want to make the different values visible). All parts of the bar should be of the same length. I have no idea where to start and don't know if a stacked bar chart is the way to go or if I should better represent each value with a rectangle graphics object that I combine in the end. The image below is just to show you the kind of bar I would like to create (very roughly). • Your sample output suggests that you may wish to sort the data before plotting it. Is that the case? – bbgodfrey Jan 5 '16 at 19:20

data = {-2.5, -1.0, 0.1, 0.5, -0.24, -0.58, -0.58, -0.25, -1.4, 2.1, 1.8, -2.5, 1.97};

Graphics[Raster[{Rescale@data},
ColorFunction -> (Blend[{{0, Blue}, {1, Red}}, #] &)],
AspectRatio -> .3] tab = Table[{m, m}, {m, -2.5, 2.5, 0.1}]

ListDensityPlot[Transpose[tab],
ColorFunction -> (ColorData[{"TemperatureMap", {-2.5, 2.5}}][#] &),
ColorFunctionScaling -> False, PlotRangePadding -> 0,
PlotRange -> All, AspectRatio -> 1/8, Frame -> False]
• You can exchange the colorscheme. Just figure out Mathematica help and search for ColorSchemes. If you want to keep the rectangular shapes, try it this way: Graphics[Table[{Blend[{Red, Green}, i], EdgeForm[Gray], Rectangle[{4 i, 0}]}, {i, 0 - 1/4, 1 + 1/4, 1/4}]] – Kay Jan 5 '16 at 18:28
• You can update your answer, instead of adding useful information in a comment. Also it would be better if you posted an image as well so that we can more easily judge the quality of the answer, which will make us (probably) more likely to vote for it. – C. E. Jan 5 '16 at 18:47

Here's one way to do it with rectangles:

data = {-2.5, -1.0, 0.1, 0.5, -0.24, -0.58, -0.58, -0.25, -1.4, 2.1, 1.8, -2.5, 1.97};

colors = ColorData["AvocadoColors"] /@ Rescale[data];
rectangles = Table[Rectangle[{x, 0}, {x + 1, GoldenRatio}], {x, 0, Length@colors, 1}];

Graphics@Riffle[colors, rectangles] list = {-2.5, -1.0, 0.1, 0.5, -0.24, -0.58, -0.58, -0.25, -1.4, 2.1, 1.8, -2.5, 1.97};
ArrayPlot[{list}, ColorFunction -> "TemperatureMap"] 