Esempio n. 1
0
def CombinedPointsCoast(season: int, week: int) -> None:
    """It plots how many combined points each coast has."""
    Points = getPointsCoast(season, week)

    fig = go.Figure()
    fig.add_trace(
        go.Bar(x=[-0.5],
               y=[Points[0]],
               name='West Coast',
               marker_color='#428bca'))

    #fig.add_trace(go.Bar(x = [-0.5], y= [Points[0]],
    #                     name = 'West Coast', marker_color = '#428bca',
    #                     text= "West Coast", textposition = "inside"))

    fig.add_trace(
        go.Bar(x=[0.5],
               y=[Points[1]],
               name='East Coast',
               marker_color='#d9534f'))

    fig.update_layout(title=f'Season {season} Coast Total Points')
    fig.update_layout(xaxis_title='')
    fig.update_layout(xaxis=dict(tickvals=[""], ticktext=[""]))

    fig.update_layout(yaxis_title='Points')
    fig.update_yaxes(range=[0, max(Points) + 250])

    fig.update_layout(font=dict(size=28))
    fig.update_layout(showlegend=True)
    fig.update_layout(legend=dict(font_size=30))
    GS.presentFile(
        fig, FORMAT,
        f'Data/Season{season}/PlotsWebsite/S{season}W{week}CoastTotalPoints.jpeg'
    )
Esempio n. 2
0
def RankTop10Graph(season: int, week: int) -> None:
    """It plots all players weekly rank"""
    RankRecords = f'Data/Season{season}/Records/S{season}W{week}RankRecords.csv'
    RankRecords = pd.read_csv(RankRecords, encoding="ISO-8859-1")
    RankRecords = RankRecords.sort_values(f'RWeek{week}')

    lowestRank = 0
    PlayerMains = getMainsOfPlayer()
    x_range = [i for i in range(1, week + 1)]

    fig = go.Figure()
    count = 1
    for _, row in RankRecords.iterrows():
        playerTag = row[1]
        if (playerTag in PlayerMains) and (PlayerMains[playerTag]
                                           in CHARACTERS):  # Mains a Top Tier
            color = CHARACTERS[PlayerMains[playerTag]]
        elif (playerTag in PlayerMains) and (PlayerMains[playerTag]
                                             in MIDTIERS):  # Mains a Mid Tier
            color = MIDTIERS[PlayerMains[playerTag]]
        else:  # Low Tier Main or NA
            color = '#666699'
        playerRank = [float(row[f'RWeek{i}']) for i in range(1, week + 1)]
        lowestRank = max(
            lowestRank,
            max(playerRank))  # Max because lowest rank means highest number
        fig.add_trace(
            go.Scatter(x=x_range,
                       y=playerRank,
                       name=str(playerTag) + ": " + str(int(playerRank[-1])),
                       line=dict(color=color, width=3)))
        if count >= 10:
            break
        count += 1

    fig.update_layout(title=f'Season {season} Ranks')
    fig.update_layout(xaxis_title='')
    fig.update_layout(
        xaxis=dict(tickvals=[i for i in range(1, week + 1)],
                   ticktext=[f'Week {i}' for i in range(1, week + 1)]))
    fig.update_layout(yaxis_title='Rank')
    fig.update_yaxes(range=[14, 0])

    fig.update_layout(font=dict(size=28))
    fig.update_layout(showlegend=True)
    fig.update_layout(legend=dict(font_size=24))
    GS.presentFile(
        fig, FORMAT,
        f'Data/Season{season}/PlotsWebsite/S{season}W{week}RankTop10.jpeg')
Esempio n. 3
0
def PointsTop10Graph(season: int, week: int) -> None:
    """It plots a player's points through out the season. The color is
    related to their main."""
    PastPoints = f'Data/Season{season}/Records/S{season}W{week}PastPoints.csv'
    PastPoints = pd.read_csv(PastPoints, encoding="ISO-8859-1")
    PastPoints = PastPoints.sort_values(f'BWeek{week}', ascending=False)

    count = 1
    fig = go.Figure()
    PlayerMains = getMainsOfPlayer()
    x_range = [i for i in range(1, week + 1)]

    for _, row in PastPoints.iterrows():
        playerTag = row['SmashTag']
        playerPoints = [row[f'BWeek{i}'] for i in range(1, week + 1)]
        if (playerTag in PlayerMains) and (PlayerMains[playerTag]
                                           in CHARACTERS):  # Mains a Top Tier
            color = CHARACTERS[PlayerMains[playerTag]]
        elif (playerTag in PlayerMains) and (PlayerMains[playerTag]
                                             in MIDTIERS):  # Mains a Mid Tier
            color = MIDTIERS[PlayerMains[playerTag]]
        else:  # Low Tier Main or NA
            color = '#666699'
        fig.add_trace(
            go.Scatter(x=x_range,
                       y=playerPoints,
                       name=str(playerTag) + ": " + str(int(playerPoints[-1])),
                       line=dict(color=color, width=3)))
        if count >= 10:
            break
        count += 1

    fig.update_layout(title=f'Season {season} BankRoll Bills')
    fig.update_layout(xaxis_title='')
    fig.update_layout(
        xaxis=dict(tickvals=[i for i in range(1, week + 1)],
                   ticktext=[f'Week {i}' for i in range(1, week + 1)]))
    fig.update_layout(yaxis_title='Points')

    fig.update_layout(font=dict(size=28))
    fig.update_layout(showlegend=True)
    fig.update_layout(legend=dict(font_size=24))
    GS.presentFile(
        fig, FORMAT,
        f'Data/Season{season}/PlotsWebsite/S{season}W{week}PointsTop10.jpeg')
