text
stringlengths
0
828
mpl.use('Agg')
import matplotlib.pyplot as plt
plt.style.use('seaborn')
# general settings
mpl.rcParams['font.size'] = 7.0
mpl.rcParams['axes.labelsize'] = 7.0
mpl.rcParams['xtick.labelsize'] = 7.0
mpl.rcParams['ytick.labelsize'] = 7.0
mpl.rcParams[""lines.linewidth""] = 1.5
mpl.rcParams[""lines.markeredgewidth""] = 3.0
mpl.rcParams[""lines.markersize""] = 3.0
# mpl.rcParams['font.sans-serif'] = 'Droid Sans'
# mpl.rcParams['font.family'] = 'Open Sans'
# mpl.rcParams['font.weight'] = 400
mpl.rcParams['mathtext.default'] = 'regular'
# mpl.rcParams['font.family'] = 'Droid Sans'
if use_latex:
mpl.rcParams['text.usetex'] = True
mpl.rc(
'text.latex',
preamble=''.join((
# r'\usepackage{droidsans}',
# r'\usepackage[T1]{fontenc} ',
r'\usepackage{sfmath} \renewcommand{\rmfamily}{\sffamily}',
r'\renewcommand\familydefault{\sfdefault} ',
# r'\usepackage{mathastext} '
))
)
else:
mpl.rcParams['text.usetex'] = False
import mpl_toolkits.axes_grid1 as axes_grid1
axes_grid1
return plt, mpl"
602,"def mpl_get_cb_bound_below_plot(ax):
""""""
Return the coordinates for a colorbar axes below the provided axes object.
Take into account the changes of the axes due to aspect ratio settings.
Parts of this code are taken from the transforms.py file from matplotlib
Important: Use only AFTER fig.subplots_adjust(...)
Use as:
=======
""""""
position = ax.get_position()
figW, figH = ax.get_figure().get_size_inches()
fig_aspect = figH / figW
box_aspect = ax.get_data_ratio()
pb = position.frozen()
pb1 = pb.shrunk_to_aspect(box_aspect, pb, fig_aspect).bounds
ax_size = ax.get_position().bounds
# the colorbar is set to 0.01 width
sizes = [ax_size[0], ax_size[1] - 0.14, pb1[2], 0.03]
return sizes"
603,"def main():
""""""Generate an XLS with specified content.""""""
table = """"""<table>
<thead>
<tr><th>First Name</th><th>Last Name</th></tr>
</thead>
<tbody>
<tr><td>Paul</td><td>McGrath</td></tr>
<tr><td>Liam</td><td>Brady</td></tr>
<tr><td>John</td><td>Giles</td></tr>
</tbody>
</table>""""""
docraptor = DocRaptor()
print(""Create test_basic.xls"")
with open(""test_basic.xls"", ""wb"") as pdf_file:
pdf_file.write(
docraptor.create(
{""document_content"": table, ""document_type"": ""xls"", ""test"": True}
).content
)"
604,"def restore_gc_state():
""""""
Restore the garbage collector state on leaving the with block.
""""""
old_isenabled = gc.isenabled()
old_flags = gc.get_debug()
try:
yield
finally:
gc.set_debug(old_flags)
(gc.enable if old_isenabled else gc.disable)()"
605,"def develop_link(options, info):