Creating 3D Surface Plots with Plotly and Hosting on Github
Whenever I want to show plots in 3D, I normally would want them interactive as it is often difficult to make sense of 3D plots in static mode. Often times, I find myself turning to Plotly for help. But this time, I wanted to put all my figures in a subplot format.
Easy-peasy.
But it turned out that editing the titles of the axes for each subplot is a bit trickier than I initially hoped. It had me baffled for a good three hours. Or was it more? The solution is apparently simple. I managed to dig into the Plotly's documentation and used the so-called "scene" feature of each trace I added. Each trace corresponds to a subplot in my ... big plot!
So the key code to doing this should look a bit like what you see here:
Then I appended each scene to the update_layout function.
So after putting all the figures together, I needed to host it somewhere.
I've heard and read of hosting sites on github, but I have never actually done it myself. Turned out easier than I imagined it would be. Tho I would want to play with it a bit more and host that covidph trail that I did a while back. So what you are seeing below is an embedded iframe from github, which I slightly modified to fit in my blog page.
КРУТО!
Comments
Post a Comment