-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdrawer.py
42 lines (34 loc) · 1.05 KB
/
drawer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# coding: utf-8
# Author:WangTianRui
# Date :2020/10/23 19:31
import matplotlib.pyplot as plt
import numpy as np
import os
def plot_mesh(img, title="", save_home=""):
img = img
fig, ax = plt.subplots()
plt.title(title)
fig.colorbar(plt.pcolormesh(range(img.shape[1]), range(img.shape[0]), img))
if save_home != "":
print(os.path.join(save_home, "%s.jpg" % title))
plt.savefig(os.path.join(save_home, "%s.jpg" % title))
return
plt.show()
def plot_spec_mesh(img, title="", save_home=""):
img = np.log(abs(img))
fig, ax = plt.subplots()
plt.title(title)
fig.colorbar(plt.pcolormesh(range(img.shape[1]), range(img.shape[0]), img))
if save_home != "":
print(os.path.join(save_home, "%s.jpg" % title))
plt.savefig(os.path.join(save_home, "%s.jpg" % title))
plt.show()
def plot_scatter(array, title="1"):
xs = np.arange(len(array))
plt.scatter(xs, array)
plt.title(title)
plt.show()
def plot(array, title):
plt.plot(array)
plt.title(title)
plt.show()