With a change of research focus comes a change of tools. I’m fiddling with clusters of galaxies at the moment (GR stuff has been put slightly to one side for a little while), so I’ve been re-educating myself in the art of handling catalogues. I discovered a handful of neat numpy/matplotlib routines in the process, which I thought I’d share:
- Map projections: You can project plots differently by using the
projectionkeyword argument for subplot, e.g.
- Logarithmic sampling: If you need to sample some function on a logarithmic interval (e.g. a cluster pressure profile), use numpy’s logspace function instead of the usual linspace.
- Split log axes: Sometimes you want log axes for a plot that includes both positive and negative values. Rather than messing around with taking the absolute value of the negative numbers and then changing the line style, you can use SymmetricalLogScale.