Comments (10)
Afraid this is not how the cn_color
parameter works. From help(navis.plot3d)
:
cn_colors : str | tuple | dict | "neuron"
Overrides the default colors:
- single color as str (e.g. ``'red'``) or rgb tuple (e.g.
``(1, 0, 0)``)
- dict mapping the connectors tables ``type`` column to a
color (e.g. `{0: (1, 0, 0)}`)
- with "neuron", connectors will receive the same color as
their neuron
Bottom line: cn_dict
lets you choose whether you want e.g. presynapses in green instead of red. I will update the help to make this clearer.
For what you want to do there are two options:
- Subset the connectors table in
nl
to only those synapses from/to the APL. This is a bit tricky with neuprint IIRC. - Fetch the synapses between APL and your neuron separately and add them as a scatter plot
An illustrative example for option 2:
Here I'm visuazing inputs from APL (425790257) onto LHMB1 (5813020988)
>>> # Fetch LHMB1
>>> nl = neu.fetch_skeletons(5813020988, with_synapses=True)
>>> # Fetch connections from APL onto LHMB1
>>> cn = neu.fetch_synapse_connections(source_criteria=neu.NeuronCriteria(bodyId=425790257), target_criteria=neu.NeuronCriteria(bodyId=5813020988))
>>> # Subset to those in the CA
>>> cn = cn[cn.roi_post == 'CA(R)']
>>> # Get the xyz locations
>>> locs = cn[['x_post', 'y_post', 'z_post']].values
>>> # Plot
>>> navis.plot3d([nl, locs, ca], scatter_kws={'color': 'green', 'size': 5}, color='k')
from navis.
Understood, and I have managed to get the plot I was looking for. Just one further issue, the color='k'
piece makes both my neuron and the calyx roi black. How can I change the color of the skeleton while keeping the roi in its typical light grey.
Thank you very much for your help
from navis.
Hmm... It shouldn't do that. What version of navis are you using?
from navis.
>>> import navis
>>> print(navis.__version__)
from navis.
Thanks for literally reading my mind while I was trying to look for that. it says 0.5.2
from navis.
Try updating: the most recent version is 0.5.3
.
pip3 install navis -U
Also what browser are you using? I had some issues with plotly plots in Safari in the past.
from navis.
Also note that you will have to restart the Python kernel in your notebook and re-run your code for the update to take effect.
from navis.
It worked! Once again, thank you!
One last question. Would all this work on a mesh instead of a skeleton? If yes, can I just substitute neu.fetch_skeletons
with neu.fetch_mesh_neuron
to do that?
from navis.
Yep
from navis.
@Gigi-prisco can this issue be closed?
from navis.
Related Issues (20)
- cut_skeleton memory issues HOT 2
- Minor: documentation on navis.Volume HOT 1
- Thoughts on synblast HOT 1
- Set DYLD_LIBRARY_PATH for elastix on MacOS HOT 2
- Custom colored connectors in plot2d is broken
- New numpy version leads to AttributeError HOT 5
- Traversal model make new nodes which is not in edges HOT 5
- downsample_neuron does not reassign connectors
- split_axon_dendrite fails for big neurons HOT 2
- New Feature for xform_brain: on-the-fly shortcuts for multi-transform chains
- Parquet skeletons HOT 4
- Neurons from Navis neuPrint tutorial load but without connection tables (no n_connectors) HOT 3
- Switch to pygfx? HOT 1
- igraph usage HOT 2
- disallow Dotprops for `write_swc` HOT 2
- caveclient > 5.15.2 crashes microns tutorial HOT 1
- Switch documentation to mkdocs + mkdocs material HOT 1
- Make function signatures more consistent
- New system for ultrastructural features
- Make nbl.smat.LookupNdBuilder more generic HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from navis.