Quanlse/Utils/Plot.py
def plotPop(x: List[Any], y: List[float], title: str = "", xLabel: str = "", yLabel: str = "",
                 color: str = 'purple', lineWidth: float = 1.0, fontSize: float = 10, spacing: float = 0.1) \
        -> None:
    """
    Plot bar graphs with given X labels and Y values lists, this function also supports other optional
    parameters as shown below.

    :param x: a list of X labels for the graphs
    :param y: a list of Y coordinates for the bar graphs
    :param title: overall title of the graph
    :param xLabel: label on X axis
    :param yLabel: label on Y axis
    :param color: a color for all bars, default at blue (from mint, blue, red, green, yellow, black, pink, cyan,
        purple, darkred, orange, brown, pink and teal)
    :param lineWidth: line width index
    :param fontSize: font size index
    :param spacing: vertical/horizontal spacing index
    :return: None
    """
    # define color map
    cMap = colorMap()

    xList = numpy.arange(len(y))

    # Create figure instance
    plt.figure(1, (15, 10))

    # Set graph size and background color
    plt.rcParams["figure.figsize"] = (15, 10)
    plt.rcParams['axes.linewidth'] = lineWidth * 2

    # title and size
    if title is not None:
        plt.title(title, size=int(fontSize * 1.4), weight='bold')

    # label and size
    if xLabel != "":
        plt.xlabel(xLabel, size=int(fontSize * 1.2), weight='bold')
    if yLabel != "":
        plt.ylabel(yLabel, size=int(fontSize * 1.2), weight='bold')

    # Ticks size
    plt.xticks(fontsize=fontSize, weight='bold')
    plt.yticks(fontsize=fontSize, weight='bold')

    # adjust vertical and horizontal spacing
    plt.xlim([min(xList) - (max(xList) - min(xList)) * spacing, max(xList) + (max(xList) - min(xList)) * spacing])
    if min(y) >= 0:
        plt.ylim([0, 1])
    else:
        plt.ylim([min(y) - (max(y) - min(y)) * spacing, max(y) + (max(y) - min(y)) * spacing])

    # configure color and plot
    if color is None:
        plt.bar(xList, y, alpha=0.7, linewidth=lineWidth)
    else:
        for aColor in cMap:
            if aColor[0] == color:
                plt.bar(xList, y, color=aColor[1], alpha=1, linewidth=lineWidth)
    plt.xticks(xList, x)

    # draw the line of y = 0
    plt.axhline(y=0, color='#ccc', linestyle=':', linewidth=lineWidth)
    plt.show()

    Plot bar graphs with given X labels and Y values lists, this function also supports other optional
    parameters as shown below.

    :param x: a list of X labels for the graphs
    :param y: a list of Y coordinates for the bar graphs
    :param title: overall title of the graph
    :param xLabel: label on X axis
    :param yLabel: label on Y axis
    :param color: a color for all bars, default at blue (from mint, blue, red, green, yellow, black, pink, cyan,
        purple, darkred, orange, brown, pink and teal)
    :param lineWidth: line width index
    :param fontSize: font size index
    :param spacing: vertical/horizontal spacing index
    :return: None
    
Plot bar graphs with given X labels and Y values lists, this function also supports other optional
parameters as shown below.
Plot bar graphs with given X labels and Y values lists this function also supports other optional parameters as shown below .
def plotPop(x: List[Any], y: List[float], title: str = "", xLabel: str = "", yLabel: str = "",
                 color: str = 'purple', lineWidth: float = 1.0, fontSize: float = 10, spacing: float = 0.1) \
        -> None:
    cMap = colorMap()
    xList = numpy.arange(len(y))
    plt.figure(1, (15, 10))
    plt.rcParams["figure.figsize"] = (15, 10)
    plt.rcParams['axes.linewidth'] = lineWidth * 2
    if title is not None:
        plt.title(title, size=int(fontSize * 1.4), weight='bold')
    if xLabel != "":
        plt.xlabel(xLabel, size=int(fontSize * 1.2), weight='bold')
    if yLabel != "":
        plt.ylabel(yLabel, size=int(fontSize * 1.2), weight='bold')
    plt.xticks(fontsize=fontSize, weight='bold')
    plt.yticks(fontsize=fontSize, weight='bold')
    plt.xlim([min(xList) - (max(xList) - min(xList)) * spacing, max(xList) + (max(xList) - min(xList)) * spacing])
    if min(y) >= 0:
        plt.ylim([0, 1])
    else:
        plt.ylim([min(y) - (max(y) - min(y)) * spacing, max(y) + (max(y) - min(y)) * spacing])
    if color is None:
        plt.bar(xList, y, alpha=0.7, linewidth=lineWidth)
    else:
        for aColor in cMap:
            if aColor[0] == color:
                plt.bar(xList, y, color=aColor[1], alpha=1, linewidth=lineWidth)
    plt.xticks(xList, x)
    plt.axhline(y=0, color='#ccc', linestyle=':', linewidth=lineWidth)
    plt.show()
