aerosandbox.tools.pretty_plots.formatting ========================================= .. py:module:: aerosandbox.tools.pretty_plots.formatting Functions --------- .. autoapisummary:: aerosandbox.tools.pretty_plots.formatting.show_plot aerosandbox.tools.pretty_plots.formatting.set_ticks aerosandbox.tools.pretty_plots.formatting.equal Module Contents --------------- .. py:function:: show_plot(title = None, xlabel = None, ylabel = None, zlabel = None, dpi = None, savefig = None, savefig_transparent = False, tight_layout = True, tight_layout_pad = 0.25, legend = None, legend_inline = False, legend_frame = True, pretty_grids = True, set_ticks = True, rotate_axis_labels = True, rotate_axis_labels_linewidth = 14, show = True) Makes a matplotlib Figure (and all its constituent Axes) look "nice", then displays it. Arguments control whether various changes (from the default matplotlib settings) are made to the plot. One argument in particular, `show` (a boolean), controls whether the plot is displayed. :param title: If given, sets the title of the plot. If the Figure has multiple axes, this sets the Figure-level suptitle instead of setting the individual Axis title. :param xlabel: If given, sets the xlabel of all axes. (Equivalent to `ax.set_xlabel(my_label)`) :param ylabel: If given, sets the ylabel of all axes. (Equivalent to `ax.set_ylabel(my_label)`) :param zlabel: If given, sets the zlabel of all axes, if the axis is 3D. (Equivalent to `ax.set_zlabel(my_label)`) :param dpi: If given, sets the dpi (display resolution, in Dots Per Inch) of the Figure. :param savefig: If given, saves the figure to the given path(s). * If a string is given, saves the figure to that path. (E.g., `savefig="my_plot.png"`) * If a list of strings is given, saves the figure to each of those paths. (E.g., `savefig=["my_plot.png", "my_plot.pdf"]`) :param savefig_transparent: If True, saves the figure with a transparent background. If False, saves the figure with a white background. Only has an effect if `savefig` is not None. :param tight_layout: If True, calls `plt.tight_layout()` to adjust the spacing of individual Axes. If False, skips this step. :param tight_layout_pad: If `tight_layout=True`, sets the padding width between the figure edge and the edges of the :param subplots: :param as a fraction of the font size. The default here is 0.25: :param which is well below the default of 1.08 in: :param matplotlib. This causes Matplotlib to waste less whitespace on padding.: :param legend: This value can be True, False, or None. * If True, displays a legend on the current Axis. * If False, does not add a legend on the current Axis. (However, does not delete any existing legends.) * If None (default), goes through some logic to determine whether a legend should be displayed. If there is only one line on the current Axis, no legend is displayed. If there are multiple lines, a legend is ( in general) displayed. :param legend_inline: Boolean that controls whether an "inline" legend is displayed. * If True, displays an "inline" legend, where the labels are next to the lines instead of in a box. * If False (default), displays a traditional legend. Only has an effect if `legend=True` (or `legend=None`, and logic determines that a legend should be displayed). :param legend_frame: Boolean that controls whether a frame (rectangular background box) is displayed around the legend. Default is True. :param pretty_grids: Boolean that controls whether the gridlines are formatted have linewidths that are (subjectively) more readable. :param set_ticks: Boolean that controls whether the tick and grid locations + labels are formatted to be ( subjectively) more readable. Works with both linear and log scales, and with both 2D and 3D plots. :param show: Boolean that controls whether the plot is displayed after all plot changes are applied. Default is True. You may want to set this to False if you want to make additional manual changes to the plot before displaying it. Default is True. Returns: None (completely in-place function). If `show=True` (default), displays the plot after applying changes. .. py:function:: set_ticks(x_major = None, x_minor = None, y_major = None, y_minor = None, z_major = None, z_minor = None) .. py:function:: equal() Sets all axes to be equal. Works for both 2d plots and 3d plots. Returns: None