-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Custom colors trisurf #484
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
Conversation
# Pre-computed list / array of values to map onto color | ||
if len(color_func) != len(simplices): | ||
raise ValueError('If color_func is a list/array, must' | ||
' be the same length as simplices') |
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.
🐐 (grammar goat), sorry we rely heavily on emojis for code reviews at Plotly.
'If color_func is a list/array, it must be the same length as simplices.'
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.
haha, will do. I think I left off the it
because I was trying to keep the line under PEP8 max, but ended up splitting it anyway. I had a PR last week where someone got me for including a dangling participle :D
Just a couple of comments @choldgraf, thanks for adding this! 👍 from me after you address those little nit-picks. @Kully can you also give it a review and pass off if you're happy with it? |
ok, I'll wait until another pair of eyes sees it and will then make changes. Feel free to suggest how to deal with the string checking situation. For me, the array-forcing got the JSON packaging down to ~4 seconds per hemisphere (down from about 16 seconds). btw, it looks like the plotly.js repo has been updated with lighting fixes today. Any idea when that'll make its way into the python plotly library? |
Offline mode should download the latest version of plotly.js from the plotly.js CDN (am I remembering this right @etpinard ?) |
Hmm @jackparmer I don't remember. |
I don't think so anymore. If you look at L34 of offline.py, it says that On Thu, May 26, 2016 at 4:50 PM, Étienne Tétreault-Pinard <
|
We're manually updating plotly.js for offline mode. @choldgraf we'll add a new version today with the updates |
thanks! :) On Fri, May 27, 2016 at 5:31 AM, Chelsea [email protected] wrote:
|
New PR with these changes integrated: #486 |
OK, just tried the latest master and the plotting seems to work as planned. Now just waiting for the JS update! |
There's one thing I noticed that is lacking, and that is support for hex and tuple colors in color_func (if a list). Right now I am:
I finished 1. but I can't seem to solve |
@choldgraf I am going to make a new PR for what I am doing. But I will hold off on allowing for tuple compatibility. Need to prioritize updating the docs. |
I think it's worth having a |
That sounds like a good idea. The only thing is that not all functions in FigureFactory use 'rgb' as the canonical color type, to my knowledge. One of them uses array of 0-255 iirc |
Good point - do you want to handle a PR for a function like this? I am On Fri, May 27, 2016 at 1:13 PM, Adam Kulidjian [email protected]
|
guys this looks awesome https://www.dropbox.com/s/9ozy6rv92vjr8cg/moarbrainz.mov?dl=0 seriously |
Dayummmm! |
@choldgraf we made an example for darkened deep grooves: intensity or color gradient depends on the euclidean distance from the mean of the mesh face center coordinates - the squared distances in the pythagorean root are weighted in proportion of the overall brain width per dimension. The code is quick and dirty, just serving as a rough PoC.
Of course an ellipsoid shape is simplistic, I'm sure there are established ways for fitting an anatomy-identifying model to a specific brain. |
@monfera that's beautiful. clever work! I showed these images to one of the devs at pysurfer, and they're interested in exploring using plotly as the backend for their 3D visualizations. pysurfer is a package for visualizing brain surfaces and plotting activity on top of them. Check out their repo here. It integrates pretty heavily with They're using Mayavi right now which is pretty clunky, it'd be great if there were a faster / more stable / prettier plotting solution (e.g., these plots get pretty close). I'll probably open an issue there to discuss switching the backend to plotly and see what people think. Will keep you guys updated. |
This is a Custom colours on a highly interactive fig.data[0].update(colorbar=go.ColorBar(...)) would do the job, but this was ineffectual. What would be the right way? I would have expected it to be a parameter for Also, I find a regular oscillation with high frequency and high amplitude in my RAM consumption when rendering a big |
@ntfrgl this PR and associated PRs indeed deal with mesh coloring. On the plotly.js side of things it involved an update that solved lighting and reflection issues that in the past turned the mesh show up in a subpar color or no color. Since color representation, annotation and data flow haven't changed, i.e. the possible causes seem unrelated, it would be better to document new issues (of course they can link to this or other PRs). When creating the new issue, it's helpful if a minimal example is included or linked that demonstrates the problem. If the problems were shown via the Python API, then it's useful to reproduce it with the JS API directly as well, because this can suggest the location of the issue. The utility of minimal problem reproductions also mean that it's useful to separate issues, e.g. one for the legend (with your example of what didn't work) and one for the memory fluctuation (maybe with a screenshot of Chrome vs Firefox). Easiest thing might be if there's a link to a demonstrating example. A comment about memory fluctuations is that we started looking into some aspects of memory management, which have a speed impact as well, so any report like yours is very useful. |
This is a quick add-on to #481 and #482. It basically does 3 things:
color_func
. In this case, it assumes the list/array has pre-computed color values and it won't try to calculate it from the z-coordinates etc.Mesh3d
class is an array. This makes plotting much faster._map_z2color
function because we're using this with more than just the z-values (shouldn't affect the functionality at all).I also added a few tests, which are passing for me. @Kully @theengineear @jackparmer