本文整理匯總了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)