本文整理汇总了Python中GeneralUtil.python.PlotUtilities.color_frame方法的典型用法代码示例。如果您正苦于以下问题:Python PlotUtilities.color_frame方法的具体用法?Python PlotUtilities.color_frame怎么用?Python PlotUtilities.color_frame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeneralUtil.python.PlotUtilities
的用法示例。
在下文中一共展示了PlotUtilities.color_frame方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_pedagogical_plot
# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import color_frame [as 别名]
def make_pedagogical_plot(data_to_plot,kw,out_name="./iwt_diagram"):
heatmap_data = data_to_plot.heatmap_data
data = landscape_data(data_to_plot.landscape)
fig = PlotUtilities.figure((3.25,5))
# # ploy the heat map
ax_heat = plt.subplot(3,1,1)
heatmap_plot(heatmap_data,data.amino_acids_per_nm(),
kw_heatmap=kw['kw_heatmap'])
xlim_fec = plt.xlim()
PlotUtilities.no_x_label(ax_heat)
ax_heat.set_ylim([0,150])
PlotUtilities.no_x_label(ax_heat)
PlotUtilities.no_y_label(ax_heat)
fontsize_scalebar = 6
common_kw = dict(color='w',fontsize=fontsize_scalebar)
x_font,y_font = Scalebar.\
font_kwargs_modified(x_kwargs=common_kw,
y_kwargs=common_kw)
heat_kw_common = dict(line_kwargs=dict(color='w',linewidth=1.5))
x_heat_kw = dict(width=15,unit="nm",font_kwargs=x_font,**heat_kw_common)
y_heat_kw = dict(height=30,unit='pN ',font_kwargs=y_font,**heat_kw_common)
# add a scale bar for the heatmap...
scale_bar_x = 0.83
Scalebar.crossed_x_and_y_relative(scale_bar_x,0.55,ax=ax_heat,
x_kwargs=x_heat_kw,
y_kwargs=y_heat_kw)
jcp_fig_util.add_helical_boxes(ax=ax_heat,ymax_box=0.9,alpha=1.0,
font_color='w',offset_bool=True)
# # plot the energy landscape...
ax_correction = plt.subplot(3,1,2)
plot_with_corrections(data)
PlotUtilities.no_x_label(ax_correction)
PlotUtilities.lazyLabel("","Energy (kcal/mol)","")
ax_correction.set_xlim(xlim_fec)
offset_y_pedagogy = 0.42
setup_pedagogy_ticks(ax_correction,scale_bar_x,x_heat_kw,y_heat_kw,
offset_y=offset_y_pedagogy)
legend_font_size = 9
legend = PlotUtilities.legend(handlelength=1.5,loc=(0.15,0.07),ncol=3,
fontsize=legend_font_size,handletextpad=0.4)
for i,text in enumerate(legend.get_texts()):
plt.setp(text, color = kwargs_correction()[i]['color'])
# make the inset plot
axins = zoomed_inset_axes(ax_correction, zoom=3, loc=2,
borderpad=0.8)
plot_with_corrections(data)
xlim_box = [1,5]
ylim_box = [-3,28]
plt.xlim(xlim_box)
plt.ylim(ylim_box)
PlotUtilities.no_x_anything(axins)
PlotUtilities.no_y_anything(axins)
# add in scale bars
kw_common = dict(line_kwargs=dict(linewidth=0.75,color='k'))
common_font_inset = dict(fontsize=fontsize_scalebar)
x_kwargs = dict(verticalalignment='top',**common_font_inset)
x_font,y_font = Scalebar.\
font_kwargs_modified(x_kwargs=x_kwargs,
y_kwargs=dict(horizontalalignment='right',
**common_font_inset))
# set up the font, offset ('fudge') the text from the lines
fudge_x = dict(x=0,y=-0.5)
fudge_y = dict(x=0,y=0.1)
Scalebar.crossed_x_and_y_relative(0.55,0.66,ax=axins,
x_kwargs=dict(width=2,unit="nm",
font_kwargs=x_font,
fudge_text_pct=fudge_x,
**kw_common),
y_kwargs=dict(height=8,unit='kcal/\nmol',
font_kwargs=y_font,
fudge_text_pct=fudge_y,
**kw_common))
# draw a bbox of the region of the inset axes in the parent axes and
# connecting lines between the bbox and the inset axes area
color_box = 'rebeccapurple'
PlotUtilities.color_frame('rebeccapurple',ax=axins)
Annotations.add_rectangle(ax_correction,xlim_box,ylim_box,edgecolor=color_box)
ax_correction.set_xlim(xlim_fec)
ax_energy = plt.subplot(3,1,3)
plot_landscape(data,xlim_fec,kw_landscape=kw['kw_landscape'],
plot_derivative=False,label_deltaG=" ")
ax_energy.set_xlim(xlim_fec)
setup_pedagogy_ticks(ax_energy,scale_bar_x,x_heat_kw,y_heat_kw,
offset_y=offset_y_pedagogy)
# add in the equation notation
strings,colors = [],[]
labels = kwargs_labels()
# add in the appropriate symbols
strings = ["$\Delta G$ = ",labels[0]," + ",labels[1]," - ",labels[2]]
colors_labels = [c['color'] for c in kwargs_correction()]
colors = ["k"] + [item for list in [[c,"k"] for c in colors_labels]
for item in list]
x,y = Scalebar.x_and_y_to_abs(x_rel=0.08,y_rel=0.85,ax=ax_energy)
Annotations.rainbow_text(x,y,strings=strings,colors=colors,
ax=ax_energy,size=legend_font_size)
PlotUtilities.legend(handlelength=0.5,loc=(0.03,0.8))
PlotUtilities.no_x_label(ax_energy)
PlotUtilities.save_png_and_svg(fig,out_name)