本文整理汇总了Python中matplotlib.pyplot.box函数的典型用法代码示例。如果您正苦于以下问题:Python box函数的具体用法?Python box怎么用?Python box使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了box函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tweak
def tweak():
xmin, xmax, ymin, ymax = axis()
xpad = 0.1 * (xmax - xmin)
ypad = 0.1 * (ymax - ymin)
axis([xmin - xpad, xmax + xpad, ymin - ypad, ymax + ypad])
tick_params(length=0)
box("off")
示例2: plot_large_profile
def plot_large_profile(self, distances, elevations, length,
seg_index='all', annotations=None):
"""
Plot a large sized profile.
@param distances: list of distances for the plot
@type distances: C{list} of C{float}
@param elevations: list of elevations for the plot
@type elevations: C{list} of C{float}
@param length: overall length of plot
@type length: C{float}
@param seg_index: index of segment being plotted
@type seg_index: C{int}
@param annotations: annotations for the plot
@type annotations: C{list} of L{Annotation}
"""
self._set_min_anno_dist(LARGE_WIDTH)
plt.figure(1, figsize=(LARGE_WIDTH, LARGE_HEIGHT))
plt.xlabel('Distance (miles)', fontname=FONT_NAME, fontsize=LABEL_FONT_SIZE)
plt.ylabel('Elevation (feet)', fontname=FONT_NAME, fontsize=LABEL_FONT_SIZE)
if annotations is None:
plt.title('Profile', fontname=FONT_NAME, fontsize=LABEL_FONT_SIZE)
else:
plt.box(False)
plt.axhline(y=0.001, color='black')
plt.axvline(color='black')
self._plot_profile(distances, elevations, length, annotations)
self._save_profile(seg_index, 'large')
示例3: draw_network_graph
def draw_network_graph(self, ax, graph_type='dot', p_vals=None,
included_variables=[], size=[3.33, 2],
resolution=100, cmap=mt.cm.jet, colorbar=True,
show_regulation=True,
**kwargs):
g = GraphGenerator(self)
dot_data = g.graph(graph_type=graph_type,
p_vals=p_vals,
cmap=cmap,
included_variables=included_variables,
show_regulation=show_regulation)
dot_string = dot_data['description']
cmd = Popen(['dot', '-Tpng', '-Gdpi='+str(resolution)],
stdin=PIPE, stdout=PIPE, stderr=PIPE)
data, err = cmd.communicate(input=dot_string)
if len(err) > 0:
raise OSError, err
if 'limits' in dot_data:
if colorbar is True:
c_ax,kw=mt.colorbar.make_axes(ax)
zlim = dot_data['limits']
self.draw_function_colorbar(c_ax, zlim, cmap)
c_ax.set_aspect(15./(zlim[1]-zlim[0]))
f=StringIO.StringIO(data)
cax=ax.imshow(mt.image.imread(f))
ax.xaxis.visible=False
ax.yaxis.visible=False
ax.set_xticks([])
ax.set_yticks([])
plt.box(False)
f.close()
示例4: draw
def draw(self):
self._prepare_draw()
plt.axis("off")
plt.box("off")
plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)
plt.show()
示例5: plot_bars
def plot_bars(d_bar, d_err, title, keys, width = 0.1,
ind = None, sp_num = None, colors = None, share_ax = None):
sp_num = sp_num if sp_num else 111
ind = ind if ind else 1
colors = colors if colors else ['b','g','r','c','m','y']
if share_ax is None:
ax = pyplot.subplot(sp_num)
else:
ax = pyplot.subplot(sp_num, sharey = share_ax, sharex = share_ax)
n_mods = len(keys)
offset = -width * (n_mods / 2)
for i, mod in enumerate(keys):
ax.bar(ind + offset + (width*i),
d_bar[mod],
width = width / 2.,
align = 'center',
yerr = d_err[mod] if d_err else None,
ecolor = 'k',
color = colors[i % len(colors)])
#ax.autoscale(tight=False)
pyplot.xticks([])
pyplot.box(on = False)
pyplot.title(title, fontsize = 20, va='baseline')
pyplot.legend(keys)
return ax
示例6: plot_scalp
def plot_scalp(densities, sensors, sensor_locs=None,
plot_sensors=True, plot_contour=True, cmap=None, clim=None, smark='k.', linewidth=2, fontsize=8):
if sensor_locs is None:
sensor_locs = positions.POS_10_5
if cmap is None:
cmap = plt.get_cmap('RdBu_r')
# add densities
if clim is None:
cmax = np.max(np.abs(densities))
clim = [-cmax, cmax]
locs = [positions.project_scalp(*sensor_locs[lab]) for lab in sensors]
add_density(densities, locs, cmap=cmap, clim=clim, plot_contour=plot_contour)
# setup plot
MARGIN = 1.2
plt.xlim(-MARGIN, MARGIN)
plt.ylim(-MARGIN, MARGIN)
plt.box(False)
ax = plt.gca()
ax.set_aspect(1.2)
ax.yaxis.set_ticks([],[])
ax.xaxis.set_ticks([],[])
# add details
add_head(linewidth)
if plot_sensors:
add_sensors(sensors, locs, smark, fontsize)
示例7: plot_screen
def plot_screen(screen, ax=None):
"""Plot a captured screenshot
Parameters
----------
screen : array
The N x M x 3 (or 4) array of screen pixel values.
ax : matplotlib Axes | None
If provided, the axes will be plotted to and cleared of ticks.
If None, a figure will be created.
Retruns
-------
ax : matplotlib Axes
The axes used to plot the image.
"""
screen = np.array(screen)
if screen.ndim != 3 or screen.shape[2] not in [3, 4]:
raise ValueError('screen must be a 3D array with 3 or 4 channels')
if ax is None:
plt.figure()
ax = plt.axes([0, 0, 1, 1])
ax.imshow(screen)
ax.set_xticks([])
ax.set_yticks([])
plt.box('off')
return ax
示例8: plot_pos_cm
def plot_pos_cm(rx, ry, sx, sy, M, S, j=0):
"""Plots the solved positions of the system at any time around the system's center of mass
Parameters
----------
rx: array, x postitions of all stars
ry: array, y postitions of all stars
sx: array, x postitions of S
sy: array, y postitions of S
M,S: float, respective mass of galactic neucli
j: float, time at which you are plotting
Returns
-------
Scatter plot of the system at any given time.
"""
plt.figure(figsize=(6,6))
plt.scatter(0,0,color= 'k', label= 'CM', marker = "+", s= 100)
plt.scatter((sx[j]-((M*sx[j])/(M+S))), (sy[j]-((M*sy[j])/(M+S))), color = 'b',label ='S')
plt.scatter((rx[j]-((S*sx[j])/(M+S))),(ry[j]-((S*sy[j])/(M+S))),color='g',marker="*", label='stars', s=6)
plt.scatter((-(M*sx[j])/(M+S)),(-(M*sy[j])/(M+S)), color = 'c', label = "M")
plt.legend(loc='upper left')
plt.xlim(-65,65)
plt.ylim(-65,65)
plt.box(False)
plt.tick_params(axis = 'x', top = 'off', bottom = "off", labelbottom= 'off')
plt.tick_params(axis = 'y', right = 'off', left= "off", labelleft= 'off')
plt.show()
示例9: sub_direct
def sub_direct(rx, ry, sx, sy, time):
"""Creates a 2 by 4 subplot of the system at 7 chosen times
Parameters
----------
rx: array, x postitions of all stars
ry: array, y postitions of all stars
sx: array, x postitions of S
sy: array, y postitions of S
times: float, time at which you are plotting
Returns
-------
2 by 4 subplot of the system at 7 chosen times
"""
c=1
fig, ax = plt.subplots(2,4, figsize=(20,10))
for i in range(2):
for j in range(4):
plt.sca(ax[i,j])
t = time[i,j]
plt.scatter(0,0,color= 'b', label= 'M', s=30)
plt.scatter(sx[t], sy[t], color = 'r', label = 'S', s=30)
plt.scatter(rx[t], ry[t], color = 'g', label = 'stars', s=5)
plt.xlabel(c-3, fontsize=15)
plt.xlim(-60,60)
plt.ylim(-60,60)
plt.box(False)
plt.tick_params(axis = 'x', top = 'off', bottom = "off", labelbottom= 'off')
plt.tick_params(axis = 'y', right = 'off', left= "off", labelleft= 'off')
c+=1
plt.tight_layout()
示例10: body_plot
def body_plot(Edge, Body):
global n_fig
# Determine if the output directory exists. If not, create the directory.
if not os.path.exists('./movies'):
os.makedirs('./movies')
figure = plt.figure(1)
figure.add_subplot(1, 1, 1, axisbg='1') # Change background color here
plt.gca().set_aspect('equal')
plt.gca().axes.get_xaxis().set_visible(False)
plt.gca().axes.get_yaxis().set_visible(False)
plt.box(on='off')
# plt.plot(Body.AF.x_col[:Body.N/2], Body.cp[:Body.N/2]/100, 'g')
# plt.plot(Body.AF.x_col[Body.N/2:], Body.cp[Body.N/2:]/100, 'b')
plt.plot(Body.AF.x, Body.AF.z, 'k')
plt.xlim((np.min(Body.AF.x)-0.125, np.min(Body.AF.x)+0.125))
plt.plot(Edge.x, Edge.z, 'g')
plt.ylim((-0.05, 0.05))
figure.savefig('./movies/%05i.png' % (n_fig), format='png')
plt.clf()
n_fig += 1
示例11: plot2DGrid
def plot2DGrid(scores, paramsToPlot, keysToPlot, scoreLabel, vrange):
"""
Plots a heatmap of scores, over the paramsToPlot
:param scores: A list of scores, estimated using parallelizeScore
:param paramsToPlot: The parameters to plot, chosen automatically by plotScores
:param scoreLabel: The specified score label (dependent on scoring metric used)
:param vrange: The visible range of the heatmap (range you wish the heatmap to be specified over)
"""
scoreGrid = np.reshape(
scores, (len(paramsToPlot[keysToPlot[0]]), len(paramsToPlot[keysToPlot[1]])))
plt.figure(figsize=(int(round(len(paramsToPlot[keysToPlot[1]]) / 1.33)), int(
round(len(paramsToPlot[keysToPlot[0]]) / 1.33))))
if vrange is not None:
plt.imshow(scoreGrid, cmap='jet', vmin=vrange[0], vmax=vrange[1])
else:
plt.imshow(scoreGrid, cmap='jet')
plt.xlabel(keysToPlot[1])
plt.xticks(
np.arange(len(paramsToPlot[keysToPlot[1]])), paramsToPlot[keysToPlot[1]])
plt.ylabel(keysToPlot[0])
plt.yticks(
np.arange(len(paramsToPlot[keysToPlot[0]])), paramsToPlot[keysToPlot[0]])
if scoreLabel is not None:
plt.title(scoreLabel)
else:
plt.title('Score')
plt.colorbar()
plt.box(on=False)
plt.show()
示例12: setAxes
def setAxes( fig, refCategories, options ):
axDict = {}
#Background axes:
axDict[ 'bg' ] = fig.add_axes( [ 0.0, 0.0, 1.0, 1.0 ] )
axDict[ 'bg' ].xaxis.set_major_locator( pylab.NullLocator() )
axDict[ 'bg' ].yaxis.set_major_locator( pylab.NullLocator() )
pyplot.box( on=False )
#Set axes for the categories plots
options.axleft = 0.01
options.axright = 0.99
options.width = options.axright - options.axleft
options.axbottom = 0.1
options.axtop = 0.85
options.axheight = options.axtop - options.axbottom
margin = 0.05
w = ( options.width - margin*(len(refCategories) - 1) )/len(refCategories)
xpos = options.axleft
refCategories.sort()
options.sortedAxesNames = refCategories
for c in refCategories:
axDict[ c ] = fig.add_axes( [ xpos, options.axbottom, w, options.axheight ] )
axDict[ c ].xaxis.set_major_locator( pylab.NullLocator() )
axDict[ c ].yaxis.set_major_locator( pylab.NullLocator() )
xpos += w + margin
pyplot.box( on = False )
return axDict
示例13: plot_pos
def plot_pos(rx, ry, sx, sy, j=0):
"""Plots the solved positions of the system at any time
Parameters
----------
rx: array, x postitions of all stars
ry: array, y postitions of all stars
sx: array, x postitions of S
sy: array, y postitions of S
j: float, time at which you are plotting
Returns
-------
Scatter plot of the system at any given time.
"""
plt.figure(figsize=(6,6))
plt.scatter(0,0,color= 'c', label= 'M')
plt.scatter(sx[j], sy[j], color = 'b', label = 'S')
plt.scatter(rx[j], ry[j], color = 'g', marker = "*", label = 'stars', s=6)
plt.legend(loc='upper left')
plt.xlim(-65,65)
plt.ylim(-65,65)
plt.box(False)
plt.tick_params(axis = 'x', top = 'off', bottom = "off", labelbottom= 'off')
plt.tick_params(axis = 'y', right = 'off', left= "off", labelleft= 'off')
plt.show()
示例14: establishAxes
def establishAxes( fig, options, data ):
""" create one axes per chromosome
"""
axDict = {}
options.axLeft = 0.08
options.axRight = 0.98
options.axWidth = options.axRight - options.axLeft
options.axTop = 0.97
options.chrMargin = 0.02
if not ( options.stackFillBlocks or options.stackFillContigPaths or
options.stackFillContigs or options.stackFillScaffPaths ):
options.axBottom = 0.02
options.axHeight = options.axTop - options.axBottom
else:
options.axBottom = 0.06
options.axHeight = options.axTop - options.axBottom
data.footerAx = fig.add_axes( [ 0.02, 0.01, 0.96, options.axBottom - 0.02] )
if not options.frames:
plt.box( on=False )
curXPos = options.axLeft
#data.labelAx = fig.add_axes( [ 0.02, options.axBottom, 0.08, options.axHeight] )
#if not options.frames:
# plt.box( on=False )
for c in data.chrNames:
w = (( data.chrLengthsByChrom[ c ] / float( data.genomeLength ) ) *
( options.axWidth - ( options.chrMargin * float( len( data.chrNames ) - 1) )))
axDict[ c ] = fig.add_axes( [ curXPos, options.axBottom,
w , options.axHeight] )
curXPos += w + options.chrMargin
if not options.frames:
plt.box( on=False )
return ( axDict )
示例15: establishAxes
def establishAxes( fig, categories, options, data ):
axDict = {}
data.backgroundAx = fig.add_axes( [ 0.0, 0.0, 1.0, 1.0 ] )
data.backgroundAx.yaxis.set_major_locator( pylab.NullLocator() )
data.backgroundAx.xaxis.set_major_locator( pylab.NullLocator() )
plt.box( on=False )
options.axLeft = 0.01
options.axRight = 0.99
options.width = options.axRight - options.axLeft
options.axBottom = 0.1
options.axTop = 0.85
options.axHeight = options.axTop - options.axBottom
margin = 0.017
width = ( options.width - ( len(categories) - 1 ) * margin ) / len(categories)
xpos = options.axLeft
sortedOrder = categories.keys()
sortedOrder.sort()
options.axDictSortedOrder = sortedOrder
for c in sortedOrder:
axDict[ c ] = fig.add_axes( [ xpos, options.axBottom,
width, options.axHeight ] )
axDict[ c ].yaxis.set_major_locator( pylab.NullLocator() )
axDict[ c ].xaxis.set_major_locator( pylab.NullLocator() )
xpos += width + margin
plt.box( on=False )
data.axDict = axDict
return ( axDict )