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

Skip to content

Remove example of matrix of size (12, 12) and (64, 64) #8094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions examples/pylab_examples/matshow.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,7 @@ def samplemat(dims):
aa[i, i] = i
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be rewritten as np.fill_diagonal(aa, range(min(dims))).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the current version is much more readable, which is important for an example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine either way.

return aa

# Display 2 matrices of different sizes
dimlist = [(12, 12), (15, 35)]
for d in dimlist:
plt.matshow(samplemat(d))

# Fixing random state for reproducibility
np.random.seed(19680801)


# Display a random matrix with a specified figure number and a grayscale
# colormap
plt.matshow(np.random.rand(64, 64), fignum=100, cmap=plt.cm.gray)
# Display matrix
plt.matshow(samplemat((15, 35)))

plt.show()