【发布时间】:2022-01-26 01:27:30
【问题描述】:
我尝试在我的代码中使用 seaborn 包来散布图复数,但即使在调用 sns.set_style() 之后我也没有得到任何输出。请帮忙。
from matplotlib import pyplot as plt
import math
import seaborn as sns
s = ([1 + 1j, 1 + 69j, 2 + 1j, 2 + 2j,4.5 - 6.4j]) # s is a list which contains all the complex numbers which r to be plotted
x = [x.real for x in s]
y = [y.imag for y in s]
plt.plot(x, y, 'o', c='red')
plt.grid(True)
plt.xlabel('Real number')
plt.ylabel('Imaginary number')
plt.title('Graph of given complex numbers')
sns.set_style("dark")
plt.show()```
【问题讨论】:
标签: python matplotlib numbers seaborn