样式是matplotlib或matplotlib.pyplot的模块吗?
阅读matplotlib文档,style似乎是matplotlib的一个模块(matplotlib.style) 但是,我看到了以下代码: matplotlib.pyplot.style.use('seaborn')样式是matplotlib或matplotlib.pyplot的模块吗?,matplotlib,Matplotlib,阅读matplotlib文档,style似乎是matplotlib的一个模块(matplotlib.style) 但是,我看到了以下代码: matplotlib.pyplot.style.use('seaborn') 我不明白样式模块如何与matplotlib.pyplot模块关联(并从中调用)。matplotlib有一个模块style。可以像这样导入 from matplotlib import style 上述行也出现在pyplot.py中 样式因此位于pyplot的命名空间中,您可以 m
我不明白样式模块如何与matplotlib.pyplot模块关联(并从中调用)。matplotlib有一个模块
style
。可以像这样导入
from matplotlib import style
上述行也出现在pyplot.py
中样式
因此位于pyplot
的命名空间中,您可以
matplotlib.pyplot.style.use("some_style")
谢谢在面向对象编程语言中,这是否意味着在
matplotlib.pyplot
中导入style
模块会使style
成为matplotlib.pyplot
的属性?因为pyplot不是类,style
不能成为属性。它仍然是一个(子)模块。此子模块位于pyplot的命名空间中。