Not a question, but a 3D PlotlyJS gallery

I’m a Julia beginner, as you may have noticed from the basic questions I have asked here.
To practice it I created a small project and gallery of 3D PlotlyJS charts, here:

Code and more 3D charts at the link above!



Thank you!

love this – great work

1 Like

@empet, fantastic stuff, pure beauty on a computer. I have just become aware of your gallery and have a stupid question: is it possible to implement them in Pluto? As far as I know, Pluto does not allow to include Julia files. If there is a turnaround to this problem, I would be delighted to know because I am kind of desperate to use the code in your first notebook. Congrats.

To replicate your first notebook was easy, but the colors I came up with are not nice. I will have to see how to improve on that part.

@VivMendes You can avoid including those files. I used PlotlyJS v 018.0, but starting with v >0.18.5(?!) the style is no more available. Instead you can use the plotly templates.
To get the colorscheme involved in a plot, check its name and either generate it with the function plotly_cs() from src/PlotlyColorSchemes.jl or use the latest way to load a colorscheme.

Unfortunately the actual implementation of loading a colorscheme, as colors.colorschemeName, overloads the json file of the plot, because it uses all 256 colors (or even 512, in the case of cmocean diverging colorschemes). That’s why I prefer to generate the plotly version consisting in 11 or 21 colors and paste it in the code. In this case plotly.js will interpolate the rgb colors for any normalized data value. To get the reversed colorscheme, just add reversescale=true to the trace definition.

@empet, thank you very much for your help.

In Pluto, I will have to use PlotlyBase.jl instead of PlotlyJS.jl to render the plots (to save plots I use: import Plotly:savefig). This turnaround was possible due to a terrific contribution by @disberd

A couple of months ago, I played with colors in some 2D and 3D plots using PlotlyJS. I have just checked and came up with this version of your 3D fantastic plot. It looks better now, but how can I get rid of the sandy view of the projection of the contour curves on its basis?

Edited: I am on a Windows 10 machine, using Julia 1.6.3, PlotlyJS.jl v0.18.8, PlotlyBase v0.0.18, and Pluto v0.16.1.

Please see my efforts below, where I marginally changed your code:

	using PlotlyBase
	using HypertextLiteral
	using Colors # I am not sure Colors is doing anything in the plot
	#using ColorSchemes
	surf = surface(x=x, y=y, z=z, 
			   #colorscale = "Jet",
               contours_z=attr(show=true, start=minimum(z), 
                               size=0.4, width= 2, color="rgb(200,200,200)", 
                               usecolormap=false, project_z=true),

	proj = surface(x=x, y=y, 
				   z=-5*ones(size(z)), #h=-5
				   #colorscale = "Hot",

	layout = Layout(width=600, height=600, 
					scene = attr(camera_eye=attr(x=-1.65, y= 1.65, z=0.75),
								 xaxis=merge(ax_commons, attr(showgrid=false)),
								 yaxis=merge(ax_commons, attr(showgrid=false)),
												  gridwidth = 2,
												  range=[-5, maximum(z)+0.5]))))     
	pl = Plot([surf, proj], layout)