Plot horizontal error bars in Gadfly or Plots.jl


#1

I was wondering if it is possible to plot horizontal error bars with category labels on the y axis. I attached an example of what I would like to accomplish.

Thanks,

Chris


#2

This can be done in Gadfly using Geom.errorbar (see here)

julia> using Gadfly

julia> x = sort(rand(10)); xmin = 0.9x; xmax = 1.1x;

julia> ystr = map(i -> string(i) * " as a string", 1:10)
10-element Array{String,1}:
 "1 as a string"
 "2 as a string"
 "3 as a string"
 "4 as a string"
 "5 as a string"
 "6 as a string"
 "7 as a string"
 "8 as a string"
 "9 as a string"
 "10 as a string"

julia> plot(y = ystr, x = x, xmin = xmin, xmax = xmax, Geom.errorbar)

julia> draw(PNG("C:\\Users\\Evan\\Desktop\\heb.png",8inch,6inch),ans)

gives


I expect other plotting packages can do it as well, I just can’t say since I don’t use them.


#3

Thanks @evanfields. This was easier than I thought.