# 3d BarPlot with Makie.jl

I would like to visualise a simple pdf of a bivariate discrete distribution. Is it possible to do a simple 3D bar plot in Makie.jl, similar to this solution:
https://www.wolfram.com/mathematica/new-in-8/new-and-improved-scientific-and-information-visualization/visualize-bivariate-discrete-distribution-function.html

Just made this example in another thread GLMakie: Create 3D animations with GLMakie? - #2 by jules

Also searching a bit there’s this other thread that has some examples:

Thanks a lot! Unfortunately, I am still struggling to understand the API.
My bars are shifted and I do not know how to solve it.

``````# Table below shows discrete distribution
# X values in rows, Y values in columns
# For example, P(X = 2, Y = 1) = 0.01
xy_probs = [0.06 0.14 0.03 0.25 0.00;
0.01 0.02 0.05 0.06 0.09;
0.06 0.15 0.00 0.04 0.02]

xy_vals = [(x, y) for x in 1:3 for y in 1:5]
z = [xy_probs[x, y] for (x, y) in xy_vals]

meshscatter(xy_vals,
markersize = [Vec3f(1, 1, z) for z in z],
marker = Rect3f((0.1, 0.1, 0), (0.1, 0.1, 1)),
axis = (; type = Axis3))
``````

I also do not fully understand `markersize` and the input to `Rect3f(...)`. I have not found any helpful documentation for the latter. Any help would be greatly appreciated!

`Rect3f((0, 0, 0), (1, 1, 1))` is a cube with widths 1, 1, 1 and the origin corner at 0, 0, 0. In my example I chose `(-0.5, -0.5, 0), (1, 1, 1)` so that the base marker sits centered on the xy plane on the point where it’s placed. When you then give it a Vec3f markersize where you only scale z, like `Vec3f(1, 1, 10)`, then you get a bar that goes from z = 0 to z = 10.