コード例 #1
0
 def test_build_with_body_and_packages(self):
     doc = Document('With options', doc_type='standalone', options=['12pt', 'Spam'], egg=42)
     doc.add_package('tikz')
     sec = doc.new_section('Section', label='Section')
     sec.add_text('Hey')
     assert doc.build(False, False, False) == cleandoc(r'''\documentclass[12pt, Spam, egg=42]{standalone}
         \usepackage[utf8]{inputenc}
         \usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry}
         \usepackage{tikz}
         \begin{document}
         \begin{section}{Section}
         \label{section:Section}
         Hey
         \end{section}
         \end{document}''')
コード例 #2
0
    enlargelimits='false',
    y_dir='reverse',
    axis_x='top',
    x_tick_label_style='{font=\\footnotesize}',
    y_tick_label_style='{font=\\footnotesize}',
    colorbar_style=
    '{ylabel=Attention, ylabel style={rotate=180}, yticklabels={0.00,0.25,0.50,0.75,1.00}, ytick={0,0.25,0.5,0.75,1}}'
)

plot.add_matrix_plot(X, Y, Z)
for i, zz in enumerate(Z):
    for j, z in enumerate(zz):
        if z > .6:
            plot.axis += f'\\node[white] at ({i},{j}) {{\\scriptsize {z:.2f} }};'

plot.add_to_preamble(cmap_def)

plot.x_ticks = range(len(sentences[0]))
plot.x_ticks_labels = sentences[0]
plot.y_ticks = range(len(sentences[1]))
plot.y_ticks_labels = sentences[1]

doc = Document('heatmap_example',
               filepath='./examples/',
               doc_type='standalone')
doc.add_package('xcolor')

doc += plot

doc.build(delete_files=['log', 'aux'])