Esempio n. 4
0
def CharacterMidTiersPointsGraph(PastPoints: 'df',
                                 MidTierMains: {'Player':
                                                'Main'}, character: str,
                                 season: int, week: int) -> None:
    """It plots the cummulative points of all players of one character
    on a week to week basis."""
    temp = dict()
    fig = go.Figure()
    x_range = [i for i in range(1, week + 1)]

    for _, row in PastPoints.iterrows():
        playerTag = row['SmashTag']
        if playerTag in MidTierMains:  # If player is a Mid Tier Loser
            playerPoints = [row[f'BWeek{i}'] for i in range(1, week + 1)]
            color = MIDTIERS[
                MidTierMains[playerTag]]  # Color for that Mid Tier
            fig.add_trace(
                go.Scatter(x=x_range,
                           y=playerPoints,
                           name=playerTag + ": " + str(int(playerPoints[-1])),
                           line=dict(color=color, width=3)))
            temp[playerTag] = int(playerPoints[-1])

    fig.update_layout(title=f'Season {season} {character} BankRoll Bills')
    fig.update_layout(xaxis_title='')
    fig.update_layout(
        xaxis=dict(tickvals=[i for i in range(1, week + 1)],
                   ticktext=[f'Week {i}' for i in range(1, week + 1)]))
    fig.update_layout(yaxis_title='Bills')
    values = [1, 5, 10, 50, 100, 500, 1000, 5000]
    fig.update_layout(yaxis=dict(
        tickmode='array', type='log', ticktext=values, tickvals=values))
    fig.update_layout(font=dict(size=28))

    if DEBUGGING:
        fig.update_layout(showlegend=True)
        fig.update_layout(legend=dict(font_size=20))
    else:
        fig.update_layout(showlegend=False)
    GS.presentFile(
        fig, FORMAT,
        f'Data/Season{season}/PlotsWebsite/S{season}W{week}Points{character}.jpeg'
    )
    return temp
Esempio n. 5
0
def CharacterMidTierRankGraph(RankRecords: 'df',
                              MidTierMains: {'Player': 'Main'}, character: str,
                              season: int, week: int) -> None:
    """It graphs all the mid tiers mains into one plot."""
    temp = dict()
    fig = go.Figure()
    x_range = [i for i in range(1, week + 1)]
    for _, row in RankRecords.iterrows():
        playerTag = row['SmashTag']
        if playerTag in MidTierMains:  # If player is a Mid Tier Loser
            playerRank = [row[f'RWeek{i}'] for i in range(1, week + 1)
                          ]  # Their Rank over the Season
            color = MIDTIERS[
                MidTierMains[playerTag]]  # Color for that Mid Tier
            fig.add_trace(
                go.Scatter(x=x_range,
                           y=playerRank,
                           name=playerTag + ": " + str(int(playerRank[-1])),
                           line=dict(color=color, width=3)))
            temp[playerTag] = int(playerRank[-1])

    fig.update_layout(title=f'Season {season} {character} Ranks')
    fig.update_layout(xaxis_title='')
    fig.update_layout(
        xaxis=dict(tickvals=[i for i in range(1, week + 1)],
                   ticktext=[f'Week {i}' for i in range(1, week + 1)]))
    fig.update_layout(yaxis_title='Rank')
    fig.update_yaxes(range=[RankRecords.shape[0], 0])

    fig.update_layout(font=dict(size=28))
    if DEBUGGING:
        fig.update_layout(showlegend=True)
        fig.update_layout(legend=dict(font_size=20))
    else:
        fig.update_layout(showlegend=False)
    GS.presentFile(
        fig, FORMAT,
        f'Data/Season{season}/PlotsWebsite/S{season}W{week}Rank{character}.jpeg'
    )
    return temp
Esempio n. 6
0
def CharacterRankGraph(RankRecords: 'df', players: {'str'}, color: str,
                       character: str, season: int, week: int) -> None:
    """It plots the ranks of all the players of one character on
    a week to week basis."""
    temp = dict()
    fig = go.Figure()
    x_range = [i for i in range(1, week + 1)]
    for _, row in RankRecords.iterrows():
        playerTag = row['SmashTag']
        if playerTag in players:  # If player is an X main
            playerRank = [row[f'RWeek{i}'] for i in range(1, week + 1)]
            fig.add_trace(
                go.Scatter(x=x_range,
                           y=playerRank,
                           name=playerTag + ": " + str(int(playerRank[-1])),
                           line=dict(color=color, width=3)))
            temp[playerTag] = int(playerRank[-1])

    fig.update_layout(xaxis_title='')
    fig.update_layout(
        xaxis=dict(tickvals=[i for i in range(1, week + 1)],
                   ticktext=[f'Week {i}' for i in range(1, week + 1)]))
    fig.update_layout(yaxis_title='Rank')
    fig.update_yaxes(range=[RankRecords.shape[0], 0])

    fig.update_layout(font=dict(size=28))
    if DEBUGGING:
        fig.update_layout(showlegend=True)
        fig.update_layout(legend=dict(font_size=20))
        fig.update_layout(title=f'Season {season} {character} Ranks')
    else:
        fig.update_layout(showlegend=False)
    GS.presentFile(
        fig, FORMAT,
        f'Data/Season{season}/PlotsWebsite/S{season}W{week}Rank{character}.jpeg'
    )
    return temp