How to use the tikzplotlib.save function in tikzplotlib

To help you get started, we’ve selected a few tikzplotlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pkorus / neural-imaging / diff_nip.py View on Github external
if patch_size > 0:
        print('Cropping a {p}x{p} patch from the middle'.format(p=patch_size))
        xx = (sample_x.shape[2] - patch_size // 2) // 2
        yy = (sample_x.shape[1] - patch_size // 2) // 2
        sample_x = sample_x[:, yy:yy+patch_size, xx:xx+patch_size, :]
        sample_y = sample_y[:, 2*yy:2*(yy+patch_size), 2*xx:2*(xx+patch_size), :]
        sample_ya = sample_ya[:, 2*yy:2*(yy+patch_size), 2*xx:2*(xx+patch_size), :]
        sample_yb = sample_yb[:, 2*yy:2*(yy+patch_size), 2*xx:2*(xx+patch_size), :]

    # Plot images
    fig = imdiff.compare_ab_ref(sample_y, sample_ya, sample_yb, fig=plt.figure(), extras=extras)

    if output_dir is not None:
        from tikzplotlib import save as tikz_save
        dcomp = [x for x in fsutil.split(model_b_dirname) if re.match('(ln-.*|[0-9]{3})', x)]
        tikz_save('{}/examples_{}_{}_{}_{}.tex'.format(output_dir, camera, image, model_a_dirname, model_b_dirname), figureheight='8cm', figurewidth='8cm', strict=False)
    else:
        fig.tight_layout()
        fig.show(fig)

    fig.suptitle('{}, A={}, B={}'.format(image, model_a.model_code, model_b.model_code))
    plt.show()
    plt.close(fig)
github MStarmans91 / WORC / WORC / plotting / plot_barchart.py View on Github external
parameters[k] = list()
                parameters[k].append(parameters_all[k])

    # Count for every parameter how many times a setting occurs
    counts = count_parameters(parameters)

    # Normalize the values
    normalization_factor = len(prediction.classifiers) * estimators

    # Make the barplot
    fig = plot_bars(counts, normalization_factor)

    # Save the output
    if output_tex is not None:
        print(f'Saving barchart to {output_tex}.')
        tikzplotlib.save(output_tex)

    if output_png is not None:
        print(f'Saving barchart to {output_png}.')
        fig.savefig(output_png, bbox_inches='tight', pad_inches=0, dpi=50)

tikzplotlib

Convert matplotlib figures into TikZ/PGFPlots

MIT
Latest version published 3 years ago

Package Health Score

52 / 100
Full package analysis

Popular tikzplotlib functions

Similar packages