def plotPop ( x : List [ Any ] , y : List [ float ] , title : str = "" , xLabel : str = "" , yLabel : str = "" , color : str = 'purple' , lineWidth : float = 1.0 , fontSize : float = 10 , spacing : float = 0.1 ) -> None : cMap = colorMap ( ) xList = numpy . arange ( len ( y ) ) plt . figure ( 1 , ( 15 , 10 ) ) plt . rcParams [ "figure.figsize" ] = ( 15 , 10 ) plt . rcParams [ 'axes.linewidth' ] = lineWidth * 2 if title is not None : plt . title ( title , size = int ( fontSize * 1.4 ) , weight = 'bold' ) if xLabel != "" : plt . xlabel ( xLabel , size = int ( fontSize * 1.2 ) , weight = 'bold' ) if yLabel != "" : plt . ylabel ( yLabel , size = int ( fontSize * 1.2 ) , weight = 'bold' ) plt . xticks ( fontsize = fontSize , weight = 'bold' ) plt . yticks ( fontsize = fontSize , weight = 'bold' ) plt . xlim ( [ min ( xList ) - ( max ( xList ) - min ( xList ) ) * spacing , max ( xList ) + ( max ( xList ) - min ( xList ) ) * spacing ] ) if min ( y ) >= 0 : plt . ylim ( [ 0 , 1 ] ) else : plt . ylim ( [ min ( y ) - ( max ( y ) - min ( y ) ) * spacing , max ( y ) + ( max ( y ) - min ( y ) ) * spacing ] ) if color is None : plt . bar ( xList , y , alpha = 0.7 , linewidth = lineWidth ) else : for aColor in cMap : if aColor [ 0 ] == color : plt . bar ( xList , y , color = aColor [ 1 ] , alpha = 1 , linewidth = lineWidth ) plt . xticks ( xList , x ) plt . axhline ( y = 0 , color = '#ccc' , linestyle = ':' , linewidth = lineWidth ) plt . show ( )
Plot bar graphs with given X labels and Y values lists, this function also supports other optional
parameters as shown below.
Plot bar graphs with given X labels and Y values lists this function also supports other optional parameters as shown below .
"""
    Plot bar graphs with given X labels and Y values lists, this function also supports other optional
    parameters as shown below.

    :param x: a list of X labels for the graphs
    :param y: a list of Y coordinates for the bar graphs
    :param title: overall title of the graph
    :param xLabel: label on X axis
    :param yLabel: label on Y axis
    :param color: a color for all bars, default at blue (from mint, blue, red, green, yellow, black, pink, cyan,
        purple, darkred, orange, brown, pink and teal)
    :param lineWidth: line width index
    :param fontSize: font size index
    :param spacing: vertical/horizontal spacing index
    :return: None
    """ # define color map # Create figure instance # Set graph size and background color # title and size # label and size # Ticks size # adjust vertical and horizontal spacing # configure color and plot # draw the line of y = 0
None
x
List[Any]
a list of X labels for the graphs
a list of X labels for the graphs
y
List[float]
a list of Y coordinates for the bar graphs
a list of Y coordinates for the bar graphs
title
str
overall title of the graph
overall title of the graph
xLabel
str
label on X axis
label on X axis
yLabel
str
label on Y axis
label on Y axis
color
str
a color for all bars, default at blue (from mint, blue, red, green, yellow, black, pink, cyan,
purple, darkred, orange, brown, pink and teal)
a color for all bars default at blue ( from mint blue red green yellow black pink cyan purple darkred orange brown pink and teal )
lineWidth
float
line width index
line width index
fontSize
float
font size index
font size index
spacing
float
vertical/horizontal spacing index
vertical / horizontal spacing index