Cropbox(top=100, left=450, height=96, width=128, scale=5), ], method_names=[ "Reference", "Path Tracer", "UPS+MCMC", "Radiance-based", "Ours" ]).figure figuregen.figure(figure, width_cm=17.7, filename="full_size_with_crops.pdf") try: from figuregen.util import jupyter jupyter.convert('full_size_with_crops.pdf', 300) except: print('Warning: pdf could not be converted to png') # Create the same figure again, but this time with the crops on the right hand side of each image figure = FullSizeWithCrops(reference_image=sio.read("images/pool/pool.exr"), method_images=[ sio.read("images/pool/pool-60s-path.exr"), sio.read("images/pool/pool-60s-radiance.exr"), sio.read("images/pool/pool-60s-full.exr"), ], crops=[ Cropbox(top=100, left=200, height=96, width=128,
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')
grid.set_col_titles("top", variance_captions) grid.get_layout().set_col_titles("top", 3, offset_mm=0.5, fontsize=8) # Add space between the rows (needs to be removed for the last one) grid.get_layout().set_padding(bottom=2) return [grid] rows = [ make_row("BalanceOptimal", "1) Product", problem_range=[0,2.5]), make_row("Defensive", "2) Defensive", problem_range=[0,2.5]), make_row("Stratified", "3) Stratified", True, problem_range=[0,4.5], show_titles=True), ] # Remove bottom padding from the last row rows[-1][0].get_layout().set_padding(bottom=0) if __name__ == "__main__": import time start = time.time() figuregen.figure(rows, 15.4, "plotgrid.pdf") figuregen.figure(rows, 15.4, "plotgrid.pptx") figuregen.figure(rows, 15.4, "plotgrid.html") print(time.time() - start) try: from figuregen.util import jupyter jupyter.convert('plotgrid.pdf', 300) except: print('Warning: pdf could not be converted to png')
s_img.get_end_positions(), linewidth_pt=0.5, color=[0, 0, 0]) top_grid.set_col_titles('top', ['Horizontal Split', 'Vertical Split', 'C)', 'D)']) # LAYOUT: Specify paddings (unit: mm) top_lay = top_grid.get_layout() top_lay.set_padding(column=1.0, right=1.5) top_lay.set_col_titles('top', field_size_mm=5.0) if __name__ == "__main__": width_cm = 15 basename = "split-comparison" figuregen.figure([[top_grid]], width_cm=width_cm, filename=basename + '.pdf', backend=figuregen.PdfBackend(intermediate_dir="log")) figuregen.figure([[top_grid]], width_cm=width_cm, filename=basename + '.pptx') figuregen.figure([[top_grid]], width_cm=width_cm, filename=basename + '.html') try: from figuregen.util import jupyter jupyter.convert(basename + '.pdf', 300) except: print('Warning: pdf could not be converted to png')
txt_color=[255, 255, 255]) grid.set_title('south', 'Bottom Title') #use defaults grid.set_title('right', 'Right Title') #use defaults grid.set_title('left', 'Left Title') layout.set_title('left', 4., offset_mm=2., fontsize=12) # Row and column titles grid.set_row_titles('left', ['Row titles', 'are better']) layout.set_row_titles('left', 10., offset_mm=1., fontsize=9, txt_rotation=0, bg_color=[colors[4], colors[2]]) grid.set_col_titles('north', ['Column titles', 'are', 'the best']) #layout.set_col_titles('north', 10., offset_mm=1., fontsize=9, bg_color=[200, 180, 220]) if __name__ == "__main__": figuregen.figure([[grid]], width_cm=18., filename='single-grid.pdf') figuregen.figure([[grid]], width_cm=18., filename='single-grid.pptx') figuregen.figure([[grid]], width_cm=18., filename='single-grid.html') try: from figuregen.util import jupyter jupyter.convert('single-grid.pdf', 300) except: print('Warning: pdf could not be converted to png')
sio.read("images/pool/pool-60s-radiance.exr"), sio.read("images/pool/pool-60s-full.exr"), ], crops=[ Cropbox(top=100, left=200, height=96, width=128, scale=5), Cropbox(top=100, left=450, height=96, width=128, scale=5), ], scene_name="Pool", method_names=[ "Reference", "Path Tracer", "UPS+MCMC", "Radiance-based", "Ours" ]) figuregen.figure([figure.figure_row], width_cm=17.7, filename="pool_with_template.pdf") try: from figuregen.util import jupyter jupyter.convert('pool_with_template.pdf', 300) except: print('Warning: pdf could not be converted to png')
for sub_fig in bottom_grids: for col in range(bottom_cols): method = method_filenames[sub_fig_idx] image = get_image(method, crops[col]) e = sub_fig.get_element(0, col).set_image(figuregen.PNG(image)) e.set_frame(linewidth=0.8, color=crop_colors[col]) if sub_fig_idx != 0: # Method rmse = get_error(method, crops[col]) place_label(e, txt=rmse) sub_fig_idx += 1 # Specify paddings (unit: mm) for sub_fig in bottom_grids: sub_fig.get_layout().set_padding(column=0.5, right=1.0, row=0.5) bottom_grids[-1].get_layout().set_padding(right=0.0) # remove last padding # ---------- V-STACK of Horizontal Figures (create figure) ---------- v_grids = [[top_grid], bottom_grids] if __name__ == "__main__": figuregen.figure(v_grids, width_cm=18., filename='vertical-stack.pdf') figuregen.figure(v_grids, width_cm=18., filename='vertical-stack.pptx') figuregen.figure(v_grids, width_cm=18., filename='vertical-stack.html') try: from figuregen.util import jupyter jupyter.convert('vertical-stack.pdf', 300) except: print('Warning: pdf could not be converted to png')