Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 74ead7c

Browse files
committed
Merge remote-tracking branch 'matplotlib/v1.5.x' into v2.x
2 parents 47c7364 + 1caf775 commit 74ead7c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

examples/specialty_plots/hinton_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def hinton(matrix, max_weight=None, ax=None):
1717
ax = ax if ax is not None else plt.gca()
1818

1919
if not max_weight:
20-
max_weight = 2**np.ceil(np.log(np.abs(matrix).max())/np.log(2))
20+
max_weight = 2 ** np.ceil(np.log(np.abs(matrix).max()) / np.log(2))
2121

2222
ax.patch.set_facecolor('gray')
2323
ax.set_aspect('equal', 'box')
@@ -26,7 +26,7 @@ def hinton(matrix, max_weight=None, ax=None):
2626

2727
for (x, y), w in np.ndenumerate(matrix):
2828
color = 'white' if w > 0 else 'black'
29-
size = np.sqrt(np.abs(w))
29+
size = np.sqrt(np.abs(w) / max_weight)
3030
rect = plt.Rectangle([x - size / 2, y - size / 2], size, size,
3131
facecolor=color, edgecolor=color)
3232
ax.add_patch(rect)

tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def run(extra_args):
5959
if '--no-network' in sys.argv:
6060
from matplotlib.testing import disable_internet
6161
disable_internet.turn_off_internet()
62-
extra_args.extend(['--eval-attr="not network"'])
62+
extra_args.extend(['-a', '!network'])
6363
sys.argv.remove('--no-network')
6464

6565
run(extra_args)

0 commit comments

Comments
 (0)