-
Notifications
You must be signed in to change notification settings - Fork 29
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
Feature/plotly #410
Feature/plotly #410
Conversation
Thanks @SridharJagannathan! I think that you should not need to make any changes to plot3d.character - it should work transparently if you specify a plotengine argument. |
I think it would be good to have an option |
* master: Fix bug in nmapply with progress fix warning in teardown skip exact md5 ndigest tests on CRAN nat.examples is still on jefferis user redown inc with logos Give neuronlistfh/fillMissing new progress bar Give nmapply a progress bar Export progress_natprogress for other packages Fix URL typo in README Teach cmtk.bindir about compiled but uninstalled cmtk Set default filename for write.neurons from neuronlist name Add progress bar for write.neurons Make plot.cmtkreg example conditional docs / examples for new progress bar Make nlapply use progress package reporter by default give read.neurons a progress bar with ETA
This is looking very good. I was thinking that one advantage was that it might be possible to convert the examples in the pkgdown docs to use the plotly engine so that the 3D content would appear. But two issues
|
Another small point, I think |
PS @SridharJagannathan I am taking a look at this branch at the moment and you are enjoying a break so these notes are for info, not for you to act on now. |
A couple more points
|
R/cmtkreg.R
Outdated
scene=list(camera=.plotly3d$camera)) | ||
assign("plotlyscenehandle", plotlyreturnlist$plotlyscenehandle, envir=.plotly3d) | ||
print(.plotly3d$plotlyscenehandle) | ||
invisible(plotlyreturnlist) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be returning:
.plotly3d$plotlyscenehandle
without the print statement
@@ -154,5 +165,20 @@ plot3d.cmtkreg <- function(x, ...) { | |||
coeffs=reg$spline_warp$coefficients | |||
aidxs=seq.int(from=1, by=3L, length.out = nrow(coeffs)) | |||
actives=reg$spline_warp$active[aidxs]!=0 | |||
plot3d(coeffs[actives, ], xlab='X', ylab = "Y", zlab = "Z", ...) | |||
if (plotengine == 'rgl'){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be
if (plotengine == 'plotly'){
and then do Plotly stuff with the rgl engine as default. I'm not sure we actually set options(plotengine='rgl')
anywhere do we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, you do set options(plotengine='rgl')
in zzz.R so I guess this is ok.
* see #410 (comment) * add a plotly vignette to demonstrate this is actually the case
* also reduce default line width to 1 for plotly
* this is something rather nice that we get with plotly
* no longer necessary * also standardise docs for plotengine
* otherwise we could end up with a bad value and some stuff that checks for rgl not happening
* note that hover colour does not match soma unfortunately.
* add to index
Note that I was not aware, but somewhat disappointingly it seems that pkgdown cannot yet support the use of htmlwidgets and therefore plotly in examples (vignettes are fine). See e.g. r-lib/pkgdown#742 |
Just updating some comments for my notes here:
|
What examples are we talking about here, can you give me a |
There is now an
I don't think so. The goal is that, where possible, it would be better if the same code could produce reasonable outcomes with both plot engines. So I don't think we want to throw an error here. However one change worth considering is that we make nopen3d and nclear3d do the same thing (clearing our .plotly environment) when
It is to plot a large number of neurons, quickly, one after another and optionally select some of them. It does not really make so much senses for plotly, because you cannot currently edit a plotly scene, you just rebuild it from scratch. In contrast with plotly you may be able to plot all the neurons at once and hover to identify.
Do you want to give an eg? I did change the line widths for your bounding box plots as they seemed very wide. I'm not sure about surface plots. This also reminds me, that it might be worth making the default for surface hover to be no hover information when only the
it is exercised indirectly by every single call to the plot3d functions. But it's ability to respond to a bad value of the option is never tested explicitly, if you want to check that as well.
You could try that for sure. I'm not sure that the time to build the scene is the major determinant for webGL vs plotly choice. Building the scene with rgl is much faster, but I'm not sure that we can really time that in a markdown document.
plot3d(kcs20, soma=TRUE) try hovering over the somata – colour always stays red.
I thought that could be interesting. I think Philipp has used them to label plots and show (groups of) neurons, then this could be useful. I think we could still finish this PR and add this as a new issue. |
This is for the examples at the bottom of the documentation for each function on the pkgdown website for nat. |
@jefferis Thanks so much for the detailed answers, def helpful.. :)
The following should reproduce the issue:
If you compare the outputs of the I would try the other things you mentioned and perhaps we can close this feature then. |
Hi @SridharJagannathan, I see the problem you point out with the
see https://plot.ly/r/3d-axes. I've attached a picture of FCWB using the old code for reference to show the squashed axes: which shows that extending the axes at least as you have done isn't going to work. I think that setting the fixed axis ratio needs to happen at the start of each plotly scene i.e. nclear3d/nopen3d or similar. I would avoid doing it in every single plot command. |
It totally see this now, so may be we wait a bit till its merged (r-lib/pkgdown#742) |
hmm, @jefferis I did try this aspect ratio, however it doesn't seem to work, see below. |
Just a note that the key here was to use plotly::layout(scene=list(aspectmode='data')) |
Added support for
plotly
plotting engine.Added test cases for the same.
Items that need to be checked:
rgl
) of most of the features, however it would be nicer for a more experienced person to check the details of a well known neuron or neuron list or surface etc.plot3d.character
as it returns an error by default even forrgl
implementation.Would close #409