Issue
I am trying to use plt.spy(matrix)
and would to like to understand what the precision parameter does here. The documentation states that any values of |Z| > precision
will be plotted. But what does |Z|
represent here?
Solution
|Z|
means converting elements to their absolute values or taking modulus on each element.
This means plt.spy(matrix, precision = k)
will plot elements from the matrix whose absolute value is greater than k.
import numpy as np
import matplotlib.pyplot as plt
data = np.array([[1, -1, 0, -10], [0, 0, 20, 0], [90, 0, 0, 1], [0, 0, 0, 0]])
fig, ax = plt.subplots(nrows=1, ncols=4)
ax[0].spy(data, precision=-0.5)
ax[1].spy(data, precision=5)
ax[2].spy(data, precision=10)
ax[3].spy(data, precision=80)
plt.show()
However, I feel this needs to be explicitly mentioned in the documentation as it is confusing what |Z|
means.
Answered By - medium-dimensional
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.