本文整理汇总了Python中GeneralUtil.python.PlotUtilities.tickAxisFont方法的典型用法代码示例。如果您正苦于以下问题:Python PlotUtilities.tickAxisFont方法的具体用法?Python PlotUtilities.tickAxisFont怎么用?Python PlotUtilities.tickAxisFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeneralUtil.python.PlotUtilities
的用法示例。
在下文中一共展示了PlotUtilities.tickAxisFont方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import tickAxisFont [as 别名]
def run():
"""
<Description>
Args:
param1: This is the first param.
Returns:
This is a description of what is returned.
"""
n_samples = int(1e4)
sigma = 1
loc_arr = [-3,-1,0.5]
n_bins = 50
ylim = [0,0.6]
n_cols = 3+1
xlim = [-12,12]
bins = np.linspace(*xlim,endpoint=True,num=n_bins)
fig = PlotUtilities.figure((12,7))
plt.subplot(1,n_cols,1)
bhattacharya,x1,x2 = plot_bhattacharya(sigma,n_samples,bins=bins,
loc=-9)
plt.xlim(xlim)
PlotUtilities.tickAxisFont()
PlotUtilities.xlabel("Distribution Value")
PlotUtilities.ylabel("Probability")
PlotUtilities.legend(frameon=False)
plt.ylim(ylim)
title = p_label(bhattacharya,x1,x2)
PlotUtilities.title(title)
for i,loc in enumerate(loc_arr):
plt.subplot(1,n_cols,(i+2))
bhattacharya,x1,x2 = plot_bhattacharya(sigma,n_samples,bins,
loc=loc)
title = p_label(bhattacharya,x1,x2)
PlotUtilities.title(title)
plt.xlim(xlim)
plt.ylim(ylim)
PlotUtilities.tickAxisFont()
PlotUtilities.no_y_label()
PlotUtilities.legend(frameon=False)
PlotUtilities.xlabel("")
PlotUtilities.savefig(fig,"bcc.pdf",subplots_adjust=dict(wspace=0.1))
示例2: run
# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import tickAxisFont [as 别名]
def run(base="./"):
"""
"""
out_base = base
data_file = "../FigurePerformance_CS/data/Scores.pkl"
force=False
events_off = CheckpointUtilities.getCheckpoint("cache_dist.pkl",
dist_values,force,
data_file)
max_with_error = 0
min_with_error = np.inf
# get the bounds
for i,(args,x,name) in enumerate(events_off):
max_with_error = max(max_with_error,max(args))
min_with_error = min(min_with_error,min(args))
ylim = [min_with_error/2,max_with_error*2]
# plot everything
fig = PlotUtilities.figure((16,8))
n_cols = 3
parameters = ["FEATHER probability","OpenFovea sensitivity",
"Scientific Python minimum SNR"]
markers = Plotting.algorithm_markers()
colors = Plotting.algorithm_colors()
for i,(args,x,name) in enumerate(events_off):
first = (i == 0)
param = parameters[i]
xlabel = "Tuning Parameter\n({:s})".format(param)
ylabel = "" if not first else "BCC"
plt.subplot(1,n_cols,(i+1))
lazy_kwargs = dict(useLegend=first,
frameon=True)
plt.loglog(x,args,marker=markers[i],linestyle='-',color=colors[i],
markersize=7)
plot_name = Plotting.algorithm_title_dict()[name]
title = "Tuning curve for {:s}".format(plot_name)
PlotUtilities.lazyLabel(xlabel,ylabel,title,**lazy_kwargs)
PlotUtilities.tickAxisFont()
plt.ylim([min_with_error/2,max_with_error*2])
loc = (-0.10,1.025)
PlotUtilities.label_tom(fig,loc=loc)
PlotUtilities.savefig(fig,out_base + "tuning.pdf")
示例3: plot
# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import tickAxisFont [as 别名]
def plot(interp,split_fec,f,xlim_rel_start,xlim_rel_delta,
when_to_break=_dont_break):
# calculate all the things we will neeed
time_sep_force = f(split_fec)
x_plot,y_plot = Plotting.plot_format(time_sep_force)
n_filter_points = 1000
x_raw = time_sep_force.Time
y_raw = time_sep_force.Force
interp_raw = interp(x_raw)
diff_raw = y_raw - interp_raw
stdev = Analysis.local_stdev(diff_raw,n=split_fec.tau_num_points)
xlims_rel = [ [i,i+xlim_rel_delta] for i in xlim_rel_start]
# convert to plotting units
n = x_plot.size
slices_abs = [ slice(int(i*n),int(f*n),1) for i,f in xlims_rel ]
x_plot_slices = [ x_plot[s] for s in slices_abs ]
diff_raw_slices = [diff_raw[s] for s in slices_abs]
max_raw_diff_slices = [max(d) for d in diff_raw_slices]
min_raw_diff_slices = [min(d) for d in diff_raw_slices]
range_raw_diff_slices = np.array([min(min_raw_diff_slices),
max(max_raw_diff_slices)])
range_raw_diff = np.array([min(diff_raw),max(diff_raw)])
range_plot_diff = f_plot_y(range_raw_diff*1.1)
xlim_abs = [ [min(x),max(x)] for x in x_plot_slices]
n_plots = len(x_plot_slices)
# set up the plot styling
style_approach = dict(color='b')
style_raw = dict(alpha=0.3,**style_approach)
style_interp = dict(linewidth=3,**style_approach)
colors = ['r','m','k']
style_regions = []
for c in colors:
style_tmp = dict(**style_raw)
style_tmp['color'] = c
style_regions.append(style_tmp)
gs = gridspec.GridSpec(3,2*n_plots)
plt.subplot(gs[0,:])
plot_force(x_plot,y_plot,interp_raw,style_raw,style_interp)
# highlight all the residual regions in their colors
for style_tmp,slice_tmp in zip(style_regions,slices_abs):
if (when_to_break == _break_after_interp):
break
style_interp_tmp = dict(**style_tmp)
style_interp_tmp['alpha'] = 1
plt.plot(x_plot[slice_tmp],y_plot[slice_tmp],**style_tmp)
plt.plot(x_plot[slice_tmp],f_plot_y(interp_raw[slice_tmp]),linewidth=3,
**style_interp_tmp)
if (when_to_break == _break_after_first_zoom):
break
ax_diff = plt.subplot(gs[1,:])
plot_residual(x_plot,diff_raw,style_raw)
# highlight all the residual regions in their colors
for style_tmp,slice_tmp in zip(style_regions,slices_abs):
if (when_to_break == _break_after_interp):
break
plt.plot(x_plot[slice_tmp],f_plot_y(diff_raw)[slice_tmp],**style_tmp)
if (when_to_break == _break_after_first_zoom):
break
plt.ylim(range_plot_diff)
tick_kwargs = dict(right=False)
# plot all the subregions
for i in range(n_plots):
xlim_tmp = xlim_abs[i]
ylim_tmp = range_plot_diff
"""
plot the raw data
"""
offset_idx = 2*i
ax_tmp = plt.subplot(gs[-1,offset_idx])
diff_tmp = diff_raw_slices[i]
# convert everything to plotting units
diff_plot_tmp =f_plot_y(diff_tmp)
x_plot_tmp = x_plot_slices[i]
style_tmp = style_regions[i]
if (when_to_break != _break_after_interp):
plt.plot(x_plot_tmp,diff_plot_tmp,**style_tmp)
PlotUtilities.no_x_anything()
if (i != 0):
PlotUtilities.no_y_label()
PlotUtilities.tickAxisFont(**tick_kwargs)
else:
PlotUtilities.lazyLabel("","Force (pN)","",tick_kwargs=tick_kwargs)
plt.xlim(xlim_tmp)
plt.ylim(ylim_tmp)
if (when_to_break != _break_after_interp):
PlotUtilities.zoom_effect01(ax_diff, ax_tmp, *xlim_tmp)
if (i == 0 and (when_to_break != _break_after_interp)):
# make a scale bar for this plot
time = 20e-3
string = "{:d} ms".format(int(time*1000))
PlotUtilities.scale_bar_x(np.mean(xlim_tmp),0.8*max(ylim_tmp),
s=string,width=time,fontsize=15)
"""
plot the histogram
"""
ax_hist = plt.subplot(gs[-1,offset_idx+1])
if (i == 0):
PlotUtilities.xlabel("Count")
else:
PlotUtilities.no_x_label()
#.........这里部分代码省略.........
示例4: rupture_plot
# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import tickAxisFont [as 别名]
#.........这里部分代码省略.........
bins_rupture = _bins_rupture_plot
if (bins_load is None):
bins_load = _bins_load_plot
if (lim_plot_load is None):
lim_plot_load = _lim_load_plot
if (lim_plot_force is None):
lim_plot_force = _lim_force_plot
if (distance_histogram is not None):
ax_hist = plt.subplot(gs[:,0])
histogram_event_distribution(**distance_histogram)
ax0 = subplot_f(gs[0,offset])
plot_true_and_predicted_ruptures(true,pred,**scatter_kwargs)
PlotUtilities.xlabel("")
plt.xlim(lim_plot_load)
plt.ylim(lim_plot_force)
PlotUtilities.title(title)
if (remove_ticks):
ax0.get_xaxis().set_ticklabels([])
ax1 =subplot_f(gs[0,offset+1])
hatch_true = true_hatch()
true_style_histogram = _histogram_true_style(color_true=color_true,
label="true")
pred_style_histogram = _histogram_predicted_style(color_pred=color_pred,
label="predicted")
# for the rupture force, we dont add the label
rupture_force_true_style = dict(**true_style_histogram)
rupture_force_true_style['label'] = None
rupture_force_pred_style = dict(**pred_style_histogram)
rupture_force_pred_style['label'] = None
rupture_force_histogram(pred,orientation='horizontal',bins=bins_rupture,
**rupture_force_pred_style)
rupture_force_histogram(true,orientation='horizontal',bins=bins_rupture,
**rupture_force_true_style)
PlotUtilities.lazyLabel("Count","","")
ax = plt.gca()
# push count to the top
ax.xaxis.tick_top()
ax.xaxis.set_label_position('top')
if (remove_ticks):
ax1.get_yaxis().set_ticklabels([])
if (count_limit is not None):
plt.xlim(count_limit)
plt.ylim(lim_plot_force)
plt.xscale('log')
ax4 = subplot_f(gs[1,offset])
n_pred,_,_ = loading_rate_histogram(pred,orientation='vertical',
bins=bins_load,
**pred_style_histogram)
n_true,_,_, = loading_rate_histogram(true,orientation='vertical',
bins=bins_load,**true_style_histogram)
if (count_limit is None and (len(n_pred) * len(n_true) > 0)):
max_n = np.max([n_pred,n_true])
count_limit = [0.5,max_n*10]
else:
count_limit = plt.ylim()
PlotUtilities.lazyLabel("loading rate (pN/s)","Count","",frameon=False,
loc='upper left',useLegend=use_legend)
plt.xscale('log')
plt.yscale('log')
plt.xlim(lim_plot_load)
plt.ylim(count_limit)
ax3 = subplot_f(gs[1,offset+1])
if (len(loading_pred) > 0):
coeffs = Analysis.\
bc_coeffs_load_force_2d(loading_true,loading_pred,bins_load,
ruptures_true,ruptures_pred,bins_rupture)
# just get the 2d (last one
coeffs = [1-coeffs[-1]]
else:
coeffs = [0]
labels_coeffs = [r"BCC"]
# add in the relative distance metrics, if the are here
if (distance_histogram is not None):
_,_,cat_relative_median,cat_relative_q,q = \
Offline.relative_and_absolute_median_and_q(**distance_histogram)
coeffs.append(cat_relative_q)
q_fmt = str(int(q))
labels_coeffs.append(r"P$_{" + q_fmt + "}$")
coeffs = np.array(coeffs)
# an infinite coefficient (or nan) is just one (worst possible)
coeffs[np.where(~np.isfinite(coeffs))] = 1
index = np.array([i for i in range(len(coeffs))])
bar_width = 0.5
rects1 = plt.bar(index, coeffs,alpha=0.3,color=color_pred)
label_func = lambda i,r: "{:.3g}".format(r.get_height())
y_func = lambda i,r: r.get_height()/2
PlotUtilities.autolabel(rects1,label_func=label_func,y_func=y_func,
fontsize=PlotUtilities.g_font_legend,
fontweight='bold')
plt.xticks(index, labels_coeffs,
rotation=0,fontsize=PlotUtilities.g_font_label)
PlotUtilities.ylabel("Metric")
PlotUtilities.tickAxisFont()
# push metric to the right
ax = plt.gca()
ax.yaxis.tick_right()
ax.yaxis.set_label_position('right')
ax.tick_params(axis=u'x', which=u'both',length=0)
plt.ylim([0,1])