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

Use Makie for 3D barplot #3

Closed
Moelf opened this issue Jul 26, 2022 · 4 comments
Closed

Use Makie for 3D barplot #3

Moelf opened this issue Jul 26, 2022 · 4 comments

Comments

@Moelf
Copy link
Member

Moelf commented Jul 26, 2022

here's a dummy example:

using WGLMakie
begin
	N = 100
	δ = 0.02
	cs = repeat(1:5, N÷5)
	heights = rand(N) * 200
	meshscatter(
                                # this is needed because Makie would flatten to 2D if all Zs are the same
		Point3f.(rand(N), rand(N), 0.00001rand(N)); 
	  	color = cs, 
		markersize = Vec3f.(δ, δ, heights),
		colormap = :Spectral_7,
		marker = Rect3f(Vec3f(0), Vec3f(1)),
	 	axis = (type = Axis3, perspectiveness = 0.5, azimuth = 2.4,
            xlabel = "ϕ", ylabel = "η", zlabel = "kt",
		    limits = (nothing, nothing, nothing, nothing, 0, 200)
		),
	    shading=false
	)
end

image

It should also work with GLMakie.jl, but 3D might be a bit broken with CairoMakie...

@Moelf
Copy link
Member Author

Moelf commented Jul 26, 2022

limits = (nothing, nothing, nothing, nothing, 0, 200) this line exists because:

@Moelf
Copy link
Member Author

Moelf commented Jul 26, 2022

ok, actually doesn't look that shit when using svg:

using CairoMakie
CairoMakie.activate!(type = "SVG")
begin
	N = 100
	δ = 0.01
	cs = repeat(1:5, N÷5)
	heights = rand(N) * 200
	meshscatter(
		Point3f.(rand(N), rand(N), 0.00001rand(N)); 
	  	color = cs,
		markersize = Vec3f.(δ, δ, heights),
		colormap = :Spectral_7,
		marker = Rect3f(Vec3f(0), Vec3f(1)),
	 	figure = (resolution=(700,600),),
		axis = (
			type = Axis3, perspectiveness = 0.5, azimuth = 2.6, elevation=0.5,
                        xlabel = "ϕ", ylabel = "η", zlabel = "kt",
		        limits = (nothing, nothing, nothing, nothing, 0, 200)
		),
	    shading=false
	)
end

image

@gojakuch
Copy link
Collaborator

This is awesome, mate! This looks like exactly what we need. Would you like to make a pull request or should I just use your code?

@Moelf
Copy link
Member Author

Moelf commented Jul 26, 2022

Just go ahead to use it for now to clean up the dependency, we can worry about usability and beautifying it later

graeme-a-stewart added a commit that referenced this issue Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants