Skip to content

Commit 9797219

Browse files
committed
version 0.2.0
1 parent dfdad09 commit 9797219

File tree

14 files changed

+686
-310
lines changed

14 files changed

+686
-310
lines changed

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
11
In development:
22
---------------
33

4+
TODO
5+
6+
Version 0.2.0:
7+
--------------
8+
49
Breaking changes:
510

11+
* Various argument name changes, especially for colors.
612
* Inverted `cyber` colormap.
713
* Move `plots.border.Style` to `core.BoxStyle`.
814

915
New:
1016

1117
* Configurable background colour for image rendering.
1218
* 3d scatterplot.
13-
* New discrete colourmaps `tableau`, `nouveau`.
1419
* Discrete colourmaps are now cyclic.
20+
* New discrete colourmaps `tableau`, `nouveau`.
1521
* New border styles.
1622
* Export animations as GIFs.
23+
* New configuration options for bar/column sizes.
24+
25+
Internal:
26+
27+
* Refactor backend to use numpy arrays rather than nested lists.
1728

1829
Version 0.1.2:
1930
--------------

README.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ Basic plot arrangement:
153153

154154
Styling plots with colors:
155155

156+
* [ ] Consistent API for color specification.
156157
* [x] Basic colormaps.
157158
* [x] BIDS colormaps.
158159
* [x] Rainbow colormap.
@@ -167,6 +168,7 @@ Rendering:
167168
Basic code improvements:
168169

169170
* [x] Split up monolithic file into a small number of modules.
171+
* [ ] Split up plotting module with one file per plot type.
170172
* [x] Comprehensive type annotations, static type checking with mypy.
171173
* [ ] Robust input validation and error handling.
172174
* [ ] Tests.
@@ -183,7 +185,8 @@ Repository:
183185

184186
* [x] Set up project, installable via git.
185187
* [x] A simple example for the quick-start guide.
186-
* [x] Version numbering and changelog.
188+
* [x] Changelog.
189+
* [ ] Version numbering and keep main branch working.
187190
* [ ] List on PyPI.
188191

189192
Advanced features roadmap
@@ -197,7 +200,8 @@ More plot types:
197200
* [ ] Error bars on line plots.
198201
* [ ] Fill plots.
199202
* Advanced bar charts:
200-
* [ ] Bar/column charts with configurable sizes, spacing, alignment.
203+
* [x] Bar/column charts with configurable sizes and spacing.
204+
* [ ] Bar/column charts with other alignments.
201205
* [ ] Negative values in bar/column charts.
202206
* Hilbert curves:
203207
* [x] Basic Hilbert curves.
@@ -231,16 +235,14 @@ Advanced rendering:
231235

232236
Back end improvements:
233237

234-
* [ ] Upgrade Char backend to use arrays of codepoints and colors (think
235-
PyTrees from JAX to replace the current nested lists of dataclasses).
236-
* [ ] Vectorised composition operations.
237-
* [ ] Vectorised bitmap rendering.
238-
* [ ] Faster and more intelligent ANSI rendering (only include necessary
239-
control codes and resets, e.g., if several characters in a row use the same
240-
colours).
238+
* [x] Upgrade Char backend to use arrays of codepoints and colors.
239+
* [x] Vectorised composition operations.
240+
* [x] Vectorised bitmap rendering.
241+
* [x] Intelligent ANSI rendering (only include necessary control codes and
242+
resets, e.g., if several characters in a row use the same colours).
241243
* [ ] Faster animated plot redraws (e.g., differential rendering with shortcut
242244
`-`).
243-
* [ ] Consider reactive programming principles.
245+
* [ ] Clean up backend code e.g. using JAX PyTrees and vectorisation.
244246

245247
More elaborate documentation:
246248

@@ -251,6 +253,10 @@ More elaborate documentation:
251253
(automatically linked to relevant release).
252254
* [ ] Documentation search.
253255

256+
Future design directions.
257+
258+
* [ ] Reactive plots.
259+
254260
Related work
255261
------------
256262

examples/braille_test.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818
print("dot patterns")
1919
print(dots.astype(int))
2020

21-
braille_codepoints = mpc.braille_encode(dots)
22-
print("braille codepoints")
23-
print(braille_codepoints)
24-
21+
braille_chars = mpc.unicode_braille_array(dots)
2522
print("braille characters")
26-
for row in braille_codepoints:
27-
braille_characters = [chr(int(b)) for b in row]
28-
print("".join(braille_characters))
23+
print(braille_chars.to_ansi_str())

