seafloor / forestplot

Simple forest plot in python with matplotlib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

forestplot

Simple forest plots in python with matplotlib

small_forest_plot

forest_plot is a basic but reasonably flexible function that plots a horizontal scatter and makes use of ax.text() with clip_on set to False. Width of columns can be adjusted using the annot_* args. Plots are setup to generate figures systematic reviews; meta-analysis results were not tested but should work fine by sorting beforehand and passing a custom marker for the meta-analysis results

Horizontal bars should fit to figure width by taking the left and right-most annotation locations from the figure, but the right-hand-side may need adjusting - a tuple can be passed to hbar_lim in this case. If you're saving a figure for publication then the save_fig function can be used for tiffs with lzw compression if needed.

See the examples notebook for small variations. Plots were used to create the figures in the paper Machine learning for genetic prediction of psychiatric disorders: a systematic review by Bracher-Smith et al.

Required packages

  • matplotlib
  • numpy
  • pandas

Basic use

To download and install required packages (shouldn't be necessary as it's just standard scipy): This will also install jupyter notebooks for running examples

About

Simple forest plot in python with matplotlib

License:GNU General Public License v3.0


Languages

Language:Python 100.0%