Making MATLAB pretty

Alright all y’all haters, it’s MATLAB time.

For better or worse, MATLAB is the language that is used for scientific programming in neuroscience. But it, uh, has some issues when it comes to visualization. One major issue is the clusterfuck that is exporting graphics to vector files like eps. We have all exported a nice-looking image in MATLAB into a vectorized format that not only mangles the image but also ends up somehow needing thousands of layers, right?  Thankfully, Vy Vo pointed me to a package on github that is able to clean up these exported files.

Here is my favorite example (before, after):

If you zoom in or click the image, you can see the awful crosshatching in the before image. Even better, it goes from 11,775 layers before to just 76 after.

On top of this, gramm is a toolbox to add ggplot2-like visualization capabilities to MATLAB:

(Although personally, I like the new MATLAB default color-scheme – but these plotting functions are light-years better than the standard package.)

Update: Ben de Bivort shared his lab’s in-house preferred colormaps. I love ’em.

Update x2: Here’s another way to export your figures into eps nicely. Also, nice perceptually uniform color maps.

Advertisements

How to create neural circuit diagrams (updated)

nmeth.3777-F3

My diagrams are always a mess, but maybe I could start following this advice a little more carefully?

Diagrams of even simple circuits are often unnecessarily complex, making understanding brain connectivity maps difficult…Encoding several variables without sacrificing information, while still maintaining clarity, is a challenge. To do this, exclude extraneous variables—vary a graphical element only if it encodes something relevant, and do not encode any variables twice…

For neural circuits such as the brainstem auditory circuits, physical arrangement is a fundamental part of function. Another topology that is commonly necessary in neural circuit diagrams is the laminar organization of the cerebral cortex. When some parts of a circuit diagram are anatomically correct, readers may assume all aspects of the figure are similarly correct. For example, if cells are in their appropriate layers, one may assume that the path that one axon travels to reach another cell is also accurate. Be careful not to portray misleading information—draw edges clearly within or between layers, and always clearly communicate any uncertainty in the circuit.

Update: Andrew Giessel pointed me to this collection of blog posts from Nature Methods on how to visualize biological data more generally. Recommended!