Skip to content

Commit 0efc007

Browse files
committed
Add parameters to turn-off matrix labels. Closes #86.
1 parent 186213a commit 0efc007

File tree

6 files changed

+554
-271
lines changed

6 files changed

+554
-271
lines changed

docs/matrix-visualization.ipynb

Lines changed: 192 additions & 43 deletions
Large diffs are not rendered by default.

docs/matrix-visualization.rst

Lines changed: 153 additions & 31 deletions
Large diffs are not rendered by default.

docs/tick-locators.ipynb

Lines changed: 99 additions & 99 deletions
Large diffs are not rendered by default.

docs/tick-locators.rst

Lines changed: 87 additions & 87 deletions
Large diffs are not rendered by default.

toyplot/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ def matrix(
332332
matrix,
333333
label=None,
334334
step=1,
335+
xshow=True,
336+
yshow=True,
335337
colormap=None,
336338
palette=None,
337339
width=None,
@@ -353,6 +355,8 @@ def matrix(
353355
matrix=matrix,
354356
label=label,
355357
step=step,
358+
xshow=xshow,
359+
yshow=yshow,
356360
colormap=colormap,
357361
palette=palette)
358362
return canvas, table

toyplot/canvas.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,8 @@ def matrix(
387387
matrix,
388388
label=None,
389389
step=1,
390+
xshow=True,
391+
yshow=True,
390392
colormap=None,
391393
palette=None,
392394
bounds=None,
@@ -419,27 +421,33 @@ def matrix(
419421
ymin_range,
420422
ymax_range,
421423
trows=1,
422-
brows=0,
424+
brows=1,
423425
lcols=1,
424-
rcols=0,
426+
rcols=1,
425427
rows=matrix.shape[0],
426428
columns=matrix.shape[1],
427429
label=label,
428430
parent=self)
429431

430432
table.top.row(0).height = 20
433+
table.bottom.row(0).height = 20
431434
table.left.column(0).width = 20
435+
table.right.column(0).width = 20
432436

433437
table.left.column(0).align = "right"
434-
for i, label, title in zip(
435-
*toyplot.locator.Integer(step=step).ticks(0, matrix.shape[0] - 1)):
436-
table.left.cell(i, 0).data = label
437-
#table.left.cell(i, 0).title = title
438-
439-
for j, label, title in zip(
440-
*toyplot.locator.Integer(step=step).ticks(0, matrix.shape[1] - 1)):
441-
table.top.cell(0, j).data = label
442-
#table.top.cell(0, j).title = title
438+
table.right.column(0).align = "left"
439+
440+
if yshow:
441+
for i, label, title in zip(
442+
*toyplot.locator.Integer(step=step).ticks(0, matrix.shape[0] - 1)):
443+
table.left.cell(i, 0).data = label
444+
#table.left.cell(i, 0).title = title
445+
446+
if xshow:
447+
for j, label, title in zip(
448+
*toyplot.locator.Integer(step=step).ticks(0, matrix.shape[1] - 1)):
449+
table.top.cell(0, j).data = label
450+
#table.top.cell(0, j).title = title
443451

444452
for i, row in enumerate(matrix):
445453
for j, value in enumerate(row):

0 commit comments

Comments
 (0)