# Spy Demos¶

Plot the sparsity pattern of arrays.

import matplotlib.pyplot as plt
import numpy as np

fig, axs = plt.subplots(2, 2)
ax1 = axs[0, 0]
ax2 = axs[0, 1]
ax3 = axs[1, 0]
ax4 = axs[1, 1]

x = np.random.randn(20, 20)
x[5, :] = 0.
x[:, 12] = 0.

ax1.spy(x, markersize=5)
ax2.spy(x, precision=0.1, markersize=5)

ax3.spy(x)
ax4.spy(x, precision=0.1)

plt.show()
{"ft_lang_label":"__label__en","ft_lang_prob":0.53500557,"math_prob":0.9999603,"size":705,"snap":"2023-40-2023-50","text_gpt3_token_len":229,"char_repetition_ratio":0.122681886,"word_repetition_ratio":0.0,"special_character_ratio":0.32340425,"punctuation_ratio":0.24550898,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9998271,"pos_list":[0,1,2],"im_url_duplicate_count":[null,3,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-12-02T18:50:26Z\",\"WARC-Record-ID\":\"<urn:uuid:04cac2e9-2896-402a-bf76-c3128cf108ff>\",\"Content-Length\":\"17256\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:67407fd9-0d58-4aba-bf21-8bf0c186a16c>\",\"WARC-Concurrent-To\":\"<urn:uuid:004adc53-d1aa-4a2d-93d4-743983233be4>\",\"WARC-IP-Address\":\"104.26.1.8\",\"WARC-Target-URI\":\"https://matplotlib.org/3.2.2/gallery/images_contours_and_fields/spy_demos.html\",\"WARC-Payload-Digest\":\"sha1:DI3QZJO7IQJDEZEDVSBA6CQTCKOPELUE\",\"WARC-Block-Digest\":\"sha1:4EBA4IF2BNQ57SHXKZIDJHGGWSMEMSMR\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-50/CC-MAIN-2023-50_segments_1700679100448.65_warc_CC-MAIN-20231202172159-20231202202159-00273.warc.gz\"}"}