Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Barplot enhancement #541

Closed
piever opened this issue Sep 3, 2018 · 0 comments
Closed

Barplot enhancement #541

piever opened this issue Sep 3, 2018 · 0 comments
Labels
Makie Backend independent issues (Makie core)

Comments

@piever
Copy link
Contributor

piever commented Sep 3, 2018

From here, it seems that barplot also accepts x 1 element longer than y, in which case, it's used as "edges" rather than "centers", but it currently errors in two different places:

julia> barplot([1, 5, 6, 10], [1,2,3])
ERROR: DimensionMismatch("arrays could not be broadcast to a common size")
Stacktrace:
 [1] _bcs1 at ./broadcast.jl:439 [inlined]
 [2] _bcs at ./broadcast.jl:433 [inlined]
 [3] broadcast_shape at ./broadcast.jl:427 [inlined]
 [4] combine_axes at ./broadcast.jl:422 [inlined]
 [5] instantiate at ./broadcast.jl:266 [inlined]
 [6] materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(+),Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(last),Tuple{Array{Vec{2,Float32},1}}},Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(last),Tuple{Array{Point{2,Float32},1}}}}}) at ./broadcast.jl:724
 [7] data_limits(::BarPlot{...}) at /home/pietro/.julia/dev/AbstractPlotting/src/basic_recipes/basic_recipes.jl:457
 [8] macro expansion at /home/pietro/.julia/dev/AbstractPlotting/src/basic_recipes/basic_recipes.jl:356 [inlined]
 [9] macro expansion at /home/pietro/.julia/dev/AbstractPlotting/src/utilities/logging.jl:79 [inlined]
 [10] macro expansion at /home/pietro/.julia/dev/AbstractPlotting/src/utilities/logging.jl:15 [inlined]
 [11] (::getfield(AbstractPlotting, Symbol("##500#504")){Scene,BarPlot{...}})(::AbstractPlotting.Automatic, ::Vec{3,Float32}) at /home/pietro/.julia/dev/AbstractPlotting/src/basic_recipes/basic_recipes.jl:346
 [12] map_once(::Function, ::Reactive.Signal{Any}, ::Reactive.Signal{Any}) at /home/pietro/.julia/dev/AbstractPlotting/src/interaction/nodes.jl:80
 [13] plot!(::Scene, ::BarPlot{...}, ::Attributes) at /home/pietro/.julia/dev/AbstractPlotting/src/basic_recipes/basic_recipes.jl:344
 [14] plot!(::Scene, ::Type{BarPlot{...}}, ::Attributes, ::Array{Int64,1}, ::Vararg{Array{Int64,1},N} where N) at /home/pietro/.julia/dev/AbstractPlotting/src/interfaces.jl:392
 [15] #plot!#155 at /home/pietro/.julia/dev/AbstractPlotting/src/interfaces.jl:369 [inlined]
 [16] plot! at /home/pietro/.julia/dev/AbstractPlotting/src/interfaces.jl:369 [inlined]
 [17] #plot#149 at /home/pietro/.julia/dev/AbstractPlotting/src/interfaces.jl:356 [inlined]
 [18] plot at /home/pietro/.julia/dev/AbstractPlotting/src/interfaces.jl:356 [inlined]
 [19] #barplot#310 at /home/pietro/.julia/dev/AbstractPlotting/src/recipes.jl:77 [inlined]
 [20] barplot(::Array{Int64,1}, ::Array{Int64,1}) at /home/pietro/.julia/dev/AbstractPlotting/src/recipes.jl:77
 [21] top-level scope at none:0

julia> barplot([1, 5, 6, 10], [1,2,3], raw = true)
Error showing value of type Scene:
ERROR: buffer scale has not the same length as the other buffers.
              Has: 3. Should have: 4

I also believe that if the user passes edges, widths should correspond to the edges, meaning hw = diff(edges) rather than hw = mean(diff(centers)) as it is now.

@jkrumbiegel jkrumbiegel transferred this issue from JuliaPlots/AbstractPlotting.jl Apr 27, 2020
@jkrumbiegel jkrumbiegel added the Makie Backend independent issues (Makie core) label Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Makie Backend independent issues (Makie core)
Projects
None yet
Development

No branches or pull requests

3 participants