turboflow.utilities.graphics module
- turboflow.utilities.graphics.create_gif(image_folder, output_file, duration=0.5)[source]
Create a GIF from a series of images.
- Parameters:
- image_folderstr
The path to the folder containing the images.
- output_filestr
The path and filename of the output GIF.
- durationfloat, optional
Duration of each frame in the GIF, by default 0.5 seconds.
- turboflow.utilities.graphics.create_mp4(image_folder, output_file, fps=10)[source]
Create an MP4 video from a series of images.
- Parameters:
- image_folderstr
The path to the folder containing the images.
- output_filestr
The path and filename of the output MP4 video.
- fpsint, optional
Frames per second in the output video, by default 10.
- turboflow.utilities.graphics.print_installed_fonts()[source]
Print the list of fonts installed on the system.
This function identifies and prints all available fonts for use in Matplotlib.
- turboflow.utilities.graphics.print_rc_parameters(filename=None)[source]
Print the current rcParams used by Matplotlib or write to file if provided.
This function provides a quick overview of the active configuration parameters within Matplotlib.
- turboflow.utilities.graphics.savefig_in_formats(fig, path_without_extension, formats=['.png', '.svg', '.eps'], dpi=500)[source]
Save a given Matplotlib figure in multiple file formats.
- Parameters:
- figmatplotlib.figure.Figure
The figure object to be saved.
- path_without_extensionstr
The full path to save the figure excluding the file extension.
- formatslist of str, optional
A list of string file extensions to specify which formats the figure should be saved in. Supported formats are [‘.png’, ‘.svg’, ‘.pdf’, ‘.eps’]. Default is [‘.png’, ‘.svg’].
- dpiint, optional
The resolution in dots per inch with which to save the image. This parameter affects only PNG files. Default is 500.
Examples
>>> import matplotlib.pyplot as plt >>> fig, ax = plt.subplots() >>> ax.plot([0, 1], [0, 1]) >>> save_fig_in_formats(fig, "/path/to/figure/filename")
This will save the figure as “filename.png”, “filename.svg”, and “filename.pdf” in the “/path/to/figure/” directory.
- turboflow.utilities.graphics.scale_graphics_x(fig, scale, mode='multiply')[source]
Scale x-coordinates of graphics objects
- turboflow.utilities.graphics.scale_graphics_y(fig, scale, mode='multiply')[source]
Scale y-coordinates of graphics objects
- turboflow.utilities.graphics.set_plot_options(fontsize=14, grid=True, major_ticks=True, minor_ticks=True, margin=0.05, color_order='matlab', linewidth=1.25)[source]
Set options for creating publication-quality figures using Matplotlib.
This function updates the internal Matplotlib settings to better align with standards for publication-quality figures. Features include improved font selections, tick marks, grid appearance, and color selections.
- Parameters:
- fontsizeint, optional
Font size for text elements in the plot. Default is 13.
- gridbool, optional
Whether to show grid lines on the plot. Default is True.
- major_ticksbool, optional
Whether to show major ticks. Default is True.
- minor_ticksbool, optional
Whether to show minor ticks. Default is True.
- marginfloat, optional
Margin size for axes. Default is 0.05.
- color_orderstr, optional
Color order to be used for plot lines. Options include “python” and “matlab”. Default is “matlab”.