This commit is contained in:
guanjihuan 2021-08-30 14:16:52 +08:00
parent 509e742a45
commit 6e281b9500
3 changed files with 4 additions and 11 deletions

View File

@ -11,14 +11,12 @@ def main():
def Plot_2D_Scatter(x, y, value, xlabel='x', ylabel='y', title='title', filename='a'): def Plot_2D_Scatter(x, y, value, xlabel='x', ylabel='y', title='title', filename='a'):
from matplotlib.axes._axes import _log as matplotlib_axes_logger
matplotlib_axes_logger.setLevel('ERROR') # 只显示error级别的通知
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
fig = plt.figure() fig = plt.figure()
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
plt.subplots_adjust(bottom=0.2, right=0.8, left=0.2) plt.subplots_adjust(bottom=0.2, right=0.8, left=0.2)
for i in range(np.array(x).shape[0]): for i in range(np.array(x).shape[0]):
ax.scatter(x[i], y[i], marker='o', s=100*value[i], c=(1,0,0)) ax.scatter(x[i], y[i], marker='o', s=100*value[i], c=[(1,0,0)])
ax.set_title(title, fontsize=20, fontfamily='Times New Roman') ax.set_title(title, fontsize=20, fontfamily='Times New Roman')
ax.set_xlabel(xlabel, fontsize=20, fontfamily='Times New Roman') ax.set_xlabel(xlabel, fontsize=20, fontfamily='Times New Roman')
ax.set_ylabel(ylabel, fontsize=20, fontfamily='Times New Roman') ax.set_ylabel(ylabel, fontsize=20, fontfamily='Times New Roman')

View File

@ -12,15 +12,13 @@ def main():
def Plot_3D_Scatter(x, y, z, value, xlabel='x', ylabel='y', zlabel='z', title='title', filename='a'): def Plot_3D_Scatter(x, y, z, value, xlabel='x', ylabel='y', zlabel='z', title='title', filename='a'):
from matplotlib.axes._axes import _log as matplotlib_axes_logger
matplotlib_axes_logger.setLevel('ERROR') # 只显示error级别的通知
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from matplotlib.ticker import LinearLocator from matplotlib.ticker import LinearLocator
fig = plt.figure() fig = plt.figure()
ax = fig.add_subplot(111, projection='3d') ax = fig.add_subplot(111, projection='3d')
plt.subplots_adjust(bottom=0.1, right=0.8) plt.subplots_adjust(bottom=0.1, right=0.8)
for i in range(np.array(x).shape[0]): for i in range(np.array(x).shape[0]):
ax.scatter(x[i], y[i], z[i], marker='o', s=int(100*value[i]), c=(1,0,0)) ax.scatter(x[i], y[i], z[i], marker='o', s=int(100*value[i]), c=[(1,0,0)])
ax.set_title(title, fontsize=20, fontfamily='Times New Roman') ax.set_title(title, fontsize=20, fontfamily='Times New Roman')
ax.set_xlabel(xlabel, fontsize=20, fontfamily='Times New Roman') ax.set_xlabel(xlabel, fontsize=20, fontfamily='Times New Roman')
ax.set_ylabel(ylabel, fontsize=20, fontfamily='Times New Roman') ax.set_ylabel(ylabel, fontsize=20, fontfamily='Times New Roman')

View File

@ -79,15 +79,12 @@ def main():
def Plot_2D_Scatter(x, y, value, xlabel='x', ylabel='y', title='title', filename='a'): def Plot_2D_Scatter(x, y, value, xlabel='x', ylabel='y', title='title', filename='a'):
from matplotlib.axes._axes import _log as matplotlib_axes_logger
matplotlib_axes_logger.setLevel('ERROR') # 只显示error级别的通知
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from matplotlib.ticker import LinearLocator
fig = plt.figure() fig = plt.figure()
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
plt.subplots_adjust(bottom=0.2, right=0.8, left=0.2) plt.subplots_adjust(bottom=0.2, right=0.8, left=0.2)
for i in range(np.array(x).shape[0]): for i in range(np.array(x).shape[0]):
ax.scatter(x[i], y[i], marker='o', s=1000*value[i], c=(1,0,0)) ax.scatter(x[i], y[i], marker='o', s=1000*value[i], c=[(1,0,0)])
ax.set_title(title, fontsize=20, fontfamily='Times New Roman') ax.set_title(title, fontsize=20, fontfamily='Times New Roman')
ax.set_xlabel(xlabel, fontsize=20, fontfamily='Times New Roman') ax.set_xlabel(xlabel, fontsize=20, fontfamily='Times New Roman')
ax.set_ylabel(ylabel, fontsize=20, fontfamily='Times New Roman') ax.set_ylabel(ylabel, fontsize=20, fontfamily='Times New Roman')