You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-22Lines changed: 17 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,29 +1,34 @@
1
+
# MPLLayout
1
2
2
3

3
4
4
5
## Summary
5
6
6
-
MPLLayout is a package used to create figure layouts for [matplotlib](https://matplotlib.org/) using geometric constraints.
7
+
MPLLayout is a package to create precise figure layouts in [matplotlib](https://matplotlib.org/).
8
+
It works by modelling figure elements using geometric primitives (for example, text anchors are points, the figure is a quadrilateral, etc.), then constraining the sizes and positions of these elements using geometric constraints (for example, fixing the width of a figure, constraining axes sides to be collinear, constraining axes to lie on a grid, etc.).
7
9
8
-
MPLLayout can be used to:
10
+
Using this approach, MPLLayout can:
9
11
10
12
* align figure elements (axes, text label location, x and y axis, etc.),
11
13
* specify margins around axes,
12
-
*specify the figure size,
14
+
*create templates for figures across different mediums (posters, manuscripts, slides, etc.),
13
15
* and more!
14
16
15
-
## Motivation
17
+
## Basic usage
16
18
17
-
Matplotlib contains several strategies for creating figure layouts (for example, `GridSpec`and `subplots` for grid-based layouts).
18
-
These strategies work well, however, they can be insufficient for complex figures or if you want precise placement of figure elements.
19
-
To address this, this package uses geometric primitives and constraints to represent and position figure elements.
19
+
The tutorial notebook in `examples/tutorial.ipynb` demonstrates the basic usage of the package and explains some of the commonly used geometric constraints.
20
+
Other examples are also given in the `examples` folder.
21
+
The notebook at `examples/ten_simple_rules_demo.ipynb` contains an interactive demo to recreate a figure from ["Ten Simple Rules For Better Figures"](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1003833) (Rougier, Droettboom and Bourne 2014).
20
22
21
-
It consists of:
23
+
A summary of how to use the package is shown in the figure below.
24
+
The process resembles creating and constraining geometry in computer-aided design programs like AutoCAD, SolidWorks, etc.
25
+

26
+
27
+
## Motivation
22
28
23
-
* geometric primitives to represent figure elements (for example, a `Quadrilateral` primitive represents a figure, a `Point` represents a text anchor, etc.),
24
-
* geometric constraints to position figure elements (for example, `Collinear` constraints align lines, `Length` constraints fix line lengths, etc.),
25
-
* a solver to find primitives that satisfy the constraints,
26
-
* and utilities to generate matplotlib figures and axes from the primitives.
29
+
Matplotlib contains several strategies for creating figure layouts (for example, `GridSpec` and `subplots` for grid-based layouts).
30
+
While these approaches work well, greater control over figure element positions is sometimes desirable;
31
+
for example, when preparing figures for published documents, research papers, or slides.
27
32
28
33
## Installation
29
34
@@ -42,16 +47,6 @@ pip install .
42
47
43
48
The package requires `numpy`, `matplotlib`, and `jax`.
44
49
45
-
## How to use
46
-
47
-
The tutorial notebook in `examples/tutorial.ipynb` demonstrates the basic usage of the package and explains some of the commonly used geometric constraints.
48
-
Other examples are also given in the `examples` folder.
49
-
The notebook at `examples/ten_simple_rules_demo.ipynb` contains an interactive demo to recreate figures from ["Ten Simple Rules For Better Figures"](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1003833) (Rougier, Droettboom and Bourne 2014).
50
-
51
-
A summary of how to use the package is shown in the figure below.
52
-
The process resembles creating and constraining geometry in computer-aided design programs like AutoCAD, SolidWorks, etc.
53
-

54
-
55
50
## Contributing
56
51
57
52
This project is a work in progress so there are likely bugs and missing features.
0 commit comments