def make_frame(frameidx, filename): frame = makefigure.FrameData(frameidx) # make the pdf row = makefigure.make_figure(frame, True, False) figuregen.horizontal_figure(row, 17.7, filename, tex_packages=["{dfadobe}"]) # convert to .png images = convert_from_path(filename, dpi=1000) img = np.array(images[0]) cv2.imwrite(filename.replace(".pdf", ".png"), cv2.cvtColor(img, cv2.COLOR_RGB2BGR))
grid1.set_col_titles('south', ['Blue', 'Yellow']) layout1.set_col_titles('south', field_size_mm=4., offset_mm=0.2, bg_color=[[200, 200, 255], [255, 255, 200]]) grid1.set_row_titles('east', ['Awesome 1', 'Awesome 2']) layout1.set_row_titles('east', field_size_mm=3., bg_color=[186, 98, 82], txt_color=[255, 255, 255]) grid1.set_title('north', 'Top Title') # ---- Grid Module ---- grid2 = single_module.grid # ------ ALL ------ modules = [grid0, grid1, grid2] if __name__ == "__main__": figuregen.horizontal_figure(modules, width_cm=18., filename='multimodule_test.pdf') figuregen.horizontal_figure(modules, width_cm=18., filename='multimodule_test.pptx') figuregen.horizontal_figure(modules, width_cm=18., filename='multimodule_test.html')
res = "\\DeclareDocumentCommand{\\Outlined}{ O{black} O{white} O{0.55pt} m }{"\ "\\contourlength{#3}"\ "\\contour{#2}{\\textcolor{#1}{#4}}"\ "}" res += "\\definecolor{FillClr}{RGB}{" + f"{text_clr[0]},{text_clr[1]},{text_clr[2]}" + "}" res += "\\definecolor{StrokeClr}{RGB}{" + f"{outline_clr[0]},{outline_clr[1]},{outline_clr[2]}" + "}" res += "\\Outlined[FillClr][StrokeClr][0.55pt]{" + org + "}" return res e.set_label( outline("relMSE: ") + outline(f"{err_bal:.2f}") + "\n" + outline("Balance heur."), "top_left", **label_params) e.set_label( outline("Ours") + "\n" + outline("relMSE: ") + outline(f"{err_our:.2f}"), "bottom_right", **label_params) i += 1 grid.set_col_titles("bottom", ["10 shadow rays", "50 shadow rays", "100 shadow rays"]) grid.get_layout().set_col_titles("bottom", fontsize=8, field_size_mm=2.8, offset_mm=0.25) figuregen.horizontal_figure( [grid], 8.4, "SplitComparison.pdf", tex_packages=["{dfadobe}", "[outline]{contour}", "{color}"])
plot.set_v_line(pos=vline_positions[idx][0], color=colors[baseline], linestyle=(0, (4, 6)), linewidth_pt=0.6) plot.set_v_line(pos=vline_positions[idx][1], color=colors[3], linestyle=(-5, (4, 6)), linewidth_pt=0.6) plot_module = figuregen.Grid(1, 1) plot_module.get_element(0, 0).set_image(plot) # ---- TOGETHER ---- modules = [ref_grid, comp_grid, plot_module] if __name__ == "__main__": figuregen.horizontal_figure(modules, width_cm=18., filename=scene[idx] + '-siggraph.pdf') figuregen.horizontal_figure(modules, width_cm=18., filename=scene[idx] + '-siggraph.pptx') figuregen.horizontal_figure(modules, width_cm=18., filename=scene[idx] + '-siggraph.html') try: from figuregen.util import jupyter jupyter.convert(scene[idx] + '-siggraph.pdf', 300) except: print('Warning: pdf could not be converted to png')
import figuregen import numpy as np img_blue = np.tile([x / 255 for x in [94, 163, 188]], (32, 64, 1)) img_yellow = np.tile([x / 255 for x in [232, 181, 88]], (32, 64, 1)) grid = figuregen.Grid(1, 2) grid[0, 0].set_image(figuregen.JPEG(img_blue)) grid[0, 1].set_image(figuregen.JPEG(img_yellow)) figuregen.horizontal_figure([grid], 8, "jpeg_export.pdf") figuregen.horizontal_figure([grid], 8, "jpeg_export.pptx") figuregen.horizontal_figure([grid], 8, "jpeg_export.html") grid = figuregen.Grid(1, 2) grid[0, 0].set_image(figuregen.PNG(img_blue)) grid[0, 1].set_image(figuregen.PNG(img_yellow)) figuregen.horizontal_figure([grid], 8, "png_export.pdf") figuregen.horizontal_figure([grid], 8, "png_export.pptx") figuregen.horizontal_figure([grid], 8, "png_export.html")
import multi_module import matplot_module import figuregen import figuregen.util multi_type_modules = [ multi_module.grid0, multi_module.grid1, matplot_module.plot_module, ] if __name__ == "__main__": figuregen.horizontal_figure(multi_type_modules, width_cm=18., filename='multiplot_test.pdf') figuregen.horizontal_figure(multi_type_modules, width_cm=18., filename='multiplot_test.pptx') figuregen.horizontal_figure(multi_type_modules, width_cm=18., filename='multiplot_test.html')