Download 15.py from TestCaseGeneration/NumFEM_Eval: direct link, hf CLI and curl.
- Browser
- Download file 551 Bytes
-
https://huggingface.co/datasets/TestCaseGeneration/NumFEM_Eval/resolve/main/15.py
- Command line
-
hf download hf://datasets/TestCaseGeneration/NumFEM_Eval/15.py
-
curl -L -o 15.py https://huggingface.co/datasets/TestCaseGeneration/NumFEM_Eval/resolve/main/15.py
551 Bytes
| def plot_coo_matrix(m): | |
| import matplotlib.pyplot as plt | |
| from scipy.sparse import coo_matrix | |
| if not isinstance(m, coo_matrix): | |
| m = coo_matrix(m) | |
| fig = plt.figure() | |
| ax = fig.add_subplot(111, axisbg='black') | |
| ax.plot(m.col, m.row, '.', color='white', ms=1) | |
| ax.set_xlim(0, m.shape[1]) | |
| ax.set_ylim(0, m.shape[0]) | |
| ax.set_aspect('equal') | |
| for spine in ax.spines.values(): | |
| spine.set_visible(False) | |
| ax.invert_yaxis() | |
| ax.set_aspect('equal') | |
| ax.set_xticks([]) | |
| ax.set_yticks([]) | |
| plt.show() |