examples/calendar_heatmap.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,14 @@ def main():
8686
continue
8787
date = datetime.date(year, month, day)
8888
if date not in DATA:
89-
day_plots.append(mp.text(EMPTY_DAY, color=(0,0,0)))
89+
day_plots.append(mp.text(
90+
EMPTY_DAY,
91+
fgcolor=(0,0,0),
92+
))
9093
continue
9194
day_plots.append(mp.text(
9295
COUNT_DAY,
93-
color=mp.cyber(1-norm_data[date]),
96+
fgcolor=mp.cyber(1-norm_data[date]),
9497
bgcolor=(0,0,0),
9598
))
9699
week_plots.append(mp.hstack(*day_plots))
@@ -105,6 +108,7 @@ def main():
105108
year += 1
106109
month = 1
107110

111+
# combine
108112
plot = mp.wrap(*month_plots)
109113

110114
print("printing plot...")

examples/colormaps.py

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,54 @@
1111
)
1212
im_continuous = np.zeros((16,16), dtype=float)
1313
im_continuous[coords[:,0], coords[:,1]] = np.linspace(0.0, 1.0, 256)
14-
im_discrete = np.zeros((16, 16), dtype=int)
15-
im_discrete[coords[:,0], coords[:,1]] = np.arange(256) // 16
14+
im_discrete16 = np.zeros((16, 16), dtype=int)
15+
im_discrete16[coords[:,0], coords[:,1]] = np.arange(256) // 16
16+
im_discrete10 = np.zeros((16, 16), dtype=int)
17+
im_discrete10[coords[:,0], coords[:,1]] = np.arange(256) // 25.6
1618

1719
print("generating plot...")
18-
plot = (
19-
mp.text("test images:")
20-
/ mp.hstack(
20+
plot = mp.vstack(
21+
mp.text("test images:"),
22+
mp.hstack(
2123
mp.border(
2224
mp.text("linspace(0,1,256")
2325
/ mp.image(im_continuous),
2426
),
2527
mp.border(
26-
mp.text("arange(256)//16")
27-
/ mp.image(im_discrete / 16),
28+
mp.text("arange(256)/16")
29+
/ mp.image(im_discrete16 / 16),
30+
),
31+
mp.border(
32+
mp.text("arange(256)/25.6")
33+
/ mp.image(im_discrete10 / 10),
2834
)
29-
)
30-
/ mp.text("continuous colormaps:")
31-
/ mp.wrap(*[
35+
),
36+
mp.text("continuous colormaps:"),
37+
mp.wrap(*[
3238
mp.border(
3339
mp.text(c.__name__)
3440
/ mp.image(im_continuous, colormap=c),
3541
)
3642
for c in [
3743
mp.reds, mp.greens, mp.blues, mp.rainbow,
3844
mp.yellows, mp.magentas, mp.cyans, mp.cyber,
39-
mp.magma, mp.inferno, mp.plasma, mp.viridis,
45+
mp.magma, mp.inferno, mp.plasma, mp.viridis
4046
]
41-
], cols=4)
42-
/ mp.text("discrete colormaps:")
43-
/ mp.wrap(*[
47+
], cols=4),
48+
mp.text("discrete colormaps:"),
49+
mp.wrap(*[
50+
mp.border(
51+
mp.text(c.__name__)
52+
/ mp.image(im_discrete16, colormap=c),
53+
)
54+
for c in [ mp.sweetie16, mp.pico8 ]
55+
], *[
4456
mp.border(
4557
mp.text(c.__name__)
46-
/ mp.image(im_discrete, colormap=c),
58+
/ mp.image(im_discrete10, colormap=c),
4759
)
48-
for c in [ mp.sweetie16, mp.pico8, mp.tableau, mp.nouveau, ]
49-
], cols=4)
60+
for c in [ mp.tableau, mp.nouveau ]
61+
], cols=4),
5062
)
5163

5264
print("rendering plot...")

images/calendar_heatmap.png

-281 Bytes
Loading

images/colormaps.png

529 Bytes
Loading

images/demo.png

34 Bytes
Loading

images/hilbert_curve.png

0 Bytes
Loading

images/lissajous.png

41 Bytes
Loading

0 commit comments

Comments
 (0)