Exemplo n.º 1
0
    def write(self, output_path):
        if not os.path.exists(output_path):
            os.makedirs(output_path)

        doc = Document(filename='table4',
                       filepath=output_path,
                       doc_type='article',
                       options=('12pt', ))
        doc.add_to_preamble(r"\usepgfplotslibrary{fillbetween}")
        doc.add_to_preamble(r'\usepgfplotslibrary{colorbrewer}')
        doc.add_to_preamble(r'\pgfplotsset{compat=1.15, colormap/Blues}')

        sec = doc.new_section('All graphs')

        self.write_CSLS(sec, output_path)
        self.write_vocabulary_cutoff(sec, output_path)
        self.write_stochastic(sec, output_path)

        doc.build(save_to_disk=True, compile_to_pdf=False, show_pdf=False)
Exemplo n.º 2
0
    def write(self, output_path):
        if not os.path.exists(output_path):
            os.makedirs(output_path)

        doc = Document(filename='grid_search_experiments',
                       filepath=output_path,
                       doc_type='article',
                       options=('12pt', ))
        doc.add_to_preamble(r"\usepgfplotslibrary{fillbetween}")
        doc.add_to_preamble(r'\usepgfplotslibrary{colorbrewer}')
        doc.add_to_preamble(
            r'\pgfplotsset{compat=1.15, colormap/Blues, every axis/.append style={label style={font=\footnotesize}, tick label style={font=\footnotesize}}}'
        )

        sec = doc.new_section('All graphs')

        self.write_CSLS(sec, output_path)
        self.write_vocabulary_cutoff(sec, output_path)
        self.write_stochastic(sec, output_path)

        doc.build(save_to_disk=True, compile_to_pdf=False, show_pdf=False)
Exemplo n.º 3
0
from python2latex import Document, Plot, Color
import numpy as np

# Create the document
filepath = './examples/plot examples/more complex matrix plot example'
filename = 'more_complex_matrix_plot_example'
doc = Document(filename, doc_type='article', filepath=filepath)
sec = doc.new_section('More complex matrix plot')
sec.add_text(
    'This section shows how to make a more complex matrix plot integrated directly into a tex file.'
)

# Adding necessary library to preamble for colormaps
doc.add_to_preamble(r'\usepgfplotslibrary{colorbrewer}')
doc.add_to_preamble(r'\pgfplotsset{compat=1.15, colormap/Blues-3}')

# Create the data
X = np.array([0.05, 0.1, 0.2])
Y = np.array([1.5, 2.0, 3.0, 4.0])
Z = np.random.random((3, 4))

# Create a plot
plot = sec.new(
    Plot(plot_name=filename,
         plot_path=filepath,
         grid=False,
         lines=False,
         enlargelimits='false',
         width=r'.6\textwidth',
         height=r'.8\textwidth'))
plot.caption = 'Matrix plot of some random numbers as probabilities'