-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from hanjinliu/docs-scaling
Fix autoscaling and error bars
- Loading branch information
Showing
14 changed files
with
399 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,76 @@ | ||
# Canvas Grid | ||
|
||
A "canvas grid" is a grid of canvases (which is called "figure" in `matplotlib`). | ||
A grid is composed of multiple canvas objects, so that grid itself does not have | ||
either layers or the `add_*` methods. | ||
|
||
Once a grid is created, you can add chid canvases using the `add_canvas` method. | ||
The signature of the method differs between 1D and 2D grid. | ||
|
||
## Vertical/Horizontal Grid | ||
|
||
``` python | ||
#!name: canvas_grid_vertical | ||
from whitecanvas import vgrid | ||
|
||
canvas = vgrid(3, backend="matplotlib") | ||
grid = vgrid(3, backend="matplotlib") | ||
|
||
c0 = canvas.add_canvas(0) | ||
c0 = grid.add_canvas(0) | ||
c0.add_text(0, 0, "Canvas 0") | ||
c1 = canvas.add_canvas(1) | ||
c1 = grid.add_canvas(1) | ||
c1.add_text(0, 0, "Canvas 1") | ||
c2 = canvas.add_canvas(2) | ||
c2 = grid.add_canvas(2) | ||
c2.add_text(0, 0, "Canvas 2") | ||
canvas.show() | ||
grid.show() | ||
``` | ||
|
||
|
||
``` python | ||
#!name: canvas_grid_horizontal | ||
from whitecanvas import hgrid | ||
|
||
canvas = hgrid(3, backend="matplotlib") | ||
grid = hgrid(3, backend="matplotlib") | ||
|
||
c0 = canvas.add_canvas(0) | ||
c0 = grid.add_canvas(0) | ||
c0.add_text(0, 0, "Canvas 0") | ||
c1 = canvas.add_canvas(1) | ||
c1 = grid.add_canvas(1) | ||
c1.add_text(0, 0, "Canvas 1") | ||
c2 = canvas.add_canvas(2) | ||
c2 = grid.add_canvas(2) | ||
c2.add_text(0, 0, "Canvas 2") | ||
canvas.show() | ||
grid.show() | ||
``` | ||
|
||
## 2D Grid | ||
|
||
``` python | ||
#!name: canvas_grid_2d | ||
from whitecanvas import grid | ||
from whitecanvas import grid as grid2d | ||
|
||
canvas = grid(2, 2, backend="matplotlib") | ||
grid = grid2d(2, 2, backend="matplotlib") | ||
|
||
for i, j in [(0, 0), (0, 1), (1, 0), (1, 1)]: | ||
c = canvas.add_canvas(i, j) | ||
c = grid.add_canvas(i, j) | ||
c.add_text(0, 0, f"Canvas ({i}, {j})") | ||
canvas.show() | ||
grid.show() | ||
``` | ||
|
||
## Non-uniform Grid | ||
|
||
The `*_nonuniform` functions allow you to create a grid with non-uniform sizes. | ||
Instead of specifying the number of rows and columns, these functions take a list of size ratios. | ||
|
||
!!! note | ||
This feature is work in progress. Some backends does not support it yet. | ||
|
||
``` python | ||
#!name: canvas_grid_2d_nonuniform | ||
|
||
from whitecanvas import grid_nonuniform | ||
|
||
canvas = grid_nonuniform([1, 2], [2, 1], backend="matplotlib") | ||
grid = grid_nonuniform([1, 2], [2, 1], backend="matplotlib") | ||
|
||
for i, j in [(0, 0), (0, 1), (1, 0), (1, 1)]: | ||
c = canvas.add_canvas(i, j) | ||
c = grid.add_canvas(i, j) | ||
c.add_text(0, 0, f"Canvas ({i}, {j})") | ||
canvas.show() | ||
grid.show() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.