Gnuplot: plotting histograms on Y-axis

gnuplot, matplotlib, plot

Solution

The gnuplot `histogram` and `boxes` plotting styles are for vertical boxes. To get horizontal boxes, you can use `boxxyerrorbars`.

For the strings as y-labels, I use `yticlabels` and place the boxes at the y-values 0, 1 and 2 (according to the row in the data file, which is accessed with `$0`).

I let gnuplot treat the second column as numerical value, which strips the `%` off. It is added later in the formatting of the xtics:

set datafile separator ','
set format x '%g%%'
set style fill solid
plot 'data.txt' using ($2*0.5):0:($2*0.5):(0.4):yticlabels(1) with boxxyerrorbars t ''

The result with version 4.6.4 is:

Problem

I'm trying to plot a histogram for the following data: ``` <text>,<percentage> -------------------- "Statement A",50% "Statement B",20% "Statement C",30% ``` I used the `set datafile separator ","` to obtain the corresponding columns. The plot should have percentage on the X-axis and the statements on the Y-axis (full character string). So each histogram is horizontal. How can I do this in gnuplot? Or is there other tools for plotting good vector images?

Original source