Issue
I have data in the form of vectors like this:
[
[a, 0, 1, 1, 0],
[b, 1, 0, 0, 1],
[c, 1, 0, 1, 0],
...
]
I want to plot the data so that it looks kind of like this:
Where 0th element in each array is on the y axis and elements 1:4 of the array are plotted along the x axis. Specifically, each element 1:4 is plotted along a column and is yellow for 0
and purple for 1
.
What is such a plot called and how do I make one?
Solution
I think it's called imshow
/matshow
:
# `lst` is your list
plt.imshow(np.array([a[1:] for a in lst]).T)
plt.xticks(range(len(lst)),labels=[a[0] for a in lst])
Output:
Answered By - Quang Hoang
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.