本文整理汇总了Python中matplotlib.pylab.rc函数的典型用法代码示例。如果您正苦于以下问题:Python rc函数的具体用法?Python rc怎么用?Python rc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: display_TwoHopSchemes
def display_TwoHopSchemes(two_hop_schemes, pathString):
'''
Produce a graph that compare ...
'''
self = two_hop_schemes
pylab.rc('axes', linewidth=2) # make the axes boundary lines bold
#fig, ax = plt.subplots()
fig = plt.figure()
ax = fig.add_axes([0.1, 0.1, 0.7, 0.7]) # left, bottom, width, height (range 0 to 1)
rr.plot( self.region_CF_ICFsch3, 'red', lw=8, axes=ax, label='CF + ICF')
rr.plot( self.region_DFIntegerCoeff_FCo, 'c', lw=4, axes=ax, label='DF + FCo')
rr.plot( self.region_noInterference, 'blue', lw=2, axes=ax, label='Free Interf.')
fig.suptitle('$g ={},{},{},{}$'.format(self.g13, self.g14, self.g23, self.g24), fontsize=14, fontweight='bold')
ax.set_title(r'$P_s=P_1=P_2={}, \, P_3={}, \, P_4={}, \, N=1$'.format(self.Ps, self.P3, self.P4),fontdict=self.font)
ax.set_xlabel('$R_1$', fontdict=self.font)
ax.set_ylabel('$R_2$', fontdict=self.font)
#ax.set_xlim(xmin=0, xmax=3.5)
#ax.set_ylim(ymin=0, ymax=3.5)
ax.legend(loc=0)
# savefig.save(path='{}compare_TwoHop_Schemes/PsP3P4_{}_{}_{}_g_{}_{}_{}_{}'.format(pathString, self.Ps, self.P3, self.P4, self.g13, self.g14, self.g23, self.g24), ext='pdf', close=False, verbose=True)
nameStr = 'PsP3P4_{}_{}_{}_g13g14g23g24_{}_{}_{}_{}'.format(self.Ps, self.P3, self.P4, self.g13, self.g14, self.g23, self.g24)
savefig.save(path='{}compare_TwoHop_Schemes/{}'.format(pathString, nameStr), ext='pdf', close=False, verbose=True)
开发者ID:yanyingchen,项目名称:2DRateRegion,代码行数:28,代码来源:compareTwoHopSchemes.py
示例2: display
def display(oneSimulation,pathString, separate=False ,saveOnly=True):
'''
show/save figures
'''
self = oneSimulation
pylab.rc('axes', linewidth=2) # make the axes boundary lines bold
#fig, ax = plt.subplots()
fig = plt.figure()
ax = fig.add_axes([0.1, 0.1, 0.7, 0.7]) # left, bottom, width, height (range 0 to 1)
if separate:
rr.plot( self.df_Region, 'red', lw=6, axes=ax, label='DF')
rr.plot( self.cf_Region, 'blue', lw=4, axes=ax, label='CF')
rr.plot( self.fco_Region, 'red', lw=6, axes=ax, label='DF')
rr.plot( self.icf_Region_bigR1, 'blue', lw=4, axes=ax, label='ICF')
rr.plot( self.icf_Region_bigR2, 'blue', lw=4, axes=ax)
rr.plot(self.df_fco_region, 'red', lw=6, label='DF+FCo')
rr.plot(self.cf_icf_region, 'blue', lw=4, label='CF+ICF')
fig.suptitle('$g ={},{},{},{}$'.format(self.g13, self.g14, self.g23, self.g24), fontsize=14, fontweight='bold')
ax.set_title(r'$P_s=P_1=P_2={}, \, P_3={}, \, P_4={}, \, N=1$'.format(self.Ps,
self.P3, self.P4),fontdict=self.font)
ax.set_xlabel('$R_1$', fontdict=self.font)
ax.set_ylabel('$R_2$', fontdict=self.font)
#ax.set_xlim(xmin=0, xmax=3.5)
#ax.set_ylim(ymin=0, ymax=3.5)
ax.legend(loc=0)
nameStr = 'PsP3P4_{}_{}_{}_g13g14g23g24_{}_{}_{}_{}'.format(self.Ps, self.P3, self.P4,
self.g13, self.g14, self.g23, self.g24)
savefig.save(path='{}/plots_CF_ICF__DF_FCo/{}'.format(pathString, nameStr), ext='pdf', close=saveOnly, verbose=True)
开发者ID:yanyingchen,项目名称:2DRateRegion,代码行数:32,代码来源:compare_twoHops_CF_ICF__DF_FCo.py
示例3: plot_transition_ratio
def plot_transition_ratio(df1, df2):
"""
plot stage transitions
df1: normal sleep (df1 = analyse(base))
df2: sleep depravation (df2 = analyse(depr))
"""
N = 5
ind = np.arange(N) # the x locations for the groups
width = 0.2 # he width of the bars
plt.close()
plt.rc('font', family='Arial')
fig, ax = plt.subplots(nrows=6, ncols=6, sharex='col', sharey='row')
fig.suptitle("Comparison of the number of stage transitions (% of total transitions) (origin stage " + u'\u2192' + " dest. stage)", fontsize=20)
plt.subplots_adjust(wspace = 0.2,hspace = 0.4 )
for i in range(0,6): # do not care about stage transitions > 5
for j in range(0,6):
clef = '%t' + str(i) + '-' + str(j)
normal = df1[clef].tolist()
mean = sum(normal) / len(normal)
normal.extend([mean])
rects1 = ax[i,j].bar(ind, normal, width, color='b')
depravation = df2[clef].tolist()
mean = sum(depravation) / len(depravation)
depravation.extend([mean])
rects2 = ax[i,j].bar(ind+width, depravation, width, color='r')
for label in (ax[i,j].get_xticklabels() + ax[i,j].get_yticklabels()):
label.set_fontname('Arial')
label.set_fontsize(8)
ax[i,j].set_title(str(i) + ' ' + u'\u2192' + ' ' + str(j))
ax[i,j].set_xticks(ind+width)
ax[i,j].set_xticklabels( ('1', '2', '3', '4', 'Avg') )
ax[i,j].set_yticks(np.arange(0, 6, 2))
ax[i,j].set_ylim([0,6])
fig.legend( (rects1[0], rects2[0]), ('Baseline', 'Recovery'), loc = 'lower right', fontsize=10)
开发者ID:END-team,项目名称:final-project,代码行数:35,代码来源:yannick.py
示例4: newCreateAndSaveMultilineFig
def newCreateAndSaveMultilineFig(xDataList, yDataList, xLabel="", yLabel="",
figFileRoot="", fileExt='.png', xMin=0,
xMax=0, yMin=0, yMax=0, legendFlag=1,
legendFont=12, traceNameList=[],
legLoc=(0, 0)):
"""This subroutine saves a figure with multiple lines."""
figFileName = figFileRoot + fileExt
colorDict = createColorDictWithDashes()
if xMax == 0:
curMax = 0
for n in range(0, len(xDataList)):
if type(xDataList[n]) == list:
if max(xDataList[n]) > curMax:
curMax = max(xDataList[n])
else:
if xDataList[n].any() > curMax:
curMax = max(xDataList[n])
xMax = curMax
if yMax == 0:
curMax = 0
for n in range(0, len(yDataList)):
if type(yDataList[n]) == list:
if max(yDataList[n]) > curMax:
curMax = max(yDataList[n])
else:
if yDataList[n].any() > curMax:
curMax = max(yDataList[n])
yMax = curMax
plt.axes([0.1, 0.1, 0.71, 0.8])
if traceNameList == []:
for n in range(0, len(xDataList)):
traceNameList.append("Trace_" + str(n))
for n in range(0, len(xDataList)):
xData = convert_list_to_array(xDataList[n])
yData = convert_list_to_array(yDataList[n])
tempPlot = plt.plot(
xData, yData, colorDict[str(n + 1)], hold="True",
label=traceNameList[n])
plt.xlabel(xLabel)
plt.ylabel(yLabel)
plt.xlim(xMin, xMax)
plt.ylim(yMin, yMax)
plt.rc("legend", fontsize=legendFont)
if legendFlag == 1:
if legLoc != (0, 0):
print(legLoc)
plt.legend(loc=legLoc)
else:
plt.legend()
plt.savefig(figFileName, dpi=300)
plt.clf()
开发者ID:FordyceLab,项目名称:mitomi_analysis,代码行数:58,代码来源:plotUtils.py
示例5: display70
def display70(oneSimulation,pathString, separate=False ,saveOnly=True):
'''
show/save figures
'''
self = oneSimulation
tmp = np.asarray(oneSimulation.cf_icf01_region._geometry.boundary)
tmp01= tmp[(0,1,3), :]
tmp = np.asarray(oneSimulation.cf_icf_region._geometry.boundary)
tmp03= tmp[(1,2,3,4), :]
tmp = np.asarray(oneSimulation.df_fco_region._geometry.boundary)
tmpDF = tmp[(0,1,2,3), :]
pylab.rc('axes', linewidth=2) # make the axes boundary lines bold
# fig, ax = plt.subplots()
fig = plt.figure()
fig.set( size_inches=(8.8, 6) )
ax = fig.add_axes([0.1, 0.1, 0.7, 0.7]) # left, bottom, width, height (range 0 to 1)
# if separate:
# rr.plot( self.df_region, 'red', lw=6, axes=ax, label='DF')
# rr.plot( self.cf_region, 'blue', lw=4, axes=ax, label='CF')
# rr.plot( self.fco_region, 'red', lw=6, axes=ax, label='DF')
# rr.plot( self.icf_region_bigR1, 'blue', lw=4, axes=ax, label='ICF')
# rr.plot( self.icf_region_bigR2, 'blue', lw=4, axes=ax)
# rr.plot(self.df_fco_region, 'blue', lw=6, label='DF+FCo')
# rr.plot(self.cf_icf_region, 'red', lw=4, label='CF+ICF Scheme 3')
# rr.plot(self.cf_icf01_region, 'green', lw=2, label='CF+ICF Scheme 1' )
ax.plot(tmpDF[:,0], tmpDF[:,1], 'blue', lw=6, label='DF+FCo')
ax.plot(tmp03[:,0], tmp03[:,1], 'red', lw=4, label='CF+ICF Scheme 3')
ax.plot(tmp01[:,0], tmp01[:,1], 'green', lw=2, label='CF+ICF Scheme 1' )
# fig.suptitle('$g ={},{},{},{}$'.format(self.g13, self.g14, self.g23, self.g24), fontsize=14, fontweight='bold')
ax.set_title(r'$P_s=P_1=P_2={}, \, P_3={}, \, P_4={}, \, N=1$'.format(self.Ps,
self.P3, self.P4),fontdict=self.font)
ax.set_xlabel('$R_1$', fontdict=self.font)
ax.set_ylabel('$R_2$', fontdict=self.font)
#ax.set_xlim(xmin=0, xmax=3.5)
#ax.set_ylim(ymin=0, ymax=3.5)
ax.legend(loc=0)
nameStr = 'PsP3P4_{}_{}_{}_g13g14g23g24_{}_{}_{}_{}'.format(self.Ps, self.P3, self.P4,
self.g13, self.g14, self.g23, self.g24)
savefig.save(path='{}/plots_CF_ICF03__CF_ICF01__DF_FCo/{}'.format(pathString, nameStr), ext='pdf', close=saveOnly, verbose=True)
开发者ID:yanyingchen,项目名称:2DRateRegion,代码行数:58,代码来源:finalPlots_compare_CF_ICF03__CF_ICF01__DF_FCo.py
示例6: violin_plot
def violin_plot(ax, values_list, measure_name, group_names, fontsize, color='blue', ttest=False):
'''
This is a little wrapper around the statsmodels violinplot code
so that it looks nice :)
'''
# IMPORTS
import matplotlib.pylab as plt
import statsmodels.api as sm
import numpy as np
# Make your violin plot from the values_list
# Don't show the box plot because it looks a mess to be honest
# we're going to overlay a boxplot on top afterwards
plt.sca(ax)
# Adjust the font size
font = { 'size' : fontsize}
plt.rc('font', **font)
max_value = np.max(np.concatenate(values_list))
min_value = np.min(np.concatenate(values_list))
vp = sm.graphics.violinplot(values_list,
ax = ax,
labels = group_names,
show_boxplot=False,
plot_opts = { 'violin_fc':color ,
'cutoff': True,
'cutoff_val': max_value,
'cutoff_type': 'abs'})
# Now plot the boxplot on top
bp = plt.boxplot(values_list, sym='x')
for key in bp.keys():
plt.setp(bp[key], color='black', lw=fontsize/10)
# Adjust the power limits so that you use scientific notation on the y axis
plt.ticklabel_format(style='sci', axis='y')
ax.yaxis.major.formatter.set_powerlimits((-3,3))
plt.tick_params(axis='both', which='major', labelsize=fontsize)
# Add the y label
plt.ylabel(measure_name, fontsize=fontsize)
# And now turn off the major ticks on the y-axis
for t in ax.yaxis.get_major_ticks():
t.tick1On = False
t.tick2On = False
return ax
开发者ID:KirstieJane,项目名称:DESCRIBING_DATA,代码行数:52,代码来源:create_violin_plots.py
示例7: chi_squared_stats
def chi_squared_stats(self, plot_chisq=False):
"""
Compute chi^2 statistics for an X^2 distribution.
This is essentially a chi^2 test for normality being
computed on residual from the fit. I'll rewrite it
into a chi^2 goodness of fit test when I'll get around
to it.
Returns
-------
prob_chisq : probability that X^2 obeys the chi^2 distribution
dof : degrees of freedom for chi^2
"""
# ------------------- TODO --------------------- #
# rewrite it to a real chi-square goodness of fit!
# this is essentially a chi^2 test for normality
from scipy.stats import chisqprob
# TODO: for Pearson's chisq test it would be
# dof = self.xarr.size - self.specfit.fitter.npars - 1
# NOTE: likelihood function should asymptotically approach
# chi^2 distribution too! Given that the whole point
# of calculating chi^2 is to use it for model
# selection I should probably switch to it.
# TODO: derive an expression for this "Astronomer's X^2" dof.
dof = self.xarr.size
prob_chisq = chisqprob(self.chi_squared, dof)
# NOTE: for some reason get_modelcube returns zeros for some
# pixels even if corresponding Cube.parcube[:,y,x] is NaN
prob_chisq[np.isnan(self.parcube.min(axis=0))] = np.nan
if plot_chisq:
if not plt.rcParams['text.usetex']:
plt.rc('text', usetex=True)
if self.mapplot.figure is None:
self.mapplot()
self.mapplot.plane = prob_chisq
self.mapplot(estimator=None, cmap='viridis', vmin=0, vmax=1)
labtxt = r'$\chi^2\mathrm{~probability~(%i~d.o.f.)}$' % dof
self.mapplot.FITSFigure.colorbar.set_axis_label_text(labtxt)
plt.show()
self.prob_chisq = prob_chisq
return prob_chisq, dof
开发者ID:vlas-sokolov,项目名称:multicube,代码行数:49,代码来源:subcube.py
示例8: plot
def plot(self):
name = self.get_tag()
Y_list = self.get_geom().get_XYZ()[1,:]
plt.xlim(1.1*Y_list[0], 1.1*Y_list[-1])
plt.xlabel('y')
plt.ylabel('gamma')
plt.plot(Y_list,self.__gamma)
plt.rc("font", size=14)
plt.savefig(name+"_gamma_distrib.png",format='png')
plt.close()
plt.xlim(1.1*Y_list[0], 1.1*Y_list[-1])
plt.xlabel('y')
plt.ylabel('iAoA')
plt.plot(Y_list,self.__iAoA*self.RAD_TO_DEG)
plt.rc("font", size=14)
plt.savefig(name+"_iAoA_distrib.png",format='png')
plt.close()
开发者ID:matthieu-meaux,项目名称:DLLM,代码行数:18,代码来源:DLLMDirect.py
示例9: AxisFormat
def AxisFormat(FONTSIZE = 22, TickSize = 10, TickDirection = 'out'):
"""
Format axes to standard design.
:param FONTSIZE: desired fontsize of all fonts.
:type FONTSIZE: int
:param TickSize: size of ticks in pxls.
:type TickSize: int
:param TickDirection: decide whether to plot ticks in or out
:type TickDirection: str
:returns: altered axes.
.. note::
* This function should work if called prior to plot input.
**Usage**
.. code-block:: python
:emphasize-lines: 3
fig = plt.figure(figsize=(8,6))
ax = fig.add_subplot(111)
pf.AxisFormat()
ax.plot(np.arange(0,100), np.arange(0,100), 'b-', linewidth =2)
plt.tight_layout()
plt.show()
**Exmaple**
*simple plot without AxisFormat call*
.. plot:: pyplots/AxisFormatDemo1.py
:include-source:
*simple plotnwith AxisFormat call*
.. plot:: pyplots/AxisFormatDemo2.py
:include-source:
"""
font = {'weight': 'norm', 'size': FONTSIZE}
legend = {'frameon': False}
ticks = {'direction': TickDirection, 'major.size': TickSize,
'minor.size': TickSize - 2}
plt.rc('font', **font)
plt.rc('legend', **legend)
plt.rc('xtick', **ticks)
plt.rc('ytick', **ticks)
开发者ID:bps10,项目名称:birdsong,代码行数:54,代码来源:PlottingFun.py
示例10: __init__
def __init__(self):
"""
"""
fig = plt.figure(facecolor = 'w', figsize = [12, 12])
fig.subplots_adjust(left=0.05, right=0.95, top=0.95, bottom=0.05)
ax1 = fig.add_subplot(1, 1, 1, aspect='equal')
self.t = np.arange(0, len(Nodes['age']))
self.x = xx[self.t]
self.y = yy[self.t]
self.age = Nodes['age'][self.t]
plot_eye(Nodes,ax1)
ax1.set_xlabel('mm',fontsize=20)
ax1.set_ylabel('mm',fontsize=20)
self.line1 = Line2D([], [], color='red', linewidth=4)
self.line1e = Line2D([], [], color='red', marker='o', markeredgecolor='r', markersize=10)
self.text = ax1.text(0.05, 0.05, 'Age: %s'%self.age[0] , fontsize=18, animated = True,
transform=ax1.transAxes)
ax1.add_line(self.line1)
ax1.add_line(self.line1e)
ax1.set_xlim(-14, 14)
ax1.set_ylim(-14, 14)
ax1.set_title('eye growth simulation',fontsize=20)
ax1.set_xticks([-10, -5, 0, 5, 10])
ax1.set_yticks([-10, -5, 0, 5, 10])
plt.rc('xtick', labelsize=20)
plt.rc('ytick', labelsize=20)
plt.tight_layout()
animation.TimedAnimation.__init__(self, fig, interval=10, blit=True)
开发者ID:bps10,项目名称:NeitzModel,代码行数:43,代码来源:Eye_Grow.py
示例11: display
def display(oneSimulation,pathString ,saveOnly=True):
'''
Produce a graph that compare three ICF schemes
'''
self = oneSimulation
# get the union rate region for plotting
icf_sch1 = rr.union( [self.icf_sch1_bigR1, self.icf_sch1_bigR2] )
icf_sch2 = rr.union( [self.icf_sch2_bigR1, self.icf_sch2_bigR2] )
icf_sch3 = rr.union( [self.icf_sch3_bigR1, self.icf_sch3_bigR2] )
pylab.rc('axes', linewidth=2) # make the axes boundary lines bold
fig, ax = plt.subplots()
rr.plot( icf_sch1, 'g', axes=ax, label='Scheme 1')
rr.plot( icf_sch2, 'b', axes=ax, label='Scheme 2')
rr.plot( icf_sch3, 'r', axes=ax, label='Scheme 3')
# plot the line: R2 = R1
tmp = np.asarray(self.icf_sch1_bigR1._geometry.boundary)
tmp2 = [[0, tmp[1, 0]], [0, tmp[1, 1] ] ]
ax.plot( [0, tmp[1, 0]], [0, tmp[1, 1] ] , 'k--', lw=2)
ax.set_title(r'$ P_3={}, \, P_4={}, \, N=1$'.format(self.P3, self.P4) , fontdict=self.font)
ax.set_xlabel('$R_1$', fontdict=self.font)
ax.set_ylabel('$R_2$', fontdict=self.font)
ax.set_xlim(xmin=0, xmax=3.5)
ax.set_ylim(ymin=0, ymax=3.5)
ax.legend(loc='upper right')
savefig.save(path='{}/compare_three_ICF_Schemes/P3P4_{}_{}'.format(pathString, self.P3, self.P4 ), ext='pdf', close=saveOnly, verbose=True)
if (0):
# add annotations for 3 regions
plt.text(0.7, 2.3, 'capacity region by coherent coding with cardinality-bounding', color='red')
plt.text(1, 1.8, 'non-coherent coding with cardinality-bounding', color='blue')
plt.text(1.3, 1.4, 'capacity region by coherent coding with cardinality-bounding', color='green')
bbox_props = dict(boxstyle="round,pad=0.1", fc="white", ec="g", lw=1)
plt.text(1, 0.5, r'$1$', color='black', bbox=bbox_props)
bbox_props = dict(boxstyle="round,pad=0.1", fc="white", ec="b", lw=1)
plt.text(1.7, 0.4, r'$2$', color='black', bbox=bbox_props)
bbox_props = dict(boxstyle="round,pad=0.1", fc="white", ec="r", lw=1)
plt.text(2.2, 0.3, r'$3$', color='black', bbox=bbox_props)
开发者ID:yanyingchen,项目名称:2DRateRegion,代码行数:42,代码来源:compareThreeICFSchemes.py
示例12: plot_matches
def plot_matches(smresbest,lspec):
"""
Plot best matches
Plots the target spectrum along with the top matches
"""
shift = 1
fig,axL = plt.subplots(nrows=2,figsize=(20,12),sharex=True)
plt.sca(axL[0])
targpar = smresbest.rename(columns={'targobs':'obs'})
targpar = dict(targpar['obs ord wlo whi'.split()].iloc[0])
targpar['type'] = 'cps'
targspec = smio.getspec_h5(**targpar)
w = targspec['w']
plt.plot(w,targspec['s'],'k')
plt.rc('axes',color_cycle=['Tomato', 'RoyalBlue'])
for i in smresbest.index:
# Plot target spectrum
plt.sca(axL[0])
y = shift*0.3
plt.plot(w,lspec['lspec'][i]+y)
par = dict(smresbest.ix[i])
par['y'] = y+1
annotate_matches(par)
# Plot residuals
plt.sca(axL[1])
y = shift*0.2
plt.plot(w,lspec['fres'][i]+y)
par['y'] = y
annotate_matches(par)
shift+=1
fig.subplots_adjust(left=.03,bottom=.03,top=0.97,right=.8)
开发者ID:petigura,项目名称:specmatch-syn,代码行数:40,代码来源:smplots.py
示例13: OrientationPlot
def OrientationPlot(OrientationHist_Data,BINS):
"""
Plot an orienation histogram. For use with OrientationHist function
Input
-----
OrientationHist_Data: computed from OrienationHist function
BINS: bins used to compute OrientationHist
Output
------
Produces a polar plot with the orientation histogram data
"""
RAD_BINS = BINS/(180./np.pi)
## Data Plot
plt.rc('grid', color='gray', linewidth=1, linestyle='-')
plt.rc('xtick', labelsize=25)
plt.rc('ytick', labelsize=20)
width, height = plt.rcParams['figure.figsize']
size = min(width, height)
fig = plt.figure(figsize=(size, size))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='w')
plt.polar(RAD_BINS,OrientationHist_Data/float(sum(OrientationHist_Data)), 'k',linewidth=4, marker='o')
ax.set_rmax(0.2)
plt.show()
开发者ID:Jeffknowles,项目名称:DrunkardsSwim,代码行数:26,代码来源:AnalysisFunctions.py
示例14: create_bar_plots
def create_bar_plots(bins, freq_list, height, group_names, colors, xlabel, ylabel, legend=True):
import matplotlib.pylab as plt
import numpy as np
from matplotlib.ticker import MaxNLocator
fig = plt.figure(figsize=(height*1.5, height))
ax = fig.add_subplot(111)
font = { 'size' : 22 * height/8}
plt.rc('font', **font)
range = np.max(bins) - np.min(bins)
w = range/((len(bins)-1) * len(group_names))
for i, group in enumerate(group_names):
bar = plt.bar(bins + w*i, freq_list[i],
width=w, label = group,
color=colors[i],
edgecolor='none')
# Adjust the power limits so that you use scientific notation on the y axis
plt.ticklabel_format(style='sci', axis='y')
ax.yaxis.major.formatter.set_powerlimits((-3,3))
for t in ax.yaxis.get_major_ticks():
t.tick1On = False
t.tick2On = False
if legend:
plt.legend(loc=0)
plt.ylabel(ylabel)
plt.xlabel(xlabel)
# Make sure the layout looks good :)
fig.tight_layout()
return fig
开发者ID:KirstieJane,项目名称:DESCRIBING_DATA,代码行数:39,代码来源:create_bar_plots.py
示例15: plot_histogram
def plot_histogram(df1, df2):
"""
plot histo for question 1 (Difference in REM sleep?)
result => not concluant
df1: normal sleep (df1 = analyse(base))
df2: sleep depravation (df2 = analyse(depr))
"""
plt.rc('font', family='Arial')
N = 5
normal = df1['%5'].tolist()
mean = sum(normal) / len(normal)
normal.extend([mean])
ind = np.arange(N) # the x locations for the groups
width = 0.35 # the width of the bars
fig, ax = plt.subplots()
rects1 = ax.bar(ind, normal, width, color='b')
depravation = df2['%5'].tolist()
mean = sum(depravation) / len(depravation)
depravation.extend([mean])
rects2 = ax.bar(ind+width, depravation, width, color='r')
ax.set_ylabel('Sleep in REM stage (%)')
ax.set_xlabel('Subjects')
ax.set_title('REM sleep comparison', fontsize=20)
ax.set_xticks(ind+width)
ax.set_xticklabels( ('1', '2', '3', '4', 'Mean') )
for label in (ax.get_xticklabels() + ax.get_yticklabels()):
label.set_fontname('Arial')
label.set_fontsize(8)
ax.legend( (rects1[0], rects2[0]), ('Baseline', 'After sleep depravation') , loc = 'lower right', fontsize=10 )
开发者ID:END-team,项目名称:final-project,代码行数:37,代码来源:yannick.py
示例16: plot_graphs
def plot_graphs(df, trending_daily, day_from, day_to, limit, country_code, folder_out=None):
days = pd.DatetimeIndex(start=day_from, end=day_to, freq='D')
for day in days:
fig = plt.figure()
ax = fig.add_subplot(111)
plt.rc('lines', linewidth=2)
data = trending_daily.get_group(str(day.date()))
places, clusters = top_trending(data, limit)
for cluster in clusters:
places.add(max_from_cluster(cluster, data))
ax.set_prop_cycle(plt.cycler('color', ['r', 'b', 'yellow'] + [plt.cm.Accent(i) for i in np.linspace(0, 1, limit-3)]
) + plt.cycler('linestyle', ['-', '-', '-', '-', '-', '--', '--', '--', '--', '--']))
frame = export(places, clusters, data)
frame.sort_values('trending_rank', ascending=False, inplace=True)
for i in range(len(frame)):
item = frame.index[i]
lat, lon, country = item
result_items = ReverseGeoCode().get_address_attributes(lat, lon, 10, 'city', 'country_code')
if 'city' not in result_items.keys():
mark = "%s (%s)" % (manipulate_display_name(result_items['display_name']),
result_items['country_code'].upper() if 'country_code' in result_items.keys() else country)
else:
if check_eng(result_items['city']):
mark = "%s (%s)" % (result_items['city'], result_items['country_code'].upper())
else:
mark = "%.2f %.2f (%s)" % (lat, lon, result_items['country_code'].upper())
gp = df.loc[item].plot(ax=ax, x='date', y='count', label=mark)
ax.tick_params(axis='both', which='major', labelsize=10)
ax.set_yscale("log", nonposy='clip')
plt.xlabel('Date', fontsize='small', verticalalignment='baseline', horizontalalignment='right')
plt.ylabel('Total number of views (log)', fontsize='small', verticalalignment='center', horizontalalignment='center', labelpad=6)
gp.legend(loc='best', fontsize='xx-small', ncol=2)
gp.set_title('Top 10 OSM trending places on ' + str(day.date()), {'fontsize': 'large', 'verticalalignment': 'bottom'})
plt.tight_layout()
db = TrendingDb()
db.update_table_img(plt, str(day.date()), region=country_code)
plt.close()
开发者ID:geometalab,项目名称:Trending-Places-in-OpenStreetMap,代码行数:37,代码来源:Top_Trending.py
示例17: plot_spectrograms
def plot_spectrograms(bsl,rec,rate,title):
plt.close()
plt.rc('font', family='Arial')
fig, ax = plt.subplots(nrows=9, ncols=2, sharex='col', sharey='row')
fig.suptitle(title + " - REM stage", fontsize=20)
plt.subplots_adjust(wspace = .05,hspace = 0.4 )
ny_nfft=1024
i=0
plt.tick_params(axis='both', labelsize=8)
while i<9:
Pxx, freq, bins, im = ax[i,0].specgram(bsl[i],NFFT=ny_nfft,Fs=rate)
ax[i,0].set_yticks(np.arange(0, 50, 10))
ax[i,0].set_ylim([0, 40])
if(i==8):
ax[i,0].set_xlabel("Time, seconds", fontsize=10)
ax[i,0].set_ylabel("Freq, Hz", fontsize=8)
ax[i,0].set_title('Baseline, channel:'+str(i+1), fontsize=10)
for label in (ax[i,0].get_xticklabels() + ax[i,0].get_yticklabels()):
label.set_fontname('Arial')
label.set_fontsize(8)
i=i+1
i=0
while i<9:
Pxx, freq, bins, im = ax[i,1].specgram(rec[i],NFFT=ny_nfft,Fs=rate)
ax[i,0].set_yticks(np.arange(0, 50, 10))
ax[i,1].set_ylim([0, 40])
#ax[i,1].set_xlim([0, 10000]) #13000])
if(i==8):
ax[i,1].set_xlabel("Time, seconds", fontsize=10)
#ax[i,1].set_ylabel("Freq, Hz")
ax[i,1].set_title('Recovery, channel:'+str(i+1), fontsize=10)
for label in (ax[i,0].get_xticklabels() + ax[i,0].get_yticklabels()):
label.set_fontname('Arial')
label.set_fontsize(8)
i=i+1
plt.show()
return
开发者ID:END-team,项目名称:final-project,代码行数:37,代码来源:feature_selection.py
示例18: plot_sleepTime
def plot_sleepTime(df1, df2):
"""
First conclusion - obvious from experience -> sleep time longer after sleep depravation
df1: normal sleep (df1 = analyse(base))
df2: sleep depravation (df2 = analyse(depr))
"""
plt.rc('font', family='Arial')
N = 5
normal = df1['sleep duration'].tolist()
mean = sum(normal) / len(normal)
normal.extend([mean])
ind = np.arange(N) # the x locations for the groups
width = 0.35 # the width of the bars
fig, ax = plt.subplots()
rects1 = ax.bar(ind, normal, width, color='b')
depravation = df2['sleep duration'].tolist()
mean = sum(depravation) / len(depravation)
depravation.extend([mean])
rects2 = ax.bar(ind+width, depravation, width, color='r')
ax.set_ylabel('Sleep time (hours)')
ax.set_xlabel('Subjects')
ax.set_title('Overall sleep duration comparison', fontsize=20)
ax.set_xticks(ind+width)
ax.set_xticklabels( ('1', '2', '3', '4', 'Mean') )
for label in (ax.get_xticklabels() + ax.get_yticklabels()):
label.set_fontname('Arial')
label.set_fontsize(8)
ax.legend( (rects1[0], rects2[0]), ('Baseline', 'Recovery'), loc = 'lower right', fontsize=10 )
开发者ID:END-team,项目名称:final-project,代码行数:37,代码来源:yannick.py
示例19: integration
# try a simple spline-based integration (good enough for small scales)
xir[i] = intsp.integral(lnkf[0],(lnkf[-1]))/(2.0*math.pi**2)
#
# for large r, do an expensive integration breaking integral into many pieces
# each integrating between successive zeroes of sin(kr)
#
xir2[i] = integrate.romberg(intfunc,lnk[0],lnk[-1],tol=1.e-14)/(2.0*math.pi**2)
print "%.4f"%rd, "%.5e"%xir[i], "%.5e"%xir2[i]
xiout.write('%.4f %.5e %.5e \n' % (rd, xir[i], xir2[i]))
fig1 = plt.figure()
plt.rc('text', usetex=True)
plt.rc('font',size=16,**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rc('xtick.major',pad=10); plt.rc('xtick.minor',pad=10)
plt.rc('ytick.major',pad=10); plt.rc('ytick.minor',pad=10)
#rfull,xifull = np.loadtxt('../s2_out.dat',usecols=(0,1),unpack=True)
plt.plot(lr,np.log10(np.abs(xir)),linewidth=1.5,c='b',label=r'$\sigma_2^2(r)$ Gaussian (spline)')
plt.plot(lr,np.log10(np.abs(xir2)),linewidth=1.5,c='m',label=r'$\sigma_2^2(r)$ TH (Romberg)')
plt.ylim(-10.0,8.0)
plt.xlim(-0.99,2.5)
#plt.xlim(8.0,16.0);
plt.xlabel(r'\textbf{$\log_{10}(R/\rm Mpc)$}',labelpad = 5)
plt.ylabel(r'$\log_{10}(\sigma^2_2(R))$',labelpad = 10)
plt.title('power spectrum moment',fontsize=16)
plt.legend(loc='upper right')
开发者ID:faldah,项目名称:computationalAstrophysics,代码行数:31,代码来源:th+gaussian+filters.py
示例20: range
Created on Sun Apr 06 18:42:59 2014
@author: lassnech
"""
from sklearn import svm
from sklearn import grid_search
import tmpfertilized as f
import matplotlib.pylab as plt
import matplotlib
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import numpy as np
from plottools import make_spiral, point_prob_plot, probaproxy
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
np.random.seed(1)
n_classes = 2
n_trees = 200
ploty = [-6, 6, 100]
plotx = [-6, 6, 100]
X, Y = make_spiral(n_arms=n_classes, noise=.4)
##############################################################################
parameters = {'kernel': ['rbf'],
'C': [1, 10, 100, 1000, 10000, 100000],
'gamma': [10 ** x for x in range(-5, 3)],
开发者ID:caomw,项目名称:fertilized-forests,代码行数:31,代码来源:spiral_svm.py
注:本文中的matplotlib.pylab.rc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论