@@ -1559,6 +1559,82 @@ def generate_plot(xvalues,
15591559 save_figure_to = None ,
15601560 title_above_plot = False ,
15611561 verbose = False ):
1562+ """Utility function to generate plots using the Matplotlib library.
1563+
1564+ This function can be used to generate graphs with multiple plot lines.
1565+ For example, to plot two metrics you can use:
1566+
1567+ ::
1568+
1569+ generate_plot(xvalues=[[ax1, ax2, ax3], [bx1, bx2, bx3]], yvalues=[[ay1, ay2, ay3], [by1, by2, by3]], labels=["metric 1", "metric 2"])
1570+
1571+ Please note that while plotting multiple plots, you should take care to
1572+ ensure that the number of x values and y values for each metric correspond.
1573+ These lists are passed directly to Matplotlib for plotting without
1574+ additional sanity checks.
1575+
1576+ Please see the Matplotlib documentation for the complete list of available
1577+ styles and colours:
1578+ - https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html
1579+ - https://matplotlib.org/stable/gallery/index.html
1580+
1581+ :param xvalues: X values
1582+ :type xvalues: list of lists
1583+ :param yvalues: Y values
1584+ :type yvalues: lists of lists
1585+ :param title: title of plot
1586+ :type title: str
1587+ :param labels: labels for each plot (default: None)
1588+ :type labels: list of strings
1589+ :param colors: colours for each plot (default: None)
1590+ :type colors: list of strings
1591+ :param linestyles: list of line styles (default: None)
1592+ :type linestyles: list strings
1593+ :param linewidths: list of line widths (default: None)
1594+ :type linewidths: list of floats
1595+ :param markers: list of markers (default: None)
1596+ :type markers: list strings
1597+ :param markersizes: list of marker sizes (default: None)
1598+ :type markersizes: list of floats
1599+ :param xaxis: label of X axis (default: None)
1600+ :type xaxis: str
1601+ :param yaxis: label of Y axis (default: None)
1602+ :type yaxis: str
1603+ :param xlim: left and right extents of x axis (default: None)
1604+ :type xlim: tuple of (float, float) or individual arguments: (left=float), (right=float)
1605+ See https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.xlim.html
1606+ :param ylim: top and bottom extents of y axis (default: None)
1607+ :type ylim: tuple of (float, float) or individual arguments: (top=float), (bottom=float)
1608+ See https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.ylim.html
1609+ :param show_xticklabels: whether labels should be shown on xtics (default: True)
1610+ :type show_xticklabels: boolean
1611+ :param show_yticklabels: whether labels should be shown on ytics (default: True)
1612+ :type show_yticklabels: boolean
1613+ :param grid: enable/disable grid (default: False)
1614+ :type grid: boolean
1615+ :param logx: should the x axis be in log scale (default: False)
1616+ :type logx: boolean
1617+ :param logy: should the y ayis be in log scale (default: False)
1618+ :type logy: boolean
1619+ :param font_size: font size (default: 12)
1620+ :type font_size: float
1621+ :param bottom_left_spines_only: enable/disable spines on right and top (default: False)
1622+ (a spine is line noting the data area boundary)
1623+ :type bottom_left_spines_only: boolean
1624+ :param cols_in_legend_box: number of columns to use in legend box (default: 3)
1625+ :type cols_in_legend_box: float
1626+ :param legend_position: position of legend: (default: None)
1627+ See: https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.legend.html
1628+ :type legend_position: str
1629+ :param show_plot_already: if plot should be shown when created (default: True)
1630+ :type show_plot_already: boolean
1631+ :param save_figure_to: location to save generated figure to (default: None)
1632+ :type save_figure_to: str
1633+ :param title_above_plot: enable/disable title above the plot (default: False)
1634+ :type title_above_plot: boolean
1635+ :param verbose: enable/disable verbose logging (default: False)
1636+ :type verbose: boolean
1637+ """
15621638
15631639 print_comment_v ("Generating plot: %s" % (title ))
15641640
0 commit comments