# LaTeX Horizontal Bar Chart, Gradient Color for Bars

I want to create a chart for ranking like this:

The top row shows the ranking (Poor - Excellent), and the left column shows the parameters. Now I want the bars to look like the figure, coloring with gradients based on the ranking value which is [0-100], 0 being Poor, 50 being Average, and 100 being Excellent. Poor ranking has red color, average ranking has yellow color, and top ranking has dark green color. The colors blend in the middle like a gradient smooth transition.

Is this doable? If yes, can anyone provide guidance? Any help will be highly appreciated.

Here's a proof of concept typesetting the data as a "normal" table together with some tikz code for the slider.

As suggested by the OP, using Red and DarkGreen (with svgnames in xcolor), the result is:

This looks pretty ordinary and, in particular, there no sign of a yellow colour in the middle of the slider. I suspect that we will never see yellow in the middle of the slider if we use a gradient. I thought that the "standard colours" to use here would be from blue (cool) to red (hot). Using Blue and Red gives:

Here's another alternative with Yellow and ForestGreen:

Finally, here is the code:

\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{tabularx}
\usepackage{tikz}

\newcommand\Mark[2][8.4]{%
\rlap{\tikz[baseline=(current bounding box.south)]{
(0,0) rectangle ++(#1*#2/100,0.3);}%
}%
}

\begin{document}

\noindent
\begin{tabularx}{0.9\linewidth}{rXXXXX}
&\textsf{Poor}&\textsf{Low}&\textsf{Average}&\textsf{High}
&\textsf{Excellent}\\[2mm]
\textsf{Quality}       & \Mark{100}\\[-4mm]
\textsf{Innovation}    & \Mark{70}\\[-4mm]
\textsf{Ease} of use   & \Mark{10}\\[-4mm]
\textsf{Accessibility} & \Mark{90}\\[-4mm]
\textsf{Support}       & \Mark{84}
\end{tabularx}

\end{document}


• The X columns inside a tabularx environment do not play well with \multicolumn so I have used \rlap{...} to place the slider. In turn this does not play well with the row spacing so I have hacked this by adding manual adjustments of \\[-4mm] to the end of each row
• The \Mark command is used to create the colour sliders. The syntax for this command is \Mark[optional length]{mark from 0-100}. By default the length of the slider is set to 8.4 units, which I got to by trial and error to make the slider length match the table width. The choice of colours are set inside the definition of the \Mark macro and so are easily customisable to suit your tastes:)