本文整理汇总了Python中matplotlib.pyplot.interactive方法的典型用法代码示例。如果您正苦于以下问题:Python pyplot.interactive方法的具体用法?Python pyplot.interactive怎么用?Python pyplot.interactive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.pyplot
的用法示例。
在下文中一共展示了pyplot.interactive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import interactive [as 别名]
def main():
import matplotlib.pyplot as plt
from .pncparse import pncparse
ifiles, options = pncparse(
has_ofile=True, plot_options=True, interactive=False)
if len(ifiles) != 1:
raise IOError(
'pncview can operate on only 1 file; user requested %d' %
len(ifiles))
ifile, = ifiles
plt.interactive(True)
for method_vars in options.plotcommands:
pieces = method_vars.split(',')
plotargs = [p for p in pieces if '=' not in p]
plotkwds = [p for p in pieces if '=' in p]
method, = plotargs[:1]
vars = plotargs[1:]
plotoptions = eval('OptionDict(outpath="%s",%s)' %
(options.outpath, ','.join(plotkwds)))
print(plotoptions.logscale)
plotwithopts(ifile, method, vars, plotoptions)
plt.interactive(False)
if len(options.plotcommands) == 0:
pncview(ifile, options)
示例2: plot_top
# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import interactive [as 别名]
def plot_top(df):
"""Plot stocks based on total score.
Args:
df(pandas.DataFrame): Stock score pandas.DataFrame
Returns:
Matplotlib plot with stocks and scores (broken down by score id)
"""
# Set styling
plt.style.use("seaborn-darkgrid")
plt.interactive(False)
# Custom Font - Download Apple's SF fonts for this to work
# Otherwise, should default to default font
plt.rcParams["font.family"] = "sans-serif"
plt.rcParams["font.sans-serif"] = "SF Pro Display"
# Plot DataFrame as bar chart
df.plot.bar()
# Plot labels
plt.ylabel("Score")
plt.xlabel("Tickers")
plt.title("Top {num} Stock Scores".format(num=len(df)))
plt.show(block=True)
示例3: set_mpl_interactive
# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import interactive [as 别名]
def set_mpl_interactive():
'''Ensure matplotlib is in interactive mode.'''
import matplotlib.pyplot as plt
if not plt.isinteractive():
plt.interactive(True)