本文整理汇总了Python中matplotlib.transforms.Bbox.from_extents方法的典型用法代码示例。如果您正苦于以下问题:Python Bbox.from_extents方法的具体用法?Python Bbox.from_extents怎么用?Python Bbox.from_extents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.transforms.Bbox
的用法示例。
在下文中一共展示了Bbox.from_extents方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plotIToEBrokenAxis
# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def plotIToEBrokenAxis(sp, gIdx, neuronIdx, trialNum=0, axBoundaries=None,
axesProportions=(0.5, 0.5), bottomLimits=None,
topLimits=None, **kw):
if axBoundaries is None:
axBoundaries = [0, 0, 1, 1]
left, bottom, right, top = axBoundaries
title = kw.pop('title', 'E cell')
fig = kw.pop('fig', plt.gcf())
h = top - bottom
w = right - left
hBottom = h*axesProportions[0]
hTop = h*axesProportions[1]
axBottom = fig.add_axes(Bbox.from_extents(left, bottom, right, bottom +
hBottom))
axTop = fig.add_axes(Bbox.from_extents(left, top - hTop, right, top),
sharex=axBottom)
_, gI = aggr.computeYX(sp, iterList)
M = sp[0][gIdx][trialNum].data['g_EI']
conns = M[neuronIdx, :]
pconn.plotConnHistogram(conns, title=title, ax=axBottom, **kw)
kw['ylabel'] = ''
pconn.plotConnHistogram(conns, title=title, ax=axTop, **kw)
annG = gI[0, gIdx]
if annG - int(annG) == 0:
annG = int(annG)
#ann = '$g_I$ = {0} nS'.format(annG)
#fig.text(left+0.95*w, bottom+0.9*h, ann, ha='right', va='bottom',
# fontsize='x-small')
axBottom.set_xlim([0, annG])
axBottom.set_xticks([0, annG])
axBottom.xaxis.set_ticklabels([0, '$g_I$'])
axBottom.set_ylim(bottomLimits)
axBottom.set_yticks(bottomLimits)
axBottom.yaxis.set_minor_locator(ti.NullLocator())
axTop.set_ylim(topLimits)
axTop.set_yticks([topLimits[1]])
axTop.xaxis.set_visible(False)
axTop.spines['bottom'].set_visible(False)
divLen = 0.07
d = .015
kwargs = dict(transform=fig.transFigure, color='k', clip_on=False)
axBottom.plot((left-divLen*w, left+divLen*w), (bottom+hBottom + d,
bottom+hBottom - d),
**kwargs)
axTop.plot((left-divLen*w, left+divLen*w), (top-hTop + d, top-hTop - d),
**kwargs)
return axBottom, axTop
示例2: zoom_effect
# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def zoom_effect(ax_zoomed, ax_origin, xlims = None, orientation='below', **kwargs):
"""
ax_zoomed : zoomed axes
ax_origin: the main axes
(xmin,xmax) : the limits of the colored area in both plot axes.
connect ax1 & ax2. The x-range of (xmin, xmax) in both axes will
be marked. The keywords parameters will be used ti create
patches.
"""
if xlims is None:
tt = ax_zoomed.transScale + (ax_zoomed.transLimits + ax_origin.transAxes)
transform = blended_transform_factory(ax_origin.transData, tt)
bbox_zoomed=ax_zoomed.bbox
bbox_origin=TransformedBbox(ax_zoomed.viewLim, transform)
else:
transform_zoomed=blended_transform_factory(ax_zoomed.transData, ax_zoomed.transAxes)
transform_origin=blended_transform_factory(ax_origin.transData, ax_origin.transAxes)
bbox_zoomed=TransformedBbox(Bbox.from_extents(xlims[0], 0, xlims[1], 1), transform_zoomed)
bbox_origin=TransformedBbox(Bbox.from_extents(xlims[0], 0, xlims[1], 1), transform_origin)
prop_patches = kwargs.copy()
prop_patches["ec"] = "none"
prop_patches["alpha"] = 0.2
if orientation=='below':
loc1a=2
loc2a=3
loc1b=1
loc2b=4
elif orientation=='above':
loc1a=3
loc2a=2
loc1b=4
loc2b=1
else:
raise Exception("orientation '%s' not recognized" % orientation)
c1, c2, bbox_zoomed_patch, bbox_origin_patch, p = \
connect_bbox(bbox_zoomed, bbox_origin,
loc1a=loc1a, loc2a=loc2a, loc1b=loc1b, loc2b=loc2b,
prop_lines=kwargs, prop_patches=prop_patches)
ax_zoomed.add_patch(bbox_zoomed_patch)
ax_origin.add_patch(bbox_origin_patch)
ax_origin.add_patch(c1)
ax_origin.add_patch(c2)
ax_origin.add_patch(p)
return c1, c2, bbox_zoomed_patch, bbox_origin_patch, p
示例3: plot
# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def plot(self, *args, **kwargs):
ps = self.env.ps
output_dir = self.config['output_dir']
rateLeft = rasterLeft
rateBottom = 0.2
rateRight = rasterRight
rateTop = self.myc['rateTop']
for idx, noise_sigma in enumerate(ps.noise_sigmas):
# E cells
fig = self._get_final_fig(self.myc['fig_size'])
ax = fig.add_axes(Bbox.from_extents(rateLeft, rateBottom, rateRight,
rateTop))
kw = {}
if (idx != 0):
kw['ylabel'] = ''
rasters.plotAvgFiringRate(ps.bumpGamma[idx],
spaceType='bump',
noise_sigma=ps.noise_sigmas[idx],
popType='E',
r=rasterRC[idx][0], c=rasterRC[idx][1],
ylabelPos=self.myc['ylabelPos'],
color='red',
tLimits=tLimits,
ax=ax, **kw)
fname = output_dir + "/bumps_rate_e{0}.pdf".format(noise_sigma)
fig.savefig(fname, dpi=300, transparent=transparent)
plt.close()
# I cells
fig = self._get_final_fig(self.myc['fig_size'])
ax = fig.add_axes(Bbox.from_extents(rateLeft, rateBottom, rateRight,
rateTop))
kw = {}
if (idx != 0):
kw['ylabel'] = ''
rasters.plotAvgFiringRate(ps.bumpGamma[idx],
spaceType='bump',
noise_sigma=ps.noise_sigmas[idx],
popType='I',
r=rasterRC[idx][0], c=rasterRC[idx][1],
ylabelPos=self.myc['ylabelPos'],
color='blue',
tLimits=tLimits,
ax=ax, **kw)
fname = output_dir + "/bumps_rate_i{0}.pdf".format(noise_sigma)
fig.savefig(fname, dpi=300, transparent=transparent)
plt.close()
示例4: plot
# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def plot(self, *args, **kwargs):
ps = self.env.ps
output_dir = self.config['output_dir']
transparent = self.myc['transparent']
for idx, noise_sigma in enumerate(ps.noise_sigmas):
# E cells
fig = self._get_final_fig(self.myc['fig_size'])
l, b, r, t = self.myc['bbox']
ax = fig.add_axes(Bbox.from_extents(l, b, r, t))
kw = {}
if (idx != 0):
kw['ylabel'] = ''
rasters.plotAvgFiringRate(ps.v[idx],
spaceType='velocity',
noise_sigma=noise_sigma,
popType='E',
r=rasterRC[idx][0], c=rasterRC[idx][1],
color='red',
ylabelPos=self.config['vel_rasters']['ylabelPos'],
tLimits=self.config['vel_rasters']['tLimits'],
trialNum=self.config['vel_rasters']['trialNum'],
sigmaTitle=False,
ax=ax, **kw)
fname = output_dir + "/velocity_rate_e{0}.pdf".format(noise_sigma)
fig.savefig(fname, dpi=300, transparent=transparent)
plt.close()
# I cells
fig = self._get_final_fig(self.myc['fig_size'])
ax = fig.add_axes(Bbox.from_extents(l, b, r, t))
kw = {}
if (idx != 0):
kw['ylabel'] = ''
rasters.plotAvgFiringRate(ps.v[idx],
spaceType='velocity',
noise_sigma=noise_sigma,
popType='I',
r=rasterRC[idx][0], c=rasterRC[idx][1],
color='blue',
ylabelPos=self.config['vel_rasters']['ylabelPos'],
tLimits=self.config['vel_rasters']['tLimits'],
trialNum=self.config['vel_rasters']['trialNum'],
sigmaTitle=False,
ax=ax, **kw)
fname = output_dir + "/velocity_rate_i{0}.pdf".format(noise_sigma)
fig.savefig(fname, dpi=300, transparent=transparent)
plt.close()
示例5: setDirectory
# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def setDirectory(self, rootPath, shape):
super(GridSweepWidget, self).setDirectory(rootPath, shape)
self.canvas.fig.clear()
self.ax = self.canvas.fig.add_axes(
Bbox.from_extents(self.sweepLeft, self.sweepBottom, self.sweepRight,
self.sweepTop))
self.cbar_kw.update({
'label' : 'Gridness score',
'ticks' : ti.MultipleLocator(0.5)})
sweeps.plotGridTrial(self.dataSpace, self.varList, self.iterList,
self.noise_sigma,
trialNumList=[],
sigmaTitle=False,
ignoreNaNs=True,
r=5, c=15,
cbar=True, cbar_kw=self.cbar_kw,
ax=self.ax,
picker=True)
c = self.ax.collections
if (len(c) != 1):
raise RuntimeError("Something went wrong! len(c) != 1")
self.dataCollection = c[0]
self.canvas.draw()
self.dataRenewed.emit(self.dataSpace)
示例6: plot
# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def plot(self, *args, **kwargs):
ps = self.env.ps
xlabel = self.myc.get('xlabel', None)
ylabel = self.myc.get('ylabel', None)
xticks = self.myc['xticks']
yticks = self.myc['yticks']
l, b, r, t = self.myc['bbox']
normalize_ticks = self.myc.get('normalize_ticks', False)
normalize_type = self.myc.get('normalize_type', None)
fname = self.myc.get('fname', "generic_1d_sweep_{ns}.pdf")
for ns_idx, noise_sigma in enumerate(ps.noise_sigmas):
file_name = self.get_fname(fname, ns=noise_sigma)
fig = self._get_final_fig(self.config['sweeps']['fig_size'])
ax = fig.add_axes(Bbox.from_extents(l, b, r, t))
sweeps.plot_1d_sweep(
self.get_data(ns_idx),
ax,
xlabel='' if xticks[ns_idx] == False else xlabel,
xticks=xticks[ns_idx],
ylabel='' if yticks[ns_idx] == False else ylabel,
yticks=yticks[ns_idx],
title=noise_sigma,
axis_setting=self.myc.get('axis_setting', 'scaled'))
ax.set_xlim(self.myc.get('xlim', (None, None)))
ax.set_ylim(self.myc.get('ylim', (None, None)))
ax.yaxis.set_minor_locator(ti.AutoMinorLocator(2))
fig.savefig(file_name, dpi=300, transparent=True)
plt.close(fig)
示例7: plot
# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def plot(self, *args, **kwargs):
ylabel_coords = self.myc.get('ylabel_coords', None)
x0, x1, dx = self.myc.get('x_range', (-.5, .5, .001))
l, b, r, t = self.myc['bbox_rect']
d = np.arange(x0, x1+dx, dx)
y_dim = np.sqrt(3)/2.0
ES_pAMPA_mu = y_dim/2.0
ES_pAMPA_sigma = 0.5/6
ES_pGABA_sigma = 0.5/6
ES_pGABA_const = 0.013
shift = 0.1
# Excitatory surround
ES_exc_profile = np.exp(-(np.abs(d) - ES_pAMPA_mu)**2/2/ES_pAMPA_sigma**2)
ES_exc_profile_shifted = np.exp(-(np.abs(d - shift) - ES_pAMPA_mu)**2/2/ES_pAMPA_sigma**2)
ES_inh_profile = (1-ES_pGABA_const)*np.exp(-d**2/2./ES_pGABA_sigma**2) + ES_pGABA_const
fig = self._get_final_fig(self.myc['fig_size'])
ax = fig.add_axes(Bbox.from_extents(l, b, r, t))
self.plotWeights(ax, d, ES_exc_profile, ES_inh_profile, ES_pGABA_const,
linewidth=self.config['scale_factor'],
x_range=(x0, x1, dx))
ax.set_xticks(self.myc.get('xticks', [-.5, .5]))
ax.xaxis.set_minor_locator(ti.MultipleLocator(0.5))
ax.xaxis.set_label_coords(x=0.5, y=-0.2)
if ylabel_coords is not None:
ax.yaxis.set_label_coords(ylabel_coords[0], ylabel_coords[1])
fileName = self.get_fname("{base}_E_surr.pdf", base='fig_conn_func')
plt.savefig(fileName, transparent=True)
示例8: zoom_effect
# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def zoom_effect(ax1, ax2, xlim, **kwargs):
trans1 = blended_transform_factory(ax1.transData, ax1.transAxes)
trans2 = blended_transform_factory(ax2.transData, ax2.transAxes)
bbox = Bbox.from_extents(xlim[0], 0, xlim[1], 1)
tbbox1 = TransformedBbox(bbox, trans1)
tbbox2 = TransformedBbox(bbox, trans2)
prop_patches = kwargs.copy()
prop_patches['ec'] = 'none'
prop_patches['alpha'] = 0.1
c1, c2, bbox_patch1, bbox_patch2, p = \
connect_bboxes(tbbox1, tbbox2, loc1a=3, loc2a=2, loc1b=4, loc2b=1, prop_lines=kwargs, prop_patches=prop_patches)
ax1.add_patch(bbox_patch1)
ax2.add_patch(bbox_patch2)
ax2.add_patch(c1)
ax2.add_patch(c2)
ax2.add_patch(p)
return c1, c2, bbox_patch1, bbox_patch2, p
示例9: main
# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def main():
fig, ax = plt.subplots()
years = np.arange(2004, 2009)
heights = [7900, 8100, 7900, 6900, 2800]
box_colors = [
(0.8, 0.2, 0.2),
(0.2, 0.8, 0.2),
(0.2, 0.2, 0.8),
(0.7, 0.5, 0.8),
(0.3, 0.8, 0.7),
]
for year, h, bc in zip(years, heights, box_colors):
bbox0 = Bbox.from_extents(year - 0.4, 0., year + 0.4, h)
bbox = TransformedBbox(bbox0, ax.transData)
ax.add_artist(RibbonBoxImage(ax, bbox, bc, interpolation="bicubic"))
ax.annotate(str(h), (year, h), va="bottom", ha="center")
ax.set_xlim(years[0] - 0.5, years[-1] + 0.5)
ax.set_ylim(0, 10000)
background_gradient = np.zeros((2, 2, 4))
background_gradient[:, :, :3] = [1, 1, 0]
background_gradient[:, :, 3] = [[0.1, 0.3], [0.3, 0.5]] # alpha channel
ax.imshow(background_gradient, interpolation="bicubic", zorder=0.1,
extent=(0, 1, 0, 1), transform=ax.transAxes, aspect="auto")
plt.show()
示例10: zoom_effect01
# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def zoom_effect01(ax1, ax2, xmin, xmax, **kwargs):
u"""
ax1 : the main axes
ax1 : the zoomed axes
(xmin,xmax) : the limits of the colored area in both plot axes.
connect ax1 & ax2. The x-range of (xmin, xmax) in both axes will
be marked. The keywords parameters will be used ti create
patches.
"""
trans1 = blended_transform_factory(ax1.transData, ax1.transAxes)
trans2 = blended_transform_factory(ax2.transData, ax2.transAxes)
bbox = Bbox.from_extents(xmin, 0, xmax, 1)
mybbox1 = TransformedBbox(bbox, trans1)
mybbox2 = TransformedBbox(bbox, trans2)
prop_patches=kwargs.copy()
prop_patches["ec"]="none"
prop_patches["alpha"]=0.2
c1, c2, bbox_patch1, bbox_patch2, p = \
connect_bbox(mybbox1, mybbox2,
loc1a=3, loc2a=2, loc1b=4, loc2b=1,
prop_lines=kwargs, prop_patches=prop_patches)
ax1.add_patch(bbox_patch1)
ax2.add_patch(bbox_patch2)
ax2.add_patch(c1)
ax2.add_patch(c2)
ax2.add_patch(p)
return c1, c2, bbox_patch1, bbox_patch2, p
示例11: plot
# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def plot(self, *args, **kwargs):
ps = self.env.ps
myc = self._get_class_config()
iter_list = self.config["iter_list"]
l, b, r, t = self.myc["bbox_rect"]
legend = self.myc.get("legend", True)
legend_kwargs = myc["legend_kwargs"]
xlabel = self.myc.get("xlabel", "P(bumps)")
ylabel = "Gridness score"
fig = self._get_final_fig(myc["fig_size"])
ax = fig.add_axes(Bbox.from_extents(l, b, r, t))
scatterColors = ["green", "red", "blue"]
scatterOrders = [2, 3, 1]
for ns_idx, noise_sigma in enumerate(ps.noise_sigmas):
isBumpData = aggr.IsBump(ps.bumpGamma[ns_idx], iter_list, ignoreNaNs=True)
gridData = aggr.GridnessScore(ps.grids[ns_idx], iter_list, ignoreNaNs=True, normalizeTicks=False)
scatterPlot = scatter.ScatterPlot(
isBumpData,
gridData,
None,
None,
None,
None,
None,
c=scatterColors[ns_idx],
s=6 * self.config["scale_factor"],
linewidth=0.3,
xlabel=xlabel,
ylabel=ylabel,
ax=ax,
zorder=scatterOrders[ns_idx],
)
scatterPlot.plot()
ax.xaxis.set_major_locator(ti.MultipleLocator(0.2))
ax.yaxis.set_major_locator(ti.MultipleLocator(0.5))
if legend:
leg = ["0", "150", "300"]
l = ax.legend(leg, **legend_kwargs)
plt.setp(l.get_title(), size="small")
# ax.set_ylabel(ax.get_ylabel(), y=0., ha='left')
# Normal scale
fname = self.config["output_dir"] + "/bumps_scatter_grids_vs_bumpFracTotal.pdf"
fig.savefig(fname, dpi=300, transparent=True)
# Exponential scale
ax.set_xscale("exponential")
ax.xaxis.set_major_locator(ti.MultipleLocator(0.5))
ax.xaxis.set_minor_locator(ti.MultipleLocator(0.1))
ax.set_xlim([-0.3, 1.002])
fname = self.config["output_dir"] + "/bumps_scatter_grids_vs_bumpFracTotal_exp.pdf"
fig.savefig(fname, dpi=300, transparent=True)
示例12: plotBumpSnapshots
# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def plotBumpSnapshots(FR, FRt, tstep, **kw):
'''Snapshots of bumps in time.'''
fig = kw.pop('fig')
timeTitles = kw.pop('timeTitles', True)
axesCoords = kw.pop('axesCoords', (0.12, 0.01, 0.92, 0.7))
axesDiv = kw.pop('axesDiv', .01)
bumpQuality = kw.pop('bumpQuality', False)
bumpQualityText = kw.pop('bumpQualityText', '')
bumpQualityX = kw.pop('bumpQualityX', -.9)
maxRateColor = kw.pop('maxRateColor', 'w')
left, bottom, right, top = axesCoords
width = right - left
height = top - bottom
indexes = range(0, FRt.shape[0], tstep)
oneWidth = float(width) / len(indexes)
l = left
bot = bottom
max = np.max(FR[:, :, indexes])
lastIndex = len(indexes) - 1
idx = 0
for it in indexes:
print(it)
t = bot + height
r = l + oneWidth - axesDiv
print(l, bot, r, top)
ax = fig.add_axes(Bbox.from_extents(l, bot, r, top))
plotBump(ax, FR[:, :, it], vmin=0, vmax=max, rasterized=True, **kw)
if idx == lastIndex:
rateText = "%.0f Hz" % max
ax.text(1.05, .95, rateText, ha='left', va='top',
color=maxRateColor, transform=ax.transAxes, size='small',
weight='bold', clip_on=False)
if bumpQuality and it == 0:
txt = '{0:.2f}'.format(bumpQuality)
ax.text(bumpQualityX, .5, txt, va='center', ha='center',
transform=ax.transAxes)
if timeTitles:
yTitle = 1.02
ax.text(.5, yTitle, "{0}".format(FRt[it]*1e-3), size='medium',
transform=ax.transAxes, va='bottom', ha='center')
if it == 0:
ax.text(.5, yTitle + .3, "t(s)", ha='center', va='bottom',
transform=ax.transAxes)
ax.text(bumpQualityX, yTitle, bumpQualityText, ha='center',
va='bottom', transform=ax.transAxes)
l += oneWidth
idx += 1
return max # Hack, but hopefully ok for now
示例13: onselect
# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def onselect(self, eclick, erelease):
if self.coord is None:
return
left, bottom = min(eclick.xdata, erelease.xdata), min(eclick.ydata, erelease.ydata)
right, top = max(eclick.xdata, erelease.xdata), max(eclick.ydata, erelease.ydata)
region = Bbox.from_extents(left, bottom, right, top)
selectedIds = []
for (xy, idd) in zip(self.matrix.values, self.matrix.ids):
if region.contains(xy[0], xy[1]):
selectedIds.append(idd)
self.coord.notifyModules(selectedIds)
示例14: onselect
# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def onselect(self, eclick, erelease):
if (self.coord is None): return
left, bottom = min(eclick.xdata, erelease.xdata), min(eclick.ydata, erelease.ydata)
right, top = max(eclick.xdata, erelease.xdata), max(eclick.ydata, erelease.ydata)
region = Bbox.from_extents(left, bottom, right, top)
selectedIds = []
for (x, y, idd) in zip(self.Xs, self.Ys, self.stats.ids):
if region.contains(x, y):
selectedIds.append(idd)
self.coord.notifyModules(selectedIds)
示例15: get_grid_info
# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import from_extents [as 别名]
def get_grid_info(self,
x1, y1, x2, y2):
"""
lon_values, lat_values : list of grid values. if integer is given,
rough number of grids in each direction.
"""
extremes = self.extreme_finder(self.inv_transform_xy, x1, y1, x2, y2)
lon_min, lon_max, lat_min, lat_max = extremes
lon_levs, lon_n, lon_factor = \
self.grid_locator1(lon_min, lon_max)
lat_levs, lat_n, lat_factor = \
self.grid_locator2(lat_min, lat_max)
if lon_factor is None:
lon_values = np.asarray(lon_levs[:lon_n])
else:
lon_values = np.asarray(lon_levs[:lon_n]/lon_factor)
if lat_factor is None:
lat_values = np.asarray(lat_levs[:lat_n])
else:
lat_values = np.asarray(lat_levs[:lat_n]/lat_factor)
lon_lines, lat_lines = self._get_raw_grid_lines(lon_values,
lat_values,
lon_min, lon_max,
lat_min, lat_max)
ddx = (x2-x1)*1.e-10
ddy = (y2-y1)*1.e-10
bb = Bbox.from_extents(x1-ddx, y1-ddy, x2+ddx, y2+ddy)
grid_info = {}
grid_info["extremes"] = extremes
grid_info["lon_lines"] = lon_lines
grid_info["lat_lines"] = lat_lines
grid_info["lon"] = self._clip_grid_lines_and_find_ticks(lon_lines,
lon_values,
lon_levs,
bb)
grid_info["lat"] = self._clip_grid_lines_and_find_ticks(lat_lines,
lat_values,
lat_levs,
bb)
grid_info["lon"]["tick_labels"] = dict()
tck_labels = grid_info["lon"]["tick_labels"]
for direction in ["left", "bottom", "right", "top"]:
levs = grid_info["lon"]["tick_levels"][direction]
tck_labels[direction] = self.tick_formatter1(direction,
lon_factor, levs)
grid_info["lat"]["tick_labels"] = dict()
tck_labels = grid_info["lat"]["tick_labels"]
for direction in ["left", "bottom", "right", "top"]:
levs = grid_info["lat"]["tick_levels"][direction]
tck_labels[direction] = self.tick_formatter2(direction,
lat_factor, levs)
return grid_info