Plots with string xaxis and y-errorbars gives error

Plotting a bar plot with text as the xaxis gives me an error where it didn’t use to. I’m using Julia 1.4 and plots v1.0.5

plot([“a”,“b”],[10,2],yerr=[1,1],st=:bar) gives the error “Cannot convert an object of type String to an object of type Float64” listed at the bottom.
plot([“a”,“b”],[10,2],st=:bar) gives no error and plots as I would expect.
If I change to plots V1.0.4 it still doesn’t work but if I go back to v1.0.0 they both work as normal.

Anyone else experience this?

MethodError: Cannot convert an object of type String to an object of type Float64
Closest candidates are:
convert(::Type{T}, !Matched::T) where T<:Number at number.jl:6
convert(::Type{T}, !Matched::Number) where T<:Number at number.jl:7
convert(::Type{T}, !Matched::Base.TwicePrecision) where T<:Number at twiceprecision.jl:250

Stacktrace:
[1] setindex!(::Array{Float64,1}, ::String, ::Int64) at .\array.jl:782
[2] copyto!(::Array{Float64,1}, ::Int64, ::Array{String,1}, ::Int64, ::Int64) at .\abstractarray.jl:842
[3] nanappend!(::Array{Float64,1}, ::Array{String,1}) at .\array.jl:911
[4] error_coords(::Array{Float64,1}, ::Array{Float64,1}, ::Array{String,1}) at C:\Users\padmer.julia\packages\Plots\GzWxB\src\recipes.jl:1024
[5] macro expansion at C:\Users\padmer.julia\packages\Plots\GzWxB\src\recipes.jl:1054 [inlined]
[6] apply_recipe(::Plots.Attr, ::Type{Val{:yerror}}, ::Array{String,1}, ::Array{Float64,1}, ::Nothing) at C:\Users\padmer.julia\packages\RecipesBase\FlaiX\src\RecipesBase.jl:281
[7] _process_seriesrecipe(::Plots.Plot{Plots.PyPlotBackend}, ::Plots.Attr) at C:\Users\padmer.julia\packages\Plots\GzWxB\src\pipeline.jl:435
[8] _plot!(::Plots.Plot{Plots.PyPlotBackend}, ::Dict{Symbol,Any}, ::Tuple{Array{String,1},Array{Float64,1}}) at C:\Users\padmer.julia\packages\Plots\GzWxB\src\plot.jl:233
[9] #plot#135(::Base.Iterators.Pairs{Symbol,Any,NTuple{4,Symbol},NamedTuple{(:yerr, :st, :ylabel, :xticks),Tuple{Array{Float64,1},Symbol,String,Tuple{Array{Int64,1},Array{String,1}}}}}, ::typeof(plot), ::Array{String,1}, ::Vararg{Any,N} where N) at C:\Users\padmer.julia\packages\Plots\GzWxB\src\plot.jl:57
[10] (::RecipesBase.var"#kw##plot")(::NamedTuple{(:yerr, :st, :ylabel, :xticks),Tuple{Array{Float64,1},Symbol,String,Tuple{Array{Int64,1},Array{String,1}}}}, ::typeof(plot), ::Array{String,1}, ::Array{Float64,1}) at .\none:0
[11] top-level scope at In[11]:1

Can you open an issue on https://github.com/JuliaPlots/Plots.jl/issues?

First github issue, exciting. It can be found here: Plots with string xaxis and y-errorbars gives error · Issue #2552 · JuliaPlots/Plots.jl · GitHub

This has been fixed and it all works nicely in plots v1.2.0: fix errorbars with string axes by daschw · Pull Request #2622 · JuliaPlots/Plots.jl · GitHub

1 Like