本文整理汇总了Python中pylab.rcParams.update函数的典型用法代码示例。如果您正苦于以下问题:Python update函数的具体用法?Python update怎么用?Python update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plot5_1X
def plot5_1X(minor):
params = {'figure.figsize': [6.15, 5.0]}
rcParams.update(params)
reinforce_epsilon = mmread("./out/ex5_%d_reinforce_epsilon.mtx" % minor)
enac_epsilon = mmread("./out/ex5_%d_enac_epsilon.mtx" % minor)
reinforce_action_mean = \
mmread("./out/ex5_%d_reinforce_action_mean.mtx" % minor)
reinforce_action_std = \
mmread("./out/ex5_%d_reinforce_action_std.mtx" % minor)
enac_action_mean = mmread("./out/ex5_%d_enac_action_mean.mtx" % minor)
enac_action_std = mmread("./out/ex5_%d_enac_action_std.mtx" % minor)
actions = [
(reinforce_action_mean, reinforce_action_std, reinforce_epsilon,
"REINFORCE", "Sigma", None, None),
(enac_action_mean, enac_action_std, enac_epsilon,
"ENAC", "Sigma", None, None)
]
for ai in [0, 1]:
figure(ai)
plot_results(actions, ai, "Action (\%)", "Market Period")
if tex:
savefig('./out/fig5_%d_action_a%d.pdf' % (minor, ai + 1))
# savefig('./out/fig5_%d_action_a%d.eps' % (minor, ai + 1))
else:
savefig('./out/fig5_%d_action_a%d.png' % (minor, ai + 1))
示例2: __init__
def __init__(self, tm, showOverlaps=False, showOverlapsValues=False):
self.tm = tm
self.showOverlaps = showOverlaps
self.showOverlapsValues = showOverlapsValues
self.encodings = []
self.resets = []
self.numSegmentsPerCell = []
self.numSynapsesPerSegment = []
import matplotlib.pyplot as plt
self.plt = plt
import matplotlib.cm as cm
self.cm = cm
from pylab import rcParams
if self.showOverlaps and self.showOverlapsValues:
rcParams.update({'figure.figsize': (20, 20)})
else:
rcParams.update({'figure.figsize': (6, 12)})
rcParams.update({'figure.autolayout': True})
rcParams.update({'figure.facecolor': 'white'})
rcParams.update({'ytick.labelsize': 8})
示例3: do_plot
def do_plot(date, flux, status=0):
xmin = min(date)
xmax = max(date)
ymin = min(flux)
ymax = max(flux)
xr = xmax - xmin
yr = ymax - ymin
try:
params = {
"backend": "png",
"axes.linewidth": 2.5,
"axes.labelsize": 24,
"axes.font": "sans-serif",
"axes.fontweight": "bold",
"text.fontsize": 12,
"legend.fontsize": 12,
"xtick.labelsize": 16,
"ytick.labelsize": 16,
}
rcParams.update(params)
except:
print("ERROR -- KEPCLIP: install latex for scientific plotting")
status = 1
if status == 0:
# plt.figure(figsize=[12,5])
plt.clf()
# plt.axes([0.2,0.2,0.94,0.88])
# ltime = [date[0]]; ldata = [flux[0]]
# for i in range(1,len(flux)):
# if (date[i-1] > date[i] - 0.025):
# ltime.append(date[i])
# ldata.append(flux[i])
# else:
# ltime = n.array(ltime, dtype='float64')
# ldata = n.array(ldata, dtype='float64')
# plt.plot(ltime,ldata,color='#0000ff',linestyle='-'
# ,linewidth=1.0)
# ltime = []; ldata = []
# ltime = n.array(ltime, dtype='float64')
# ldata = n.array(ldata, dtype='float64')
plt.plot(date, flux, color="#0000ff", linestyle="-", linewidth=1.0)
date = n.insert(date, [0], [date[0]])
date = n.append(date, [date[-1]])
flux = n.insert(flux, [0], [0.0])
flux = n.append(flux, [0.0])
plt.fill(date, flux, fc="#ffff00", linewidth=0.0, alpha=0.2)
plt.xlim(xmin - xr * 0.01, xmax + xr * 0.01)
if ymin - yr * 0.01 <= 0.0:
plt.ylim(1.0e-10, ymax + yr * 0.01)
else:
plt.ylim(ymin - yr * 0.01, ymax + yr * 0.01)
xlab = "BJD"
ylab = "e- / cadence"
plt.xlabel(xlab, {"color": "k"})
plt.ylabel(ylab, {"color": "k"})
plt.ion()
plt.grid()
plt.ioff()
示例4: SetForEps
def SetForEps(proport=0.75, fig_width_pt=455.24, xylabel_fs=9, leg_fs=8, text_fs=9, xtick_fs=7, ytick_fs=7):
"""
Set figure proportions
======================
"""
# fig_width_pt = 455.24411 # Get this from LaTeX using \showthe\columnwidth
inches_per_pt = 1.0/72.27 # Convert pt to inch
fig_width = fig_width_pt*inches_per_pt # width in inches
fig_height = fig_width*proport # height in inches
fig_size = [fig_width,fig_height]
#params = {'mathtext.fontset':'stix', # 'cm', 'stix', 'stixsans', 'custom'
params = {
'backend' : 'ps',
'axes.labelsize' : xylabel_fs,
'font.size' : text_fs,
'legend.fontsize' : leg_fs,
'xtick.labelsize' : xtick_fs,
'ytick.labelsize' : ytick_fs,
'text.usetex' : True, # very IMPORTANT to avoid Type 3 fonts
'ps.useafm' : True, # very IMPORTANT to avoid Type 3 fonts
'pdf.use14corefonts' : True, # very IMPORTANT to avoid Type 3 fonts
'figure.figsize' : fig_size,
}
MPLclose()
rcdefaults()
rcParams.update(params)
示例5: pylab_setup
def pylab_setup():
from pylab import rcParams
params = {'backend': 'qt',
'axes.labelsize': 8,
'text.fontsize': 8,
'legend.fontsize': 10,
'xtick.labelsize': 8,
'ytick.labelsize': 8}
rcParams.update(params)
示例6: do_plot
def do_plot(date,flux,status=0):
xmin = min(date)
xmax = max(date)
ymin = min(flux)
ymax = max(flux)
xr = xmax - xmin
yr = ymax - ymin
try:
params = {'backend': 'png','axes.linewidth': 2.5,
'axes.labelsize': 24,
'axes.font': 'sans-serif',
'axes.fontweight' : 'bold',
'text.fontsize': 12,
'legend.fontsize': 12,
'xtick.labelsize': 16,
'ytick.labelsize': 16}
rcParams.update(params)
except:
print 'ERROR -- KEPCLIP: install latex for scientific plotting'
status = 1
if status == 0:
# plt.figure(figsize=[12,5])
plt.clf()
# plt.axes([0.2,0.2,0.94,0.88])
# ltime = [date[0]]; ldata = [flux[0]]
# for i in range(1,len(flux)):
# if (date[i-1] > date[i] - 0.025):
# ltime.append(date[i])
# ldata.append(flux[i])
# else:
# ltime = n.array(ltime, dtype='float64')
# ldata = n.array(ldata, dtype='float64')
# plt.plot(ltime,ldata,color='#0000ff',linestyle='-'
# ,linewidth=1.0)
# ltime = []; ldata = []
# ltime = n.array(ltime, dtype='float64')
# ldata = n.array(ldata, dtype='float64')
plt.plot(date,flux,color='#0000ff',linestyle='-',linewidth=1.0)
date = n.insert(date,[0],[date[0]])
date = n.append(date,[date[-1]])
flux = n.insert(flux,[0],[0.0])
flux = n.append(flux,[0.0])
plt.fill(date,flux,fc='#ffff00',linewidth=0.0,alpha=0.2)
plt.xlim(xmin-xr*0.01,xmax+xr*0.01)
if ymin-yr*0.01 <= 0.0:
plt.ylim(1.0e-10,ymax+yr*0.01)
else:
plt.ylim(ymin-yr*0.01,ymax+yr*0.01)
xlab = 'BJD'
ylab = 'e- / cadence'
plt.xlabel(xlab, {'color' : 'k'})
plt.ylabel(ylab, {'color' : 'k'})
plt.ion()
plt.grid()
plt.ioff()
示例7: galplot6
def galplot6():
MatPlotParams = {'axes.titlesize': 12, 'axes.linewidth' : 1.0, 'axes.labelsize': 12, 'xtick.labelsize': 10, 'ytick.labelsize': 10, 'xtick.major.size': 12, 'ytick.major.size' : 12, 'xtick.minor.size': 10, 'ytick.minor.size': 10, 'figure.figsize' : [10.0, 10.5], 'xtick.major.pad' : 6, 'ytick.major.pad' : 6, 'figure.subplot.hspace' : 0.0,'legend.fontsize': 10}
rcParams.update(MatPlotParams)
pylab.subplots_adjust(left = 0.2, # the left side of the subplots of the figure
right = 0.8, # the right side of the subplots of the figure
bottom = 0.1,#.05 # the bottom of the subplots of the figure
top = 0.95, # the top of the subplots of the figure
wspace = 0.30, # the amount of width reserved for blank space between subplots
hspace = 0.45)#.15 # the amount of height reserved for white space between subplots
示例8: matrc4X6
def matrc4X6():
MatPlotParams = {'axes.titlesize': 12, 'axes.linewidth' : 1.0, 'axes.labelsize': 12, 'xtick.labelsize': 10, 'ytick.labelsize': 10, 'xtick.major.size': 12, 'ytick.major.size' : 12, 'xtick.minor.size': 10, 'ytick.minor.size': 10, 'figure.figsize' : [12.0, 10.0], 'xtick.major.pad' : 6, 'ytick.major.pad' : 4, 'figure.subplot.hspace' : 0.0}
rcParams.update(MatPlotParams)
pylab.subplots_adjust(left = 0.07, # the left side of the subplots of the figure
right = 0.97, # the right side of the subplots of the figure
bottom = 0.05, # the bottom of the subplots of the figure
top = 0.95, # the top of the subplots of the figure
wspace = 0.15, # the amount of width reserved for blank space between subplots
hspace = 0.15) # the amount of height reserved for white space between subplots
示例9: imsave
def imsave( filename, data, **kwargs ):
figsize = (pylab.array(data.shape)/100.0)[::-1]
rcParams.update( {'figure.figsize':figsize} )
fig = pylab.figure( figsize=figsize )
pylab.axes( [0,0,1,1] )
pylab.axis( 'off' )
fig.set_size_inches( figsize )
pylab.imshow( data, origin='lower', **kwargs )
pylab.savefig( filename, facecolor='black', edgecolor='black', dpi=100 )
pylab.close( fig )
示例10: graphEpocs
def graphEpocs(self):
"""Graph the average k-fold training and test error for all tested epocs"""
rcParams.update(self._PRAMS)
plot(self.epocsRange, self.epocsErrors[0], 'r-', label="Training Error", linewidth=2)
plot(self.epocsRange, self.epocsErrors[1], 'b-', label="Test Error", linewidth=2)
xlabel('Number Epocs')
ylabel('Error')
title('Epocs vs Error')
legend()
show()
示例11: mhd_shocktube
def mhd_shocktube(P, x=(0,1), **kwargs):
from pylab import sqrt, linspace, subplot, plot, text, xlabel, figure, show
from pylab import subplots_adjust, setp, gca, LinearLocator, rcParams, legend
rho, pre = P[:,0], P[:,1]
vx, vy, vz = P[:,2], P[:,3], P[:,4]
Bx, By, Bz = P[:,5], P[:,6], P[:,7]
plot_args = { }
plot_args['marker'] = kwargs.get('marker', 'o')
plot_args['c' ] = kwargs.get('c' , 'k')
plot_args['mfc' ] = kwargs.get('mfc' , 'None')
plot_args.update(kwargs)
rcParams.update({'axes.labelsize':16, 'ytick.major.pad':8})
X = linspace(x[0],x[1],P.shape[0])
g = 1 / sqrt(1-(vx**2+vy**2+vz**2))
ax = subplot(2,3,1)
plot(X,rho, **plot_args)
text(0.9,0.85, r"$\rho$", transform = ax.transAxes, fontsize=20)
setp(ax.get_xticklabels(), visible=False)
if 'label' in plot_args: legend(loc='upper left')
ax = subplot(2,3,2)
plot(X,pre, **plot_args)
text(0.9,0.85, r"$P$", transform = ax.transAxes, fontsize=20)
setp(ax.get_xticklabels(), visible=False)
ax = subplot(2,3,3)
plot(X, g, **plot_args)
text(0.9,0.85, r"$\gamma$", transform = ax.transAxes, fontsize=20)
setp(ax.get_xticklabels(), visible=False)
ax = subplot(2,3,4)
plot(X, vx, **plot_args)
text(0.9,0.85, r"$v_x$", transform = ax.transAxes, fontsize=20)
xlabel(r"$x$")
ax = subplot(2,3,5)
plot(X, vy, **plot_args)
text(0.9,0.85, r"$v_y$", transform = ax.transAxes, fontsize=20)
xlabel(r"$x$")
ax = subplot(2,3,6)
plot(X, By, **plot_args)
text(0.9,0.85, r"$B_y$", transform = ax.transAxes, fontsize=20)
xlabel(r"$x$")
subplots_adjust(hspace=0.15)
示例12: SetFontSize
def SetFontSize(xylabel_fs=9, leg_fs=8, text_fs=9, xtick_fs=7, ytick_fs=7):
"""
Set font sizes
==============
"""
params = {
"axes.labelsize": xylabel_fs,
"legend.fontsize": leg_fs,
"font.size": text_fs,
"xtick.labelsize": xtick_fs,
"ytick.labelsize": ytick_fs,
}
rcParams.update(params)
示例13: SetFontSize
def SetFontSize(xylabel_fs=9, leg_fs=8, text_fs=9, xtick_fs=7, ytick_fs=7):
"""
Set font sizes
==============
"""
params = {
'axes.labelsize' : xylabel_fs,
'legend.fontsize' : leg_fs,
'font.size' : text_fs,
'xtick.labelsize' : xtick_fs,
'ytick.labelsize' : ytick_fs,
}
rcParams.update(params)
示例14: pub_plots
def pub_plots(xmaj = 5, xmin = 1, xstr = '%03.2f', ymaj = 5, ymin = 1, ystr = '%d'):
MatPlotParams = {'axes.yaxis.labelpad': 10,'axes.xaxis.labelpad': 10, 'axes.titlesize': 10, 'axes.linewidth' : 1.5, 'axes.labelsize': 10, 'xtick.labelsize': 10, 'ytick.labelsize': 10, 'xtick.major.size': 8, 'ytick.major.size' : 8, 'xtick.minor.size': 4, 'ytick.minor.size': 4, 'xtick.major.pad' : 6, 'ytick.major.pad' : 6}
rcParams.update(MatPlotParams)
xmajLocator = MultipleLocator(xmaj)
xmajFormatter = FormatStrFormatter(xstr)
xminLocator = MultipleLocator(xmin)
ymajLocator = MultipleLocator(ymaj)
ymajFormatter = FormatStrFormatter(ystr)
yminLocator = MultipleLocator(ymin)
data_holder = plot_dats(xmajLocator, xmajFormatter, xminLocator, ymajLocator,
ymajFormatter, yminLocator)
return data_holder
示例15: DrawCrossover
def DrawCrossover(A, B, a, b, pos):
"""
DrawCrossover draws crossover process
"""
rcParams.update({'figure.figsize':[800/72.27,400/72.27]})
DrawChromo('A', A, pos, 0.35, 0)
DrawChromo('B', B, pos, 0.25, 1)
DrawChromo('a', a, pos, 0.10, 0, blue='#e3a9a9')
DrawChromo('b', b, pos, 0.00, 0, red='#c8d0e3')
axis('equal')
axis([0, 1.2, 0, 0.4])
gca().get_yaxis().set_visible(False)
gca().get_xaxis().set_visible(False)
for dir in ['left', 'right', 'top', 'bottom']:
gca().spines[dir].set_visible(False)
gca().add_patch(FancyArrowPatch([0.6,0.25], [0.6, 0.2], fc='#9fffde', mutation_scale=30))