本文整理汇总了Python中matplotlib.pyplot.getp函数的典型用法代码示例。如果您正苦于以下问题:Python getp函数的具体用法?Python getp怎么用?Python getp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: plotStreamLine
def plotStreamLine(x,y,U,V,nIter):
pltFile = 'streamLine_%5.5d.png' % int(nIter)
x = np.asarray(x)
y = np.asarray(y)
U = np.swapaxes(U,1,0)
V = np.swapaxes(V,1,0)
strm = plt.streamplot(x,y,U,V, color='k', density=1, linewidth=1)
plt.axis([x.min(), x.max(), y.min(), y.max()])
plt.xscale('linear')
plt.yscale('linear')
plt.xlabel('x [m]', fontsize=18)
plt.ylabel('y [m]', fontsize=18)
plt.grid(True)
ax = plt.gca()
xlabels = plt.getp(ax, 'xticklabels')
ylabels = plt.getp(ax, 'yticklabels')
plt.setp(xlabels, fontsize=10)
plt.setp(ylabels, fontsize=10)
fig = plt.gcf()
fig.set_size_inches(5,6)
plt.tight_layout()
plt.savefig(pltFile, format='png')
plt.close()
print "%s DONE!!" % (pltFile)
plt.show()
开发者ID:sayop,项目名称:CFM03,代码行数:29,代码来源:post.py
示例2: plot_counts
def plot_counts(ax, dictorigin, x_locator, x_formatter, bin_edges_in, snum, enum):
# compute all data needed
time = dictorigin["time"]
cumcounts = np.arange(1, np.alen(time) + 1)
if len(bin_edges_in) < 2:
return
binsize = bin_edges_in[1] - bin_edges_in[0]
binsize_str = binsizelabel(binsize)
# plot
counts, bin_edges_out, patches = ax.hist(
time, bin_edges_in, cumulative=False, histtype="bar", color="black", edgecolor=None
)
ax.grid(True)
ax.xaxis_date()
plt.setp(ax.get_xticklabels(), rotation=90, horizontalalignment="center", fontsize=7)
ax.set_ylabel("# Earthquakes\n%s" % binsize_str, fontsize=8)
ax.xaxis.set_major_locator(x_locator)
ax.xaxis.set_major_formatter(x_formatter)
if snum and enum:
ax.set_xlim(snum, enum)
ax2 = ax.twinx()
p2, = ax2.plot(time, cumcounts, "g", lw=2.5)
ax2.yaxis.get_label().set_color(p2.get_color())
ytl_obj = plt.getp(ax2, "yticklabels") # get the properties for yticklabels
# plt.getp(ytl_obj) # print out a list of properties
plt.setp(ytl_obj, color="g") # set the color of yticks to red
plt.setp(plt.getp(ax2, "yticklabels"), color="g") # xticklabels: same
ax2.set_ylabel("Cumulative\n# Earthquakes", fontsize=8)
ax2.xaxis.set_major_locator(x_locator)
ax2.xaxis.set_major_formatter(x_formatter)
if snum and enum:
ax2.set_xlim(snum, enum)
return
开发者ID:gthompson,项目名称:python_gt,代码行数:35,代码来源:modgiseis.py
示例3: plotTempContour
def plotTempContour(x,y,T,nIter):
from matplotlib import mlab, cm
cmap = cm.PRGn
pltFile = 'contour_Temp_%5.5d.png' % int(nIter)
x = np.asarray(x)
y = np.asarray(y)
phiMin = T.min()
phiMax = T.max()
plt.imshow(T, vmin=phiMin, vmax=phiMax, extent=[x.min(), x.max(), y.min(), y.max()])
plt.colorbar()
plt.xscale('linear')
plt.yscale('linear')
plt.xlabel('x', fontsize=18)
plt.ylabel('y', fontsize=18)
#plt.grid(True)
ax = plt.gca()
xlabels = plt.getp(ax, 'xticklabels')
ylabels = plt.getp(ax, 'yticklabels')
plt.setp(xlabels, fontsize=15)
plt.setp(ylabels, fontsize=15)
fig = plt.gcf()
fig.set_size_inches(9,5)
plt.tight_layout()
plt.savefig(pltFile, format='png')
plt.close()
print "%s DONE!!" % (pltFile)
plt.show()
开发者ID:sayop,项目名称:CFM-Final,代码行数:33,代码来源:post.py
示例4: insax
def insax(ax, i, j, h, w, **kwargs):
"""
Axes spanning upper left spij(m,n,i,j) to lower right spij(m,n,i+h-1,j+w-1).
ax is a (nrow, ncol) array of Axes.
Example (using a new figure to avoid interference with any existing figure
objects).
>>> fig = plt.figure()
>>> ax = np.array([plt.subplot(4, 4, i) for i in range(1, 17)],
... object).reshape(4, 4)
>>> pos = getp(insax(ax, 1, 1, 2, 2), "position")
>>> print str(pos).replace("'", "")
Bbox(array([[ 0.32717391, 0.30869565],...[ 0.69782609, 0.69130435]]))
"""
(left, _), (_, top) = getp(ax[i, j], "position").get_points()
(_, bottom), (right, _) = getp(ax[i+h-1, j+w-1], "position").get_points()
# (left, _), (_, top) = getp(spij(m, n, i, j), "position").get_points()
# (_, bottom), (right, _) = getp(
# spij(m, n, i+h, j+w), "position").get_points()
width = right - left
height = top - bottom
ax = plt.gcf().add_axes([left, bottom, width, height], **kwargs)
return ax
开发者ID:argju,项目名称:cgptoolbox,代码行数:25,代码来源:splom.py
示例5: fplotly
def fplotly(fig, username, api_key):
axes = fig.axes
lines = axes[0].lines
xdata = plt.getp(lines[0], 'xdata')
ydata = plt.getp(lines[0], 'ydata')
py = plotly.plotly(username, api_key)
py.plot(xdata,ydata)
开发者ID:theengineear,项目名称:wrapper,代码行数:7,代码来源:plot_sin.py
示例6: plotContour
def plotContour(x,y,phi,pltFile):
xi, yi = np.meshgrid(x, y)
zi = phi
plt.imshow(zi, vmin=zi.min(), vmax=0.075, origin='lower', extent=[x.min(), x.max(), y.min(), y.max()])
plt.colorbar()
plt.xscale('linear')
plt.yscale('linear')
plt.xlabel('x', fontsize=18)
plt.ylabel('y', fontsize=18)
plt.grid(True)
ax = plt.gca()
xlabels = plt.getp(ax, 'xticklabels')
ylabels = plt.getp(ax, 'yticklabels')
plt.setp(xlabels, fontsize=15)
plt.setp(ylabels, fontsize=15)
fig = plt.gcf()
fig.set_size_inches(6,5)
plt.tight_layout()
plt.savefig(pltFile, format='png')
plt.close()
print "%s DONE!!" % (pltFile)
plt.show()
开发者ID:sayop,项目名称:CFM01,代码行数:26,代码来源:post.py
示例7: plot_energy
def plot_energy(ax, dictorigin, x_locator, x_formatter, bin_edges, snum, enum):
# compute all data needed
time = dictorigin["time"]
energy = ml2energy(dictorigin["ml"])
cumenergy = np.cumsum(energy)
binned_energy = bin_irregular(time, energy, bin_edges)
if len(bin_edges) < 2:
return
barwidth = bin_edges[1:] - bin_edges[0:-1]
binsize = bin_edges[1] - bin_edges[0]
binsize_str = binsizelabel(binsize)
# plot
ax.bar(bin_edges[:-1], binned_energy, width=barwidth, color="black", edgecolor=None)
# re-label the y-axis in terms of equivalent Ml rather than energy
yticklocs1 = ax.get_yticks()
ytickvalues1 = np.log10(yticklocs1) / 1.5
yticklabels1 = list()
for count in range(len(ytickvalues1)):
yticklabels1.append("%.2f" % ytickvalues1[count])
ax.set_yticks(yticklocs1)
ax.set_yticklabels(yticklabels1)
ax.grid(True)
ax.xaxis_date()
plt.setp(ax.get_xticklabels(), rotation=90, horizontalalignment="center", fontsize=7)
ax.set_ylabel("Energy %s\n(unit: Ml)" % binsize_str, fontsize=8)
ax.xaxis.set_major_locator(x_locator)
ax.xaxis.set_major_formatter(x_formatter)
if snum and enum:
ax.set_xlim(snum, enum)
# Now add the cumulative energy plot - again with yticklabels as magnitudes
ax2 = ax.twinx()
p2, = ax2.plot(time, cumenergy, "g", lw=2.5)
# use the same ytick locations as for the left-hand axis, but label them in terms of equivalent cumulative magnitude
yticklocs1 = ax.get_yticks()
yticklocs2 = (yticklocs1 / max(ax.get_ylim())) * max(ax2.get_ylim())
ytickvalues2 = np.log10(yticklocs2) / 1.5
yticklabels2 = list()
for count in range(len(ytickvalues2)):
yticklabels2.append("%.2f" % ytickvalues2[count])
ax2.set_yticks(yticklocs2)
ax2.set_yticklabels(yticklabels2)
ax2.yaxis.get_label().set_color(p2.get_color())
ytl_obj = plt.getp(ax2, "yticklabels") # get the properties for yticklabels
# plt.getp(ytl_obj) # print out a list of properties
plt.setp(ytl_obj, color="g") # set the color of yticks to red
plt.setp(plt.getp(ax2, "yticklabels"), color="g") # xticklabels: same
ax2.set_ylabel("Cumulative Energy\n(unit: Ml)", fontsize=8)
ax2.xaxis.set_major_locator(x_locator)
ax2.xaxis.set_major_formatter(x_formatter)
if snum and enum:
ax2.set_xlim(snum, enum)
return
开发者ID:gthompson,项目名称:python_gt,代码行数:59,代码来源:modgiseis.py
示例8: plot_trace
def plot_trace(self, elec, raw = 'CAR', Params = dict()):
"""
plots trace for the trial duration using TrialsMTX
INPUT:
elec - electrode number
raw - if to calculate from raw trace ('CAR') or from hilbert ('hilbert') - optional, default 'CAR'
Params - dictionary of onset/offset times for trial and for baseline. (optional)
"""
#default Params
if not Params: #empty dict
print 'loading default Params'
Params['st'] = 0 #start time point (ms)
Params['en'] = 3000 #end time point (ms)
Params['bl_st'] = -250 #baseline start (ms)
Params['bl_en'] = -50 #basline end (ms)
dataMTX = self.makeTrialsMTX(elec, raw, Params)
st = int(round(Params['st'] / 1000 * self.srate))
en = int(round(Params['en'] / 1000 * self.srate))
bl_st = int(round(Params['bl_st'] / 1000 * self.srate))
bl_en = int(round(Params['bl_en'] / 1000 * self.srate))
x = np.arange(st, en)
plot_tp = 250 / 1000 * self.srate #ticks every 250 ms
cue = 500 / 1000 * self.srate
f, ax = plt.subplots(1,1)
ax.axhline(y = 0,color = 'k',linewidth=2)
ax.axvline(x = 0,color='k',linewidth=2)
ax.axvline(x = cue,color = 'gray',linewidth = 2)
ax.axvline(x = cue+cue,color = 'gray',linewidth = 2)
ax.axvspan(cue, cue+cue, facecolor='0.5', alpha=0.25,label = 'cue')
ax.plot(x, np.mean(dataMTX,0), linewidth = 2, color = 'blue')
ax.set_xlim(st, en)
ax.xaxis.set_ticklabels(['0', '','500', '', '1000', '', '1500', '', '2000','','2500','', '3000'],minor=False)
ax.xaxis.set_ticks(np.arange(st, en, plot_tp))
ax.xaxis.set_tick_params(labelsize = 14)
ax.yaxis.set_tick_params(labelsize=14)
xticklabels = plt.getp(plt.gca(), 'xticklabels')
yticklabels = plt.getp(plt.gca(), 'yticklabels')
plt.setp(xticklabels, fontsize=14, weight='bold')
plt.setp(yticklabels, fontsize=14, weight='bold')
for pos in ['top','bottom','right','left']:
ax.spines[pos].set_edgecolor('gray')
ax.get_xaxis().tick_bottom()
ax.get_yaxis().tick_left()
ax.set_xlabel("time (ms)")
ax.set_ylabel("uV")
ax.set_title('raw trace - electrode: %i' %(elec), fontsize = 18)
plt.show()
开发者ID:matarhaller,项目名称:Seminar,代码行数:56,代码来源:subj_globals.py
示例9: display2Dpointsets
def display2Dpointsets(A, B):
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(A[:,0],A[:,1],'yo',markersize=8,mew=1)
ax.plot(B[:,0],B[:,1],'b+',markersize=8,mew=1)
labels = plt.getp(plt.gca(), 'xticklabels')
plt.setp(labels, color='k', fontweight='bold')
labels = plt.getp(plt.gca(), 'yticklabels')
plt.setp(labels, color='k', fontweight='bold')
return None
开发者ID:YidiCao,项目名称:RPSR,代码行数:10,代码来源:_plotting.py
示例10: make_positivity_plot
def make_positivity_plot(nga,fileNameList,cd3ChanIndex,figName,emResults,subset='CD3',filterID=None):
filesToPlot = fileNameList
if len(fileNameList) > 6:
filesToPlot = fileNameList[:6]
fig = plt.figure()
fontSize = 8
pltCount = 0
for fileName in filesToPlot:
events = nga.get_events(fileName)
if filterID != None:
filterIndices = nga.get_filter_indices(fileName,filterID)
events = events[filterIndices,:]
cd3Events = events[:,cd3ChanIndex]
pltCount+=1
if pltCount > 6:
continue
ax = fig.add_subplot(2,3,pltCount)
eCDF = EmpiricalCDF(cd3Events)
thresholdLow = eCDF.get_value(0.05)
eventsInHist = cd3Events[np.where(cd3Events > thresholdLow)[0]]
n, bins, patches = ax.hist(eventsInHist,18,normed=1,facecolor='gray',alpha=0.5)
maxX1 = cd3Events.max()
maxX2 = cd3Events.max()
pdfX1 = np.linspace(0,maxX1,300)
pdfY1 = stats.norm.pdf(pdfX1,emResults[fileName]['params']['mu1'], np.sqrt(emResults[fileName]['params']['sig1']))
pdfX2 = np.linspace(0,maxX2,300)
pdfY2 = stats.norm.pdf(pdfX2,emResults[fileName]['params']['mu2'], np.sqrt(emResults[fileName]['params']['sig2']))
pdfY1 = pdfY1 * (1.0 - emResults[fileName]['params']['pi'])
pdfY1[np.where(pdfY1 < 0)[0]] = 0.0
pdfY2 = pdfY2 * emResults[fileName]['params']['pi']
pdfY2[np.where(pdfY2 < 0)[0]] = 0.0
ax.plot(pdfX1, pdfY1, 'k-', linewidth=2)
ax.plot(pdfX2, pdfY2, 'k-', linewidth=2)
threshY = np.linspace(0,max([max(pdfY1),max(pdfY2)]),100)
threshX = np.array([emResults[fileName]['cutpoint']]).repeat(100)
ax.plot(threshX, threshY, 'r-', linewidth=2)
ax.set_title(fileName,fontsize=9)
xticklabels = plt.getp(plt.gca(),'xticklabels')
yticklabels = plt.getp(plt.gca(),'yticklabels')
plt.setp(xticklabels, fontsize=fontSize-1)
plt.setp(yticklabels, fontsize=fontSize-1)
ax.set_xlabel(round(emResults[fileName]['params']['likelihood']))
ax.set_xticks([])
fig.subplots_adjust(hspace=0.3,wspace=0.3)
plt.savefig(figName)
开发者ID:ajrichards,项目名称:cytostream,代码行数:55,代码来源:Thresholds.py
示例11: display2Dpointset
def display2Dpointset(A):
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(A[:,0],A[:,1],'yo',markersize=8,mew=1)
labels = plt.getp(plt.gca(), 'xticklabels')
plt.setp(labels, color='k', fontweight='bold')
labels = plt.getp(plt.gca(), 'yticklabels')
plt.setp(labels, color='k', fontweight='bold')
for i,x in enumerate(A):
ax.annotate('%d'%(i+1), xy = x, xytext = x + 0)
return None
开发者ID:YidiCao,项目名称:RPSR,代码行数:11,代码来源:_plotting.py
示例12: plotSolution
def plotSolution(time):
x = domainVars.x
phi = flowVars.phi
exac = flowVars.exac
imax = len(phi)
pltFile = 'solution_%5.3f.png' % float(time)
MinX = min(x)
MaxX = max(x)
MinY = -0.1#min(phi)
MaxY = 1.0#1.1*max(phi)
p = plt.plot(x,phi, 'k-', label='Numerical solution')
p = plt.plot(x,exac, 'r--', label='Exact solution')
plt.setp(p, linewidth='3.0')
plt.axis([MinX,MaxX, MinY, MaxY])
plt.xscale('linear')
plt.yscale('linear')
plt.xlabel('x', fontsize=22)
plt.ylabel('phi', fontsize=22)
plt.grid(True)
#plt.text(0.01, 0.2, 'Grid size = %s' % len(phi), fontsize=22 )
ax = plt.gca()
xlabels = plt.getp(ax, 'xticklabels')
ylabels = plt.getp(ax, 'yticklabels')
plt.setp(xlabels, fontsize=18)
plt.setp(ylabels, fontsize=18)
plt.legend(
loc='upper right',
borderpad=0.25,
handletextpad=0.25,
borderaxespad=0.25,
labelspacing=0.0,
handlelength=2.0,
numpoints=1)
legendText = plt.gca().get_legend().get_texts()
plt.setp(legendText, fontsize=18)
legend = plt.gca().get_legend()
legend.draw_frame(False)
fig = plt.gcf()
fig.set_size_inches(8,5)
plt.tight_layout()
plt.savefig(pltFile, format='png')
plt.close()
print "%s DONE!!" % (pltFile)
# write a CSVfile
csvFile = 'solution_%5.3f.csv' % float(time)
writeCSV(csvFile,x,phi,exac)
开发者ID:sayop,项目名称:CFM02,代码行数:52,代码来源:post.py
示例13: _update_segment
def _update_segment(self):
segments = self.marker.get_segments()
segments[0][0, 0] = self.get_data_position('x1')
segments[0][1, 0] = segments[0][0, 0]
if self.get_data_position('y1') is None:
segments[0][0, 1] = plt.getp(self.marker.axes, 'ylim')[0]
else:
segments[0][0, 1] = self.get_data_position('y1')
if self.get_data_position('y2') is None:
segments[0][1, 1] = plt.getp(self.marker.axes, 'ylim')[1]
else:
segments[0][1, 1] = self.get_data_position('y2')
self.marker.set_segments(segments)
开发者ID:jerevon,项目名称:hyperspy,代码行数:13,代码来源:vertical_line_segment.py
示例14: display2Dpointsets
def display2Dpointsets(A, B, ax = None):
""" display a pair of 2D point sets """
if not ax:
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(A[:,0],A[:,1],'yo',markersize=8,mew=1)
ax.plot(B[:,0],B[:,1],'b+',markersize=8,mew=1)
#pylab.setp(pylab.gca(), 'xlim', [-0.15,0.6])
labels = plt.getp(plt.gca(), 'xticklabels')
plt.setp(labels, color='k', fontweight='bold')
labels = plt.getp(plt.gca(), 'yticklabels')
plt.setp(labels, color='k', fontweight='bold')
开发者ID:alxio,项目名称:gmmreg,代码行数:13,代码来源:_plotting.py
示例15: set_ticks_fontsize
def set_ticks_fontsize(fontsize, colbar=None):
""" Change the fontsize of the tick labels for the current figure.
If colorbar (Colorbar instance) is provided then change the fontsize of its
tick labels as well.
"""
yticklabels = plt.getp(plt.gca(), 'yticklabels')
plt.setp(yticklabels, 'color', 'k', fontsize=fontsize)
xticklabels = plt.getp(plt.gca(), 'xticklabels')
plt.setp(xticklabels, 'color', 'k', fontsize=fontsize)
if colbar is not None:
ticklabels = plt.getp(colbar.ax, 'yticklabels')
plt.setp(ticklabels, 'color', 'k', fontsize=fontsize)
开发者ID:Solvi,项目名称:pyhrf,代码行数:14,代码来源:plot.py
示例16: plot_vj_joint_dist
def plot_vj_joint_dist( handle, savefilename="VJusage", tags_v = open("tags_trbv.txt", "rU"), tags_j = open("tags_trbj.txt", "rU")):
## PLOTS VJ JOINT GENE USAGE BASED ON A FILE OF CLASSIFIERS
import numpy as np
import matplotlib.pyplot as plt
import string
import decimal as dec
num_v = 0
for line in tags_v:
num_v += 1
num_j = 0
for line in tags_j:
num_j += 1
joint_distribution = np.zeros((num_v,num_j))
for line in handle:
elements = line.rstrip("\n")
v = int(string.split(elements)[0])
j = int(string.split(elements)[1])
joint_distribution[v,j] += 1
joint_distribution = joint_distribution / sum(sum(joint_distribution))
gene_list_v = ('V10-1', 'V10-2', 'V10-3', 'V11-1', 'V11-2', 'V11-3', 'V12-3/V12-4', 'V12-5', 'V13', 'V14', 'V15', 'V16', 'V18', 'V19', 'V2', 'V20-1', 'V24-1', 'V25-1', 'V27-1', 'V28-1', 'V29-1', 'V3-1', 'V30-1', 'V4-1', 'V4-2', 'V4-3', 'V5-1', 'V5-4', 'V5-5', 'V5-6', 'V5-8', 'V6-1', 'V6-4', 'V6-5', 'V6-6', 'V6-8', 'V6-9', 'V7-2', 'V7-3', 'V7-4', 'V7-6', 'V7-7', 'V7-8', 'V7-9', 'V9')
gene_list_j = ('J1-1', 'J1-2', 'J1-3', 'J1-4', 'J1-5', 'J1-6', 'J2-1', 'J2-2', 'J2-3', 'J2-4', 'J2-5', 'J2-6', 'J2-7')
pos_v = np.arange(num_v)+ 1
pos_j = np.arange(num_j)+ 1
plt.figure()
plt.pcolor(joint_distribution)
pos_ticks_v = pos_v-0.5
pos_ticks_j = pos_j-0.5
plt.yticks( pos_ticks_v, gene_list_v)
plt.xticks( pos_ticks_j, gene_list_j)
plt.colorbar()
plt.pcolor(joint_distribution)
yticklabels = plt.getp(plt.gca(), 'yticklabels')
plt.setp(yticklabels, fontsize='8')
xticklabels = plt.getp(plt.gca(), 'xticklabels')
plt.setp(xticklabels, fontsize='8')
plt.savefig(str(savefilename)+'.png', dpi=300)
handle.close()
tags_v.close()
tags_j.close()
开发者ID:xshang,项目名称:Decombinator,代码行数:50,代码来源:plot_functions.py
示例17: plotSolutions
def plotSolutions(x,phi,exact):
imax = len(x)
pltFile = 'prob1Solution.png'
#MinX = min(x)
#MaxX = max(x)
#MinY = min(exact)
#MaxY = 1.1*max(phi)
MinX = 0.65
MaxX = 0.9*max(x)
MinY = 0.6
MaxY = 1.0
p = plt.plot(x,phi, 'k-', label='Numerical solution')
plt.setp(p, linewidth='3.0')
p = plt.plot(x,exact, 'r--', label='Analytical solution')
plt.setp(p, linewidth='3.0')
plt.axis([MinX,MaxX, MinY, MaxY])
plt.xscale('linear')
plt.yscale('linear')
plt.xlabel('x', fontsize=22)
plt.ylabel('phi', fontsize=22)
plt.grid(True)
plt.text(0.67, 0.7, 'Grid size = %s' % len(phi), fontsize=22 )
ax = plt.gca()
xlabels = plt.getp(ax, 'xticklabels')
ylabels = plt.getp(ax, 'yticklabels')
plt.setp(xlabels, fontsize=18)
plt.setp(ylabels, fontsize=18)
plt.legend(
loc='lower left',
borderpad=0.25,
handletextpad=0.25,
borderaxespad=0.25,
labelspacing=0.0,
handlelength=2.0,
numpoints=1)
legendText = plt.gca().get_legend().get_texts()
plt.setp(legendText, fontsize=18)
legend = plt.gca().get_legend()
legend.draw_frame(False)
fig = plt.gcf()
fig.set_size_inches(5,5)
plt.tight_layout()
plt.savefig(pltFile, format='png')
plt.close()
print "%s DONE!!" % (pltFile)
开发者ID:sayop,项目名称:CFM01,代码行数:50,代码来源:post.py
示例18: plot_parameter_sweep
def plot_parameter_sweep(exp_lambda, parameters, error=False, xaxis="", yaxis="", title="", filename="output.png"):
import matplotlib.pyplot as plt
from matplotlib import font_manager, rcParams
plt.figure()
X = parameters
Y1 = []
E1 = []
Y2 = []
E2 = []
Y3 = []
E3 = []
for x in X:
result = exp_lambda(x)
Y1.append(result[0][0])
E1.append(result[1][0])
Y2.append(result[0][1])
E2.append(result[1][1])
Y3.append(result[0][3])
E3.append(result[1][3])
rcParams.update({"font.size": 22})
fprop = font_manager.FontProperties(fname="/Library/Fonts/Microsoft/Gill Sans MT.ttf")
plt.plot(X, Y1, "s-", linewidth=2.5, markersize=16, color="#3399FF")
if not error:
plt.plot(X, Y2, "o-", linewidth=2.5, markersize=16, color="#FF6666")
else:
plt.plot(X, Y3, "o-", linewidth=2.5, markersize=16, color="#FF6666")
# plt.plot(X, Y3, '--')
plt.title(title, fontproperties=fprop)
plt.xlabel(xaxis, fontproperties=fprop)
plt.ylabel(yaxis, fontproperties=fprop)
xticklabels = plt.getp(plt.gca(), "xticklabels")
xticklabels = plt.getp(plt.gca(), "yticklabels")
plt.setp(xticklabels, fontproperties=fprop)
# plt.legend(['PrivateClean','Naive', 'Dirty'], loc='upper left')
plt.grid(True)
plt.savefig(filename)
开发者ID:sjyk,项目名称:private-clean,代码行数:48,代码来源:experiments.py
示例19: draw_colorbar
def draw_colorbar(fig, ax, coll, ticks=None, cblabel="", cbar_pos=None,
cb_fmt="%i", labelsize=12, pm=False):
""" Draws the colorbar in a figure. """
if cbar_pos is None:
cbar_pos=[0.14, 0.13, 0.17, 0.04]
cbaxes = fig.add_axes(cbar_pos)
cbar = plt.colorbar(coll, cax=cbaxes, orientation='horizontal',
format=cb_fmt)
cbar.set_ticks(ticks)
cbar.ax.set_xlabel(cblabel)
cbar.ax.xaxis.set_label_position('top')
cbar.ax.xaxis.set_ticks_position('bottom')
cbar.set_label(cblabel,size=labelsize)
if pm:
newticks = []
for i,l in enumerate(cbar.ax.get_xticklabels()):
label = str(l)[10:-2]
if i == 0:
newticks.append(r"$\leq${0}".format(label))
elif i+1 == len(cbar.ax.get_xticklabels()):
newticks.append(r"$\geq${0}".format(label))
else:
newticks.append(r"{0}".format(label))
cbar.ax.set_xticklabels(newticks)
cl = plt.getp(cbar.ax, 'xmajorticklabels')
plt.setp(cl, fontsize=10)
return
开发者ID:kadubarbosa,项目名称:hydra1,代码行数:27,代码来源:maps_losvd.py
示例20: _draw_main_solution
def _draw_main_solution(self):
"""
plot the solution at the finest level on our optional
visualization
"""
myg = self.grids[self.nlevels - 1].grid
v = self.grids[self.nlevels - 1].get_var("v")
plt.imshow(
np.transpose(v[myg.ilo : myg.ihi + 1, myg.jlo : myg.jhi + 1]),
interpolation="nearest",
origin="lower",
extent=[self.xmin, self.xmax, self.ymin, self.ymax],
)
plt.xlabel("x")
plt.ylabel("y")
plt.title(r"current fine grid solution")
formatter = matplotlib.ticker.ScalarFormatter(useMathText=True)
cb = plt.colorbar(format=formatter, shrink=0.5)
cb.ax.yaxis.offsetText.set_fontsize("small")
cl = plt.getp(cb.ax, "ymajorticklabels")
plt.setp(cl, fontsize="small")
开发者ID:evanoconnor,项目名称:pyro2,代码行数:26,代码来源:MG.py
注:本文中的matplotlib.pyplot.getp函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论