View on GitHub

FigureFirst

A layout-first approach to designing figures

Download this project as a .zip file Download this project as a tar.gz file

Welcome to FigureFirst

FigureFirst is a work in progress. It aims to make the iterative design of figures for scientific publications not only easy, but fun. It is descibed in this SciPy 2017 paper.

Traditionally, scientific figure creation was a serial process, starting with ugly representations of raw data straight from analysis software (e. g. MATLAB or Python), progressing to more complex intermediate representations, and ending with a layout step using desktop publishing software (e. g. Inkscape or Illustrator). This method severely limits the researcher's ability to iterate, because once the data is exported to Inkscape, it can no longer be accessed by Python. This work flow is represented below:

With FigureFirst, the data processing and layout steps are worked on in parallel. Around the time the researcher starts to make panels for a figure in Python, s/he also begins to layout those panels in Inkscape. This way, it is easy to change the data analysis and figure layout independently. Iterative figure creation is a snap, resulting in more beautful and informative figures!

Quick start

FigureFirst should work with any operating system. It requires
Inkscape
• Python and matplotlib.

There are several ways to install FigureFirst. The simplest way is to download and unzip FigureFirst from one of the links above or here, navigate into the unzipped directory, and run sudo python setup.py install.

Alternatively, a minimal method is to download this file and copy it into your current directory. Then simply include import svg_to_axes in your python scripts.

FigureFirst also includes several useful (but optional) Inkscape extensions. To install these, navigate to the "inkscape_extensions" directory, and copy the .inx and .py files to
~/.config/inkscape/extensions/ (on Ubuntu or Mac) or
C:\Program Files\Inkscape\share\extensions (on Windows).

Basic example:

As a "hello world" example we will first construct a single axis using the FigureFirst workflow:

Step 1: Download the .svg file that will serve as a template, example_hello_world_layout.svg. You can open this file with Inkscape and explore it using the xml viewer to see what is going on.

Step 2: Create a text file called "example_hello_world.py" and copy the following text into it. Alternatively, just download example_hello_world.py.

Note, if you followed the "minimal" method in step 1 and only downloaded the svg_to_axes.py file, you will need to change line 3 to from svg_to_axes import FigureLayout.

Step 3: Run the python file using this command, python example_hello_world.py
This should create an output svg file called "example_hello_world_output.svg" which you can open in Inkscape.

So, what happened?

Be sure to check out the examples and Documentation for more information.

FAQ

Font size units do not make sense. In document properties, change the scale to 96 user units per inch.

Authors and Contributors

FigureFirst is primarily the work of Theodore Lindsay (@psilentp), Floris van Breugel (@florisvb), and Peter Weir (@ptweir).

Support or Contact

Having trouble with FigureFirst? Feel free to contribute on GitHub or contact us with questions.