SplatStats package

Submodules

SplatStats.Battle module

class Battle(battleDetail)

Bases: object

id

Battle’s hash id.

Type:

str

datetime

Date/time at which the battle took place (zero timezone UTC).

Type:

datetime

duration

Duration of the match (in seconds).

Type:

int

ko

Battle finished in KO?

Type:

bool

matchType

Type of match (“Turf War”, “Tower Control”, “Rainkamer”, “Splat Zones”, “Clam Blitz”).

Type:

str

matchMode

Used for splatfest identifier.

Type:

str

festMatch

Determines if the match was a splatfest event.

Type:

bool

stage

Stage’s name.

Type:

str

alliedTeam

Breakdown of the user’s team.

Type:

dataframe

enemyTeams

Breakdown of the enemy teams.

Type:

list of dataframes

awards

List of awards obtained in the battle.

Type:

list

dumpBattle(fPath='./', overwrite=True)

Serializes battle to disk with datetime as name.

Parameters:

fPath (str, optional) – Path to which the object will be saved. Defaults to ‘./’.

Returns:

Filepath to serialized battle.

Return type:

str

getAlliedRanks(cats=['kill', 'death', 'assist', 'special', 'paint'], inverted=['death'])

Returns a dataframe with the rankings of the allied players across categories (higher numbers being better unless in inverted list).

Parameters:
  • cats (list, optional) – Categories over which the data will be totaled. Defaults to [‘kill’, ‘death’, ‘assist’, ‘special’, ‘paint’].

  • inverted (list, optional) – In the original rankings more is considered better, this list should contain the categories that should be inverted. Defaults to [‘death’].

Returns:

Allied team ranking dataframe over categories.

Return type:

dataframe

getAlliedTotal(cats=['kill', 'death', 'assist', 'special', 'paint'])

Get allied team total over selected categories.

Parameters:

cats (list, optional) – Categories over which the data will be totaled. Defaults to [‘kill’, ‘death’, ‘assist’, ‘special’, ‘paint’].

Returns:

Allied team totals over the categories.

Return type:

dict

getAlliesAndEnemiesNames()

Returns a dictionary containing the names of allies and enemies.

Returns:

Contains names of allies and enemies separated by key.

Return type:

dict

getAllyByCategory(name, category='player name')

Returns an ally dataframe row filtering by a given category (usually ‘name’).

Parameters:
  • name (str or int) – String or number to match in the category.

  • category (str, optional) – Category (column) name in the dataframe. Defaults to ‘player name’.

Returns:

Dataframe row that conforms to player history shape (see class’ docs).

Return type:

dataframe

getEnemiesRanks(cats=['kill', 'death', 'assist', 'special', 'paint'], inverted=['death'])

Returns a list of dataframes with the rankings of the enemies players across categories (higher numbers being better unless in inverted list).

Parameters:
  • cats (list, optional) – Categories over which the data will be totaled. Defaults to [‘kill’, ‘death’, ‘assist’, ‘special’, ‘paint’].

  • inverted (list, optional) – In the original rankings more is considered better, this list should contain the categories that should be inverted. Defaults to [‘death’].

Returns:

Enemy teams ranking dataframe over categories.

Return type:

list of dataframes

getEnemiesTotals(cats=['kill', 'death', 'assist', 'special', 'paint'])

Get enemy teams total over selected categories.

Parameters:

cats (list, optional) – Categories over which the data will be totaled. Defaults to [‘kill’, ‘death’, ‘assist’, ‘special’, ‘paint’].

Returns:

Enemy team totals over the categories.

Return type:

list of dataframes

getEnemyByCategory(name, category='player name')

Returns an enemy dataframe row filtering by a given category (usually ‘name’).

Parameters:
  • name (str or int) – String or number to match in the category.

  • category (str, optional) – Category (column) name in the dataframe. Defaults to ‘player name’.

Returns:

Dataframe row that conforms to player history shape (see class’ docs).

Return type:

dataframe

getFullRanks(cats=['kill', 'death', 'assist', 'special', 'paint'], inverted=['death'])

Returns a dataframe with the rankings of the full roster of players across categories (higher numbers being better unless in inverted list).

Parameters:
  • cats (list, optional) – Categories over which the data will be totaled. Defaults to [‘kill’, ‘death’, ‘assist’, ‘special’, ‘paint’].

  • inverted (list, optional) – In the original rankings more is considered better, this list should contain the categories that should be inverted. Defaults to [‘death’].

Returns:

Full roster ranking dataframe over categories.

Return type:

dataframe

getFullRoster()

Generates the dataframe of all players involved in the battle.

Returns:

Battle history dataframe with added team column.

Return type:

dataframe

getPlayerByCategory(name, team, category='player name')

Gets the player row given a team in the battle object.

Parameters:
  • name (str) – Name of the player.

  • team (dataframe) – Team the player should be in.

  • category (str, optional) – _description_. Defaults to ‘player name’.

Returns:

Player’s dataframe row that conforms to player history shape (see class’ doc).

Return type:

dataframe

SplatStats.Player module

class Player(name, bPaths, id=None, timezone=None)

Bases: object

name

Player’s in-game name.

Type:

str

id

Player’s in-game id.

Type:

int

bPaths

List of paths for all the battle files to be analyzed.

Type:

list of paths

timezone

Datetime-valid timezone string id for the player’s location.

Type:

str

battlesRecords

Full list of battle objects.

Type:

list of objects

battlesHistory

Full battle history.

Type:

dataframe

battlesHistoryByType

Battle history broken up by match types: “Turf War”, “Rainmaker”, “Splat Zones”, “Clam Blitz”, “Tower Control”

Type:

set of dataframes

playerStats

Stats on full battle history.

Type:

set

playerStatsByType

Stats on battle history by match-type

Type:

set of sets

calcPlayerStats()

Calculates and returns the stats for the player’s battle history.

Returns:

KPADS dictionary of stats.

Return type:

dict

calcPlayerStatsByTypes()

Calculates and returns the stats for the player’s battle history broken by match types.

Returns:

KPADS dictionaries of stats broken up by match type.

Return type:

list

filterBattleHistoryWithType(battleType)

Gets all the battles that match a certain battle type from a history dataframe.

Parameters:

battleType (str) – String ID of the match type.

Returns:

Filtered history dataframe containing only the matches of a certain type.

Return type:

dataframe

getAlliesAndEnemiesCounts()

Counts the number of times the player has been ally or faced a certain oponent.

Returns:

Dictionary of counter objects containing the frequencies of matches with other players.

Return type:

dict

getAwardFrequencies()

Returns the frequencies of the awards obtained by the player.

Returns:

Sorted (award, frequency) tuples.

Return type:

tuples

getBattleRecords()

Loads all the battle files belonging to the player (bPaths) and assigns it to battleRecords.

Returns:

All battle objects loaded from files (see class’ docs).

Return type:

list

getPlayerAlliedRanking(cats=['kill', 'death', 'assist', 'special', 'paint'])

Calculates the ranking dataframe of the player with regards of allies on given categories.

Parameters:

cats (list, optional) – Categories on the battleHistory upon which the ranking will be calculated. Defaults to [‘kill’, ‘death’, ‘assist’, ‘special’, ‘paint’].

Returns:

Ranks dataframe by category.

Return type:

dataframe

getPlayerFullRanking(cats=['kill', 'death', 'assist', 'special', 'paint'])

Calculates the ranking dataframe of the player with regards of all the players on given categories.

Parameters:

cats (list, optional) – Categories on the battleHistory upon which the ranking will be calculated. Defaults to [‘kill’, ‘death’, ‘assist’, ‘special’, ‘paint’].

Returns:

Ranks dataframe by category.

Return type:

dataframe

getPlayerHistoryByTypes()

Groups the player history into dictionary items corresponding to the match type played.

Returns:

Dictionary containing the different battle history dataframes.

Return type:

dict of dataframes

parsePlayerHistoryFromBattles(validOnly=True, ammendWeapons=True)

Extracts the player’s history from the battle records by matching the name in the dataframes.

Parameters:

validOnly (bool, optional) – Filters out battles which didn’t finish correctly (disconnects). Defaults to True.

Returns:

Full battle history dataframe for the player, in which each row is the result of a match.

Return type:

dataframe

SplatStats.StatInk module

class StatInk(resultsPaths, fNamePattern='*-*-*.csv')

Bases: object

fPaths

Filepaths of the battle results csv files loaded for analysis

Type:

list of paths

rawResults

Dataframe containing battle results information directly from stat.ink

Type:

dataframe

battleResults

Clean dataframe containing results in human-readable form

Type:

dataframe

cleanBattlesDataframe(rawResults, naColor='#00000000', naBool=-1, naString='NA', naInt=0, ammendWeapons=True)

SplatStats.Team module

class Team(names, bPaths, ids=None, timezone=None)

Bases: object

assembleTeamHistoryFromBattles()
reshapeTeamHistoryByPeriod(cats=['kill', 'death', 'assist', 'special', 'paint', 'matches', 'win'], period='H')

SplatStats.auxiliary module

alphaToHex(alphaFloat)

Transform an alpha value (0 to 1) to hex (00 to FF).

Parameters:

alphaFloat (float) – Alpha value in float form.

Returns:

Two character hex value to append to the end of a hex color string.

Return type:

str

awardsToStrings(awardsDF, sep='@')

Condenses an awards dataframe into a list of strings for easier handling in player’s history.

Parameters:
  • awardsDF (dataframe) – Dataframe of awards as parsed from JSON files.

  • sep (str, optional) – Separator character for strings elements. Defaults to ‘@’.

Returns:

List of award strings.

Return type:

list

boolKO(koString)

Converts the KO string in the JSONs to a bool.

Parameters:

koString (str) – KO string

Returns:

KO value either in win or lose condition.

Return type:

bool

boolWinLose(winString)

Shortens and standardizes the win/lose string from JSONs.

Parameters:

winString (str) – Win/lose string in long form.

Returns:

W/L string in shortform

Return type:

str

datetimeToString(datetime)

Converts a datetime object into a standardized string form.

Parameters:

datetime (datetime) – Standard datetime object to format into string.

Returns:

Standardized datetime string in the form “Y_M_D-Hhm”

Return type:

str

flattenList(irregular_list)
gearPrepend(gearType)

Takes a gear type string as found in JSONs and standardizes it.

Parameters:

gearType (str) – ID string of the type of gear.

Returns:

Standardized gear string

Return type:

str

getHistoryFiles(histFolders, pattern='results.json')

Given a list of folders, it looks for matches in filenames.

Parameters:
  • histFolders (list) – List of folder paths to search for matches in.

  • pattern (str, optional) – Glob pattern for filenames matches. Defaults to ‘results.json’.

Returns:

Full filepaths for all the glob file matches.

Return type:

list

getHistoryFolders(histPath, fldrPat='export-*')

Parses the folder paths for all instances matching a pattern (used to find JSON files folders).

Parameters:
  • histPath (path) – Full basepath in which all the folders are stored.

  • fldrPat (str, optional) – Glob pattern to match in searching for folder names. Defaults to ‘export-*’.

Returns:

Unsorted list of folders that match the glob pattern.

Return type:

list

getPlayerCountsInBattles(battles)

Gets the player appearance counts from a list of battle objects (ally and enemy combined).

Parameters:

battles (list) – List of battle objects (see “loadBattlesFromFiles”)

Returns:

Counter object list with player appearance counts sorted by value.

Return type:

list

isNotebook()

Detects if the file is being run as a jupyter notebook (for dev purposes).

Returns:

Is true if the file is being run in an interactive session.

Return type:

bool

loadBattle(fPath)

Reads a pickled battle file from disk.

Parameters:

fPath (filepath) – Full path in which the battle pkl file can be found.

Returns:

Battle object (see class’ docs)

Return type:

object

loadBattlesFromFiles(bPaths)

Loads battle objects from disk without the need to generate a Player object.

Parameters:

bPath (str) – Path to the folder from where the battle files will be loaded.

Returns:

List of battle objects.

Return type:

list

setSplatoonFont(fontDir, fontName='Splatfont 2')

SplatStats.colors module

colorPaletteFromHexList(clist)

SplatStats.constants module

SplatStats.files module

dumpBattlesFromJSONS(historyFilepaths, oPath, overwrite=True)

Takes a list of s3s “results.json” filepaths, converts them into batle objects and serializes them to disk.

Parameters:
  • historyFilepaths (list) – List of “results.json” filepaths (use “getDataFilepaths”)

  • oPath (str) – Path in which the battle pkl files will be stored.

Returns:

List of filepaths to battle files.

Return type:

list

getBattleFilepaths(bPath, filePat='*.pkl')

Parses all the battle files from a folder.

Parameters:
  • bPath (str) – Path to the folder from where the battle files will be loaded.

  • filePat (str, optional) – Pattern to match for in filenames. Defaults to ‘*.pkl’.

Returns:

Filepaths to battle files.

Return type:

list

getDataFilepaths(iPath, fldrPat='export-*', filePat='results.json', newPat=True)

Gets the filepaths in which files with a certain pattern can be found inside folders with a given pattern.

Parameters:
  • iPath (str) – Base path in which we will perform the folders search.

  • fldrPat (str, optional) – Glob pattern for folder matches. Defaults to ‘export-*’.

  • filePat (str, optional) – Glob pattern for file matches inside the folders. Defaults to ‘results.json’.

  • newPat (bool, optional) – Set to True if using s3s >=v1.3.4

Returns:

List of filepaths that match the provided patterns.

Return type:

list

SplatStats.parsers module

addDateGroup(playerHistory, slicer=<function <lambda>>)
boolToInt(entry, naValue=-1)

Converts the bool value of a given entry to 0 or 1, returning naValue if the entry is not bool.

Parameters:
  • entry (object) – element to evaluate

  • naValue (int) – value to return if the entry is not bool

Returns:

Converted value.

Return type:

int

getGear(player)

Extracts the full gear elements from the player JSON dictionary.

Parameters:

player (dict) – Player dictionary as extracted from JSON.

Returns:

Standardized gear dictionary.

Return type:

dict

getGearUnit(player, gType='headGear')

Extracts the gear elements from the player JSON dictionary.

Parameters:
  • player (dict) – Player dictionary as extracted from JSON.

  • gType (str, optional) – _description_. Defaults to ‘headGear’.

Returns:

Standardized gear dictionary for a given set (head, clothing, shoes).

Return type:

dict

getMatchScore(teamResult, matchType)

From the teamResult JSON structure and match type, selects which score should be parsed.

Parameters:
  • teamResult (dict) – JSON dictionary of team results.

  • matchType (str) – String ID of the match type.

Returns:

Score of the match (false if the match didn’t finish correctly).

Return type:

float/int/bool

getPlayerResults(player, kadj=True)

Extracts the KADS elements from the player JSON dictionary.

Parameters:

player (dict) – Player dictionary as extracted from JSON.

Returns:

KADS dictionary

Return type:

dict

getPlayerWeapon(player)

Extracts the weapons elements from the player JSON dictionary.

Parameters:

player (dict) – Player dictionary as extrated from JSON.

Returns:

Standardized weapon dictionary.

Return type:

dict

getPlayersBattleInfo(players)

Players JSON object.

Parameters:

players (dict) – Players dictionary as parsed from JSON.

Returns:

Player info dictionary.

Return type:

dict

getTeamDataframe(team, matchType)

Compiles a consistent dataframe from the JSON structured team result structure.

Parameters:
  • team (dict) – JSON-original team dictionary of results.

  • matchType (str) – Match type ID of the battle.

Returns:

Standardized battle results dataframe.

Return type:

dataframe

parseAwards(awardsList)

Converts the awards list from the JSON structure into a dataframe.

Parameters:

awardsList (list) – List of awards from JSON format.

Returns:

Dataframe structure with name, place and rank for awards.

Return type:

dataframe

parsePlayerHistoryFromBattles(battleRecords, name, category='player name', validOnly=True, timezone=None, kassistWeight=0.5)

Gets the history dataframe for a player, given a list of battle records and the name of the player.

Parameters:
  • battleRecords (list) – List of battle objects to process.

  • name (str) – Name of the player.

  • category (str, optional) – Could be used to filter player by ID in the future (unused). Defaults to ‘player name’.

  • validOnly (bool, optional) – Get only the matches that finished correctly (no disconnects or errors). Defaults to True.

  • timezone (_type_, optional) – Timezone in which the player played the matches. Defaults to None.

Returns:

Full player history dataframe (check class’ docs).

Return type:

dataframe

SplatStats.plots module

generateMatchHistoryLegend(figAx)

Creates a legend with the breakdown of the Match History plots.

Parameters:

figAx (tuple) – (fig, ax) tuple as initialized by matplotlib (plt.subplots).

Returns:

Matplotlib’s fig and ax objects.

Return type:

(fix, ax)

plotAwardFrequencies(figAx, awardFrequencies, alpha=0.4, color='#0D40DE', textSize=8, **kwargs)

Plots player’s award frequencies as a barchart.

Parameters:
  • figAx (tuple) – (fig, ax) tuple as initialized by matplotlib (plt.subplots).

  • awardFrequencies (tuples) – Award frequency tuples from getAwardFrequencies function.

  • alpha (float, optional) – Alpha value for the chart. Defaults to 0.4.

  • color (hexString, optional) – Color for the bars. Defaults to cst.CLR_BAR.

Returns:

Matplotlib’s fig and ax objects.

Return type:

(fix, ax)

plotCircularBarchartStat(playerHistory, figAx=None, cat='main weapon', stat='kill', aggFun=<function sum>, logScale=False, ticksStep=10, rRange=(0, 270), yRange=None, labels=True, labelQty=False, colors=['#83C91A', '#E1772B', '#AD7710', '#4D24A3', '#CF3350', '#FABF50', '#25B100', '#9A6FCC', '#E75A2D', '#2BDCED', '#EFF66E', '#308766', '#9208B2', '#009A6E', '#C42138', '#4E4EDD', '#60AB43', '#26229F', '#4E85C1', '#E24FE5', '#2922B5', '#6A1EC1', '#D60E6E', '#FF7D9A', '#0A7A5E', '#995935', '#E4E567', '#E3D704', '#C54D4F', '#FBD704', '#7D5C26', '#058F00', '#00A0B0', '#6B0A29', '#307087', '#B1DBD1', '#D611E0', '#9025C6', '#009A82', '#6325CD', '#525CF5', '#EC0B68', '#2FCF46', '#E6B30D', '#81DE17', '#005BFF', '#891A7F', '#ED2403', '#4A2126', '#E114C3', '#FFB600', '#E36D60', '#4B22C8', '#5DAB21', '#7B0393', '#98039B', '#ED7004', '#8EBB1A', '#0935A6', '#E9DD14', '#A6AD8C', '#91B00B', '#BF3E24', '#488DB5', '#B62EA7', '#0D6E74', '#DE0B64', '#00993A', '#F5498B', '#00CA0E', '#A577FF', '#0D195E', '#CF581B', '#0A6E17', '#A67308', '#32A200', '#BC326D', '#88214D', '#3A28C4', '#695240', '#EDD926', '#4545AB', '#5451EC', '#FA8E00', '#9361EA', '#C920B7', '#14BBE7', '#F86300', '#CE334F', '#E38D24', '#6BD52C', '#4F55ED', '#1A1AAE', '#E59D0D', '#2ac29e', '#E29440', '#0DA182', '#531BBA', '#FAB01D', '#B1008D', '#FFE500', '#BAD421', '#655A99', '#A34C3B', '#F3B000', '#A5267F', '#B400FF', '#79B726', '#D94C79', '#734024', '#425113', '#BF586B', '#0199B8', '#E70F21', '#A1482B', '#A714D4', '#00A2E8', '#4717A9', '#BECD41', '#6642D0', '#7EC27A', '#059E9C', '#FF8787', '#E8540A', '#4A14AA', '#DCE317', '#0EB6A7', '#D3DD1E', '#EE8711', '#571DB1', '#3BC335', '#228CFF', '#CE8003', '#42D0EA', '#990F2B', '#E869BF', '#B44AEF', '#1BC3D8', '#F9891B', '#C2238F', '#DEA801', '#50D525', '#6C0676', '#C6D314', '#C93457', '#1D07AC', '#D88602', '#DEC109', '#CFD1C7', '#2FB89A', '#409D3B', '#ED12E4', '#8CE47F', '#3D59DE', '#0D8B51', '#9030FF', '#7D26B5', '#DB7821', '#007AC9', '#0FBA9D', '#D6CD25', '#DCA41D', '#FA5A2A', '#1BBEAB', '#6735AF', '#DDA024', '#B986ED', '#1AB46A', '#FFCE0C', '#38C8D0', '#C03E3E', '#A18E3B', '#C70864', '#CB0856', '#41A782', '#EEAA05', '#7F7F99', '#AEF4F0', '#8BFF06', '#78D04F', '#43BA05', '#D4C2B5', '#DA4514', '#C75304', '#05E7CE', '#8C0C7F', '#6ABF0B', '#C12D74', '#DACD12', '#CA21A5', '#EFF2EB', '#523B40', '#E95F9A', '#FD636A', '#CC1F1F', '#8ACF47', '#bc6d75', '#BBC905', '#5C0A61', '#0CAE6E', '#B97E1A', '#461362', '#FB321E', '#D1ED73', '#B0C444', '#0118E3', '#EE8122', '#FFFF00', '#EBCD62', '#ED1D9A', '#FE6829', '#FF7F19', '#D4B873', '#A52B85', '#9736B2', '#cca770', '#C83D79', '#E64D73', '#118F32', '#FF6D40', '#DC1C1E', '#38377A', '#0037B8', '#B3A10D', '#435BF3', '#C21405', '#F75900', '#DDD112', '#AF16AC', '#098A71', '#2120CC', '#2E14D4', '#DD9016', '#DD0DD3', '#A8B700', '#BFD002', '#17CFDE', '#FF6C00', '#FF7536', '#D64703', '#C52ADB', '#EC7125', '#B4D933', '#03C1CD', '#0D37C3', '#6B87BF', '#ECC50A', '#6E068A', '#4B25C9', '#285EEA', '#82878F', '#373DBB', '#D645C8', '#35BA49', '#003B89', '#D84011', '#5F0FB4', '#C44B21', '#E2E2E2', '#B14A8D', '#E6E6E6', '#002AFF', '#C43A6E', '#048188', '#8A19F7', '#1021BE', '#3F2CD2', '#FFE80A', '#59BE9C', '#00B278', '#1B18D7', '#C0AE26', '#C95431', '#51C71B', '#03B362', '#28C05E', '#ED2635', '#6363D6', '#1384BA', '#14247F', '#F52E71', '#EEC70E', '#2DD9B6', '#D01D79', '#C1CC47', '#D0BE08', '#88AF45', '#4F9E00', '#17A80D', '#ED9408', '#03A65F', '#CACACA', '#8805CC', '#AB66B8', '#757A2B', '#4EE69F', '#830B9C', '#CD510A', '#FB5C03', '#BA0A07', '#FDFF00', '#695C3B', '#14B8A0', '#127A87', '#CF0466', '#E56F87', '#311AA8', '#08B672', '#BDBA14', '#1FAFE8', '#4828AB', '#890B5D', '#DF641A', '#BEB013', '#2CB721', '#3A0CCD', '#008006', '#A1E896', '#141494', '#793199', '#E7E710', '#E85407', '#4517D1', '#65B799', '#FF5937', '#413BBA', '#20837D', '#FFB500', '#2D9314', '#94C921', '#0D40DE', '#8ED11E', '#FFCA0E', '#6BFF00', '#31C4A9', '#6E04B6', '#098264', '#008040', '#047B8B', '#067E63', '#5EB604', '#003DA2', '#319471', '#1BB026', '#09950B', '#C64184', '#ABB012', '#FFA427', '#CD43A6', '#6B4221', '#799516', '#2E0CB5', '#CECE28', '#FFE99B', '#13A715', '#D6BF8F', '#ECE8B1', '#FC6D75', '#03644B', '#E1A307', '#8EDBB8', '#ED580B', '#596666', '#0D0DDC', '#CD2D7E', '#FF5E17', '#801AB3', '#3D1F7A', '#E1D6B6', '#007EDC', '#AB2A5C', '#DA3781', '#17774F', '#D1D1D1', '#C4354D', '#D9C100', '#118991', '#9090BA', '#086312', '#71DA0C', '#00967A', '#0943F0', '#1BA974', '#D74B31', '#6A3BE0', '#FFD624', '#014BD0', '#801A00', '#E900D2', '#BE7118', '#941A88', '#00A39A', '#CEB121', '#BEE600', '#788C87', '#AD5438', '#F1E61C', '#A5B533'], origin='N', direction=1, ticksFmt={'color': '#000000DD', 'fmt': '{:.2f}', 'fontsize': 8, 'lw': 1, 'range': (-0.5, -0.25)}, labelFmt={'color': '#000000EE', 'fmt': '{:.1f}', 'fontsize': 10, 'ha': 'left'})

Generates a radial barchart for

Parameters:
  • figAx (tuple) – (fig, ax) tuple as initialized by matplotlib (plt.subplots).

  • playerHistory (dataframe) – Player history dataframe.

  • cat (str) – Category over which the aggregation will be done. Defaults to ‘main weapon’.

  • stat (str) – Statistic to use in the plot. Defaults to ‘kill’.

  • aggFun (function, optional) – Aggregation function for groupby. Defaults to np.sum.

  • autoRange (bool, optional) – Auto-scales the radial plot with data min and data max. Defaults to True.

  • logScale (bool, optional) – Uses log-scale for the radial bars. Defaults to True.

  • gStep (int, optional) – Number of equally-spaced steps for radial ticks. Defaults to 30.

  • rRange (tuple, optional) – Radial angles for the plot. Defaults to (0, 270).

  • xRange (tuple, optional) – Values to map onto the rRange values. Defaults to (0, 10).

  • colors (_type_, optional) – List of hex colors for bars. Defaults to clr.ALL_COLORS.

Returns:

Matplotlib’s fig and ax objects.

Return type:

(fix, ax)

plotIris(figAx, topArray, bottomArray=None, barArray=None, tbRange=(0, 50), bRange=(0, 2000), lw=0.35, alpha=0.75, rScale='symlog', innerOffset=0.75, clockwise=True, colorsTop=('#311AA8', '#D60E6E'), colorBars='#6A1EC1', innerText=None, fontSize=20, fontColor='#000000CC', innerGuides=(0, 6, 1), innerGuidesColor='#00000066', outerGuides=(0, 50, 5), outerGuidesColor='#00000088', frameColor='#00000011')

Creates a barchart-style plot in a radial axis. The lines go from bottomArray to topArray, while the barArray is plotted as is from the origin.

Parameters:
  • figAx (tuple) – (fig, ax) tuple as initialized by matplotlib (plt.subplots).

  • topArray (array) –

  • bottomArray (array, optional) –

  • barArray (array, optional) –

  • tbRange (tuple, optional) – y-range for the top-bottom radii. Defaults to (0, 50).

  • bRange (tuple, optional) – y-range for the bar statistic. Defaults to (0, 2000).

  • rScale (str, optional) – Way the circular axis will be scaled. Defaults to ‘symlog’.

  • innerOffset (float, optional) – Radius of the innermost circle to create a clear area at the centar of the plot. Defaults to 0.75.

  • clockwise (bool, optional) – Sorting of the battles starts at 12 o’clock and goes clockwise. Defaults to True.

  • colorsTop (tuple, optional) – Color of the line if kills are larger than deaths, and if they are not. Defaults to (cst.CLR_STATS[‘kill’], cst.CLR_STATS[‘death’]).

  • colorBars (color, optional) – Color of the bars assigned to the paint statistic. Defaults to cst.CLR_PAINT.

  • innerText (bool, optional) – Add the inner label as the ratio of kills or kassists to deaths. Defaults to True.

  • innerTextFmt (str, optional) – Formatting string for the inner label. Defaults to ‘{:.2f}’.

  • fontSize (int, optional) – Font size for the inner label. Defaults to 20.

  • fontColor (str, optional) – Font color for the inner label. Defaults to ‘#00000066’.

  • innerGuides (tuple, optional) – Start, stop, increment values for the innermost guides on the radial axis. Defaults to (0, 6, 1).

  • innerGuidesColor (str, optional) – Color for the innermost guides. Defaults to “#00000066”.

  • outerGuides (tuple, optional) – Start stop, increment values for the outermost guides on the radial axis. Defaults to (0, 50, 10).

  • outerGuidesColor (str, optional) – Color for the outer guides. Defaults to “#00000088”.

  • frameColor (str, optional) – Color for the outermost radial frame. Defaults to “#00000011”.

Returns:

Matplotlib’s fig and ax objects.

Return type:

(fix, ax)

plotIrisAxes(figAx, innerOffset=2, statsNum=5, yRange=(0, 100), barWidth=0.1, frameColor='#00000000', rangeKD=(0, 40), lw=0.25, innerGuides=(0, 6, 1), innerGuidesColor='#00000088', outerGuides=(0, 50, 10), outerGuidesColor='#00000088')
plotIrisHistory(playerHistory, figAx=None, kassist=True, paint=True, innerOffset=2, clockwise=True, colorsKD=('#4E4EDDCC', '#CD2D7ECC'), colorP='#6A1EC111', rangeKD=(0, 40), rangeP=(0, 3500))
plotIrisKDP(playerHistory, figAx, kassist=True, paint=True, clockwise=True, innerOffset=2, colorsKD=('#4E4EDDCC', '#CD2D7ECC'), colorP='#6A1EC111', rangeKD=(0, 40), rangeP=(0, 3500), lw=0.25)
plotIrisMatch(playerHistory, figAx, innerRadius=40, typeLineLength=10, lw=0.25, colorsKO=('#311AA8', '#E70F21', '#ffffff'), offsets=(2, 5, 7), clockwise=True, mTypeColors={'Clam Blitz': '#D60E6E', 'Rainmaker': '#7D26B5', 'Splat Zones': '#3D59DE', 'Tower Control': '#8ACF47', 'Tricolor Turf War': '#88214D', 'Turf War': '#D1D1D1'}, winColors={False: '#D1D1D1', True: '#6BD52C'})
plotIrisStats(playerHistory, figAx, binSize=1, binMax=20, innerOffset=2, meanStat=True, barWidth=0.1, pstats=('kill', 'death', 'assist', 'special', 'ink'), colorBarEdge='#00000033', linewidthEdge=0.1, colorMean='#00000099', linewidthMean=0.5, INKSTATS_STYLE={'assist': {'color': '#801AB3DD', 'range': (0, 10), 'scaler': <function <lambda>>}, 'death': {'color': '#CD2D7EDD', 'range': (0, 15), 'scaler': <function <lambda>>}, 'ink': {'color': '#35BA49DD', 'range': (0, 20), 'scaler': <function <lambda>>}, 'kill': {'color': '#1A1AAEDD', 'range': (0, 15), 'scaler': <function <lambda>>}, 'special': {'color': '#1FAFE8DD', 'range': (0, 10), 'scaler': <function <lambda>>}})
plotKillsAndDeathsHistogram(figAx, playerHistory, killRange, binSize=1, assistsAdjustment=True, normalized=True, yRange=(-0.25, 0.25), aspect=0.25, alpha=0.75, edgecolor='#000000', kColor='#311AA8', dColor='#D60E6E', labelsDict={'fontsize': 10}, **kwargs)

Creates a paired histogram in which the top represents player kills, and the bottom the player deaths.

Parameters:
  • figAx (tuple) – (fig, ax) tuple as initialized by matplotlib (plt.subplots)

  • playerHistory (dataframe) – Player history dataframe with kills, deaths and assists categories.

  • killRange (tuple) – Minimum and maximum values to consider in the kill or death counts.

  • yRange (tuple, optional) – Minimum and maximum range values for the y axis in the plot. Defaults to (-.25, .25).

  • aspect (float, optional) – Aspect ratio of the output plot. Defaults to .25.

  • binSize (int, optional) – Bin sizes for the frequency counts. Defaults to 1.

  • assistsAdjustment (bool, optional) – If TRUE, the kills value is calculated as kills+0.5*assists. Defaults to True.

  • normalized (bool, optional) – If TRUE, the frequencies are divided by the total, so that they add to one. Defaults to True.

  • alpha (float, optional) – Opacity of the rectangles. Defaults to 0.35.

  • kColor (hex, optional) – Facecolor for the “kills” rectangles. Defaults to pkg constant.

  • dColor (hex, optional) – Facecolor for the “deaths” rectangles. Defaults to pkg constant.

  • edgecolor (hex, optional) – Edgecolor for all the rectangles. Defaults to ‘#000000’.

Returns:

Matplotlib’s fig and ax objects.

Return type:

(fix, ax)

plotMatchHistory(figAx, playerHistory, yRange=((0, 50), (0, 1750)), labelsize=6, alphaMultiplier=1, sizeMultiplier=1, printStats=True, ilocRange=(0, -1))

Generates a scatter plot of all the matches, and provides information on kills, deaths, paint, assists, specials, etc. Please refer to our website for more information.

Parameters:
  • figAx (tuple) – (fig, ax) tuple as initialized by matplotlib (plt.subplots).

  • playerHistory (dataframe) – Player history dataframe with kills, deaths and assists categories.

  • yRange (tuple, optional) – _description_. Defaults to ((0, 50), (0, 1750)).

  • labelsize (float, optional) – Font size for stats legend. Defaults to 5.

  • alphaMultiplier (int, optional) – Unused. Defaults to 1.

  • sizeMultiplier (int, optional) – Unused. Defaults to 1.

  • printStats (bool, optional) – If False, no stats legend boxes are added to the plot. Defaults to True.

Returns:

Matplotlib’s fig and ax objects.

Return type:

(fix, ax)

plotMatchTypeBars(stagesByTypeFlat, metric, aggMetrics=('win', 'total matches'), yRange=(0, 1), cDict={'Barnacle & Dime': '#83C91A', 'Brinewater Springs': '#5F0FB4', 'Eeltail Alley': '#ED9408', 'Flounder Heights': '#C4354D', 'Hagglefish Market': '#311AA8', 'Hammerhead Bridge': '#FB321E', 'Humpback Pump Track': '#71DA0C', 'Inkblot Art Academy': '#D60E6E', 'Mahi-Mahi Resort': '#7F7F99', 'MakoMart': '#2BDCED', 'Manta Maria': '#FFFF00', 'Mincemeat Metalworks': '#88214D', "Museum d'Alfonsino": '#B1DBD1', 'Scorch Gorge': '#6B87BF', 'Sturgeon Shipyard': '#00CA0E', "Um'ami Ruins": '#C920B7', 'Undertow Spillway': '#BFD002', 'Wahoo World': '#A577FF'}, alpha=0.75, wspace=0.05, hspace=0, aspect=1, fontsize=8, sorting=['Turf War', 'Tower Control', 'Rainmaker', 'Splat Zones', 'Clam Blitz', 'Tricolor Turf War'], percentLegend={'color': '#00000020', 'fontsize': 50}, countsLegend={'color': '#00000044', 'fontsize': 8}, digs=3, percentage=True, textOffset=0.01, fmt='{:.2f}')

Generates a grid of seaborn plots with stats broken down by match type and stage.

Parameters:
  • stagesByTypeFlat (dataframe) – Dataframe obtained by running ammendStagesStatsByType on the calcStagesStatsByType structure.

  • metric (str) – Main metric for bar sizes.

  • aggMetrics (tuple of strings) – These two metrics are used to calculate a fraction of metric1/metric2 on the aggregate value displayed. Defaults to (‘win’, ‘total matches’).

  • yRange (tuple, optional) – y-axis plot range. Defaults to (0, 1).

  • cDict (dict, optional) – Colors dictionary in the form {‘stage name’: hexColor}. Defaults to cst.CLR_STAGE.

  • alpha (float, optional) – Alpha value for bars. Defaults to 0.75.

  • wspace (float, optional) – Frames horizontal spacing. Defaults to 0.05.

  • hspace (int, optional) – Frames vertical spacing. Defaults to 0.

  • aspect (int, optional) – Boxes aspect ratio. Defaults to 1.

  • fontsize (int, optional) – Labels font size. Defaults to 8.

  • sorting (list, optional) – Sorting of the match-types. Defaults to [ ‘Turf War’, ‘Tower Control’, ‘Rainmaker’, ‘Splat Zones’, ‘Clam Blitz’ ].

  • percentLegend (dict, optional) – Style for the main aggregate label. Defaults to {‘color’: ‘#00000020’, ‘fontsize’: 50}.

  • countsLegend (dict, optional) – Style for the counts labels on the bars. Defaults to {‘color’: ‘#00000044’, ‘fontsize’: 8}.

  • digs (int, optional) – Digits for zfill. Defaults to 3.

  • percentage (bool, optional) – Plot fractions as percentages? Defaults to True.

  • fmt (str, optional) – Format string for plot aggregate’s value. Defaults to ‘{:.2f}’.

Returns:

Seaborn facetgrid object.

Return type:

sns facetgrid

plotMatchTypeHistory(figAx, playerHistory, labelsize=5, alphaMultiplier=1, sizeMultiplier=1, ilocRange=(0, -1))

Plots the matches history strip in terms of match types, win/loss, KO, etc.

Parameters:
  • figAx (tuple) – (fig, ax) tuple as initialized by matplotlib (plt.subplots).

  • playerHistory (dataframe) – Player history dataframe with kills, deaths and assists categories.

  • labelsize (float, optional) – Font size for the weapon id ticks labels (use “None” for no label). Defaults to 5.

  • alphaMultiplier (int, optional) – Multiplier for alpha value of markers. Defaults to 1.

  • sizeMultiplier (int, optional) – Multiplier for markers size. Defaults to 1.

Returns:

Matplotlib’s fig and ax objects.

Return type:

(fix, ax)

plotRanking(figAx, rankingDF, normalized=True, yLim=None, xLim=None, colors=['#C70864', '#C920B7', '#4B25C9', '#830B9C', '#2CB721'], categories=['kill', 'death', 'assist', 'paint', 'special'], widthBar=0.9, title=True, pad=0, titlePos=(0.975, 0.85), fontsize=20, **kwargs)

Generates barcharts on stats for player’s ranking across categories.

Parameters:
  • figAx (tuple) – (fig, ax) tuple as initialized by matplotlib (plt.subplots).

  • rankingDF (dataframe) – Either getPlayerAlliedRanking or getPlayerFullRanking dataframe on battle data.

  • normalized (bool, optional) – If true, data is scaled to proportions (0 to 1) instead of raw frequencies. Defaults to True.

  • xLim (tuple, optional) – Plot limits on x axis Defaults to None.

  • yLim (tuple, optional) – Plot limits on y axis. Defaults to None.

  • colors (list, optional) – Color palette for bars. Defaults to [‘#C70864’, ‘#C920B7’, ‘#4B25C9’, ‘#830B9C’, ‘#2CB721’].

  • categories (list, optional) – Categories for the ranks (in order). Defaults to [‘kill’, ‘death’, ‘assist’, ‘paint’, ‘special’].

  • widthBar (float, optional) – Bars width. Defaults to 0.9.

  • title (bool, optional) – If true, the title of the plot is printed. Defaults to True.

  • titlePos (tuple, optional) – Position for plots’ title. Defaults to (0.975, .9).

  • pad (int, optional) – Padding for plots along the grid. Defaults to 0.

Returns:

Matplotlib’s fig and ax objects.

Return type:

(fix, ax)

plotTreemapByKey(figAx, keyedDF, key, metric='win ratio', fmt='{:.2f}', title=True, pad=0.1, lw=2, ec='#00000055', alpha=0.65, colors=['#88214D', '#82878F', '#0D195E', '#DDD112', '#047B8B', '#ED12E4', '#FF7536', '#9090BA', '#DC1C1E', '#D60E6E', '#311AA8', '#17A80D', '#BFD002', '#4E85C1', '#C920B7', '#5F0FB4', '#08B672', '#32A200', '#F9891B', '#25B100', '#571DB1', '#CD2D7E', '#1BA974', '#98039B', '#C75304', '#C70864', '#BDBA14', '#4E85C1', '#4828AB', '#B0C444'])

_summary_

Parameters:
  • figAx (tuple) – (fig, ax) tuple as initialized by matplotlib (plt.subplots).

  • keyedDF (dataframe) – Key-statistics dataframe (see “calcStagesStatsByType”).

  • metric (str, optional) – Metric of the dataframe that will be plotted (column). Defaults to ‘win ratio’.

  • fmt (str, optional) – Format string for the numbers labels. Defaults to ‘{:.2f}’.

  • pad (int, optional) – Padding in-between rectangles. Defaults to 0.

  • lw (int, optional) – Rectangle line width. Defaults to 2.

  • ec (str, optional) – Rectangle line color. Defaults to ‘#00000055’.

  • colors (lst, optional) – List of colors in order of appearance. Defailts to cst.CLR_CLS_LONG.

Returns:

Matplotlib’s fig and ax objects.

Return type:

(fix, ax)

plotTreemapByStages(figAx, stagesDF, metric='win ratio', fmt='{:.2f}', title=True, pad=0.1, lw=2, ec='#00000055', alpha=0.65)

_summary_

Parameters:
  • figAx (tuple) – (fig, ax) tuple as initialized by matplotlib (plt.subplots).

  • stagesDF (dataframe) – Stage statistics dataframe (see “calcStagesStats” or “calcStagesStatsByType”).

  • metric (str, optional) – Metric of the dataframe that will be plotted (column). Defaults to ‘win ratio’.

  • fmt (str, optional) – Format string for the numbers labels. Defaults to ‘{:.2f}’.

  • pad (int, optional) – Padding in-between rectangles. Defaults to 0.

  • lw (int, optional) – Rectangle line width. Defaults to 2.

  • ec (str, optional) – Rectangle line color. Defaults to ‘#00000055’.

Returns:

Matplotlib’s fig and ax objects.

Return type:

(fix, ax)

plotWaffleStat(figAx, playerHistory, function=<built-in function sum>, grouping='main weapon', stat='kill', rows=50, columns=50, startingLocation='NW', blockArranging='snake', intervalRatioX=0.5, intervalRatioY=0.5, colors=['#83C91A', '#E1772B', '#AD7710', '#4D24A3', '#CF3350', '#FABF50', '#25B100', '#9A6FCC', '#E75A2D', '#2BDCED', '#EFF66E', '#308766', '#9208B2', '#009A6E', '#C42138', '#4E4EDD', '#60AB43', '#26229F', '#4E85C1', '#E24FE5', '#2922B5', '#6A1EC1', '#D60E6E', '#FF7D9A', '#0A7A5E', '#995935', '#E4E567', '#E3D704', '#C54D4F', '#FBD704', '#7D5C26', '#058F00', '#00A0B0', '#6B0A29', '#307087', '#B1DBD1', '#D611E0', '#9025C6', '#009A82', '#6325CD', '#525CF5', '#EC0B68', '#2FCF46', '#E6B30D', '#81DE17', '#005BFF', '#891A7F', '#ED2403', '#4A2126', '#E114C3', '#FFB600', '#E36D60', '#4B22C8', '#5DAB21', '#7B0393', '#98039B', '#ED7004', '#8EBB1A', '#0935A6', '#E9DD14', '#A6AD8C', '#91B00B', '#BF3E24', '#488DB5', '#B62EA7', '#0D6E74', '#DE0B64', '#00993A', '#F5498B', '#00CA0E', '#A577FF', '#0D195E', '#CF581B', '#0A6E17', '#A67308', '#32A200', '#BC326D', '#88214D', '#3A28C4', '#695240', '#EDD926', '#4545AB', '#5451EC', '#FA8E00', '#9361EA', '#C920B7', '#14BBE7', '#F86300', '#CE334F', '#E38D24', '#6BD52C', '#4F55ED', '#1A1AAE', '#E59D0D', '#2ac29e', '#E29440', '#0DA182', '#531BBA', '#FAB01D', '#B1008D', '#FFE500', '#BAD421', '#655A99', '#A34C3B', '#F3B000', '#A5267F', '#B400FF', '#79B726', '#D94C79', '#734024', '#425113', '#BF586B', '#0199B8', '#E70F21', '#A1482B', '#A714D4', '#00A2E8', '#4717A9', '#BECD41', '#6642D0', '#7EC27A', '#059E9C', '#FF8787', '#E8540A', '#4A14AA', '#DCE317', '#0EB6A7', '#D3DD1E', '#EE8711', '#571DB1', '#3BC335', '#228CFF', '#CE8003', '#42D0EA', '#990F2B', '#E869BF', '#B44AEF', '#1BC3D8', '#F9891B', '#C2238F', '#DEA801', '#50D525', '#6C0676', '#C6D314', '#C93457', '#1D07AC', '#D88602', '#DEC109', '#CFD1C7', '#2FB89A', '#409D3B', '#ED12E4', '#8CE47F', '#3D59DE', '#0D8B51', '#9030FF', '#7D26B5', '#DB7821', '#007AC9', '#0FBA9D', '#D6CD25', '#DCA41D', '#FA5A2A', '#1BBEAB', '#6735AF', '#DDA024', '#B986ED', '#1AB46A', '#FFCE0C', '#38C8D0', '#C03E3E', '#A18E3B', '#C70864', '#CB0856', '#41A782', '#EEAA05', '#7F7F99', '#AEF4F0', '#8BFF06', '#78D04F', '#43BA05', '#D4C2B5', '#DA4514', '#C75304', '#05E7CE', '#8C0C7F', '#6ABF0B', '#C12D74', '#DACD12', '#CA21A5', '#EFF2EB', '#523B40', '#E95F9A', '#FD636A', '#CC1F1F', '#8ACF47', '#bc6d75', '#BBC905', '#5C0A61', '#0CAE6E', '#B97E1A', '#461362', '#FB321E', '#D1ED73', '#B0C444', '#0118E3', '#EE8122', '#FFFF00', '#EBCD62', '#ED1D9A', '#FE6829', '#FF7F19', '#D4B873', '#A52B85', '#9736B2', '#cca770', '#C83D79', '#E64D73', '#118F32', '#FF6D40', '#DC1C1E', '#38377A', '#0037B8', '#B3A10D', '#435BF3', '#C21405', '#F75900', '#DDD112', '#AF16AC', '#098A71', '#2120CC', '#2E14D4', '#DD9016', '#DD0DD3', '#A8B700', '#BFD002', '#17CFDE', '#FF6C00', '#FF7536', '#D64703', '#C52ADB', '#EC7125', '#B4D933', '#03C1CD', '#0D37C3', '#6B87BF', '#ECC50A', '#6E068A', '#4B25C9', '#285EEA', '#82878F', '#373DBB', '#D645C8', '#35BA49', '#003B89', '#D84011', '#5F0FB4', '#C44B21', '#E2E2E2', '#B14A8D', '#E6E6E6', '#002AFF', '#C43A6E', '#048188', '#8A19F7', '#1021BE', '#3F2CD2', '#FFE80A', '#59BE9C', '#00B278', '#1B18D7', '#C0AE26', '#C95431', '#51C71B', '#03B362', '#28C05E', '#ED2635', '#6363D6', '#1384BA', '#14247F', '#F52E71', '#EEC70E', '#2DD9B6', '#D01D79', '#C1CC47', '#D0BE08', '#88AF45', '#4F9E00', '#17A80D', '#ED9408', '#03A65F', '#CACACA', '#8805CC', '#AB66B8', '#757A2B', '#4EE69F', '#830B9C', '#CD510A', '#FB5C03', '#BA0A07', '#FDFF00', '#695C3B', '#14B8A0', '#127A87', '#CF0466', '#E56F87', '#311AA8', '#08B672', '#BDBA14', '#1FAFE8', '#4828AB', '#890B5D', '#DF641A', '#BEB013', '#2CB721', '#3A0CCD', '#008006', '#A1E896', '#141494', '#793199', '#E7E710', '#E85407', '#4517D1', '#65B799', '#FF5937', '#413BBA', '#20837D', '#FFB500', '#2D9314', '#94C921', '#0D40DE', '#8ED11E', '#FFCA0E', '#6BFF00', '#31C4A9', '#6E04B6', '#098264', '#008040', '#047B8B', '#067E63', '#5EB604', '#003DA2', '#319471', '#1BB026', '#09950B', '#C64184', '#ABB012', '#FFA427', '#CD43A6', '#6B4221', '#799516', '#2E0CB5', '#CECE28', '#FFE99B', '#13A715', '#D6BF8F', '#ECE8B1', '#FC6D75', '#03644B', '#E1A307', '#8EDBB8', '#ED580B', '#596666', '#0D0DDC', '#CD2D7E', '#FF5E17', '#801AB3', '#3D1F7A', '#E1D6B6', '#007EDC', '#AB2A5C', '#DA3781', '#17774F', '#D1D1D1', '#C4354D', '#D9C100', '#118991', '#9090BA', '#086312', '#71DA0C', '#00967A', '#0943F0', '#1BA974', '#D74B31', '#6A3BE0', '#FFD624', '#014BD0', '#801A00', '#E900D2', '#BE7118', '#941A88', '#00A39A', '#CEB121', '#BEE600', '#788C87', '#AD5438', '#F1E61C', '#A5B533'], alpha=0.6, fmt='{:.2f}', title=True, vertical=True, legendDict={'bbox_to_anchor': (1, 1), 'fontsize': 10, 'framealpha': 0, 'loc': 'upper left', 'ncol': 1}, **kwargs)

Generates a waffle plot of aggregated statistics on player’s history (eg. sums of kills broken by main weapon).

Parameters:
  • figAx (tuple) – (fig, ax) tuple as initialized by matplotlib (plt.subplots).

  • playerHistory (dataframe) – Player history dataframe.

  • function (function, optional) – Aggregation function for groupby. Defaults to sum.

  • grouping (str, optional) – Category over which the aggregation will be done. Defaults to ‘main weapon’.

  • stat (str, optional) – Statistic to use in the plot. Defaults to ‘kill’.

  • rows (int, optional) – Number of rows for waffle. Defaults to 50.

  • columns (int, optional) – Number of columns for waffle. Defaults to 50.

  • startingLocation (str, optional) – Waffle’s starting locations (see pywaffle’s docs). Defaults to ‘NW’.

  • blockArranging (str, optional) – Block arranging (see pywaffle’s docs). Defaults to ‘snake’.

  • intervalRatioX (float, optional) – Spacing over x axis. Defaults to 0.5.

  • intervalRatioY (float, optional) – Spacing over y axis. Defaults to 0.5.

  • colors (list, optional) – List of hex colors. Defaults to clr.ALL_COLORS.

  • alpha (float, optional) – Alpha for the colors. Defaults to .6.

  • fmt (str, optional) – Formating for the title number. Defaults to “{:.2f}”.

  • title (bool, optional) – Prints title if true. Defaults to True.

  • legendDict (dict, optional) – Dictionary for labels (see pywaffle’s docs). Defaults to { ‘loc’: ‘upper left’, ‘bbox_to_anchor’: (1, 1), ‘ncol’: 1, ‘framealpha’: 0, ‘fontsize’: 10 }.

Returns:

Matplotlib’s fig and ax objects.

Return type:

(fix, ax)

plotkillDeathIris(figAx, playerHistory, kassist=True, paint=True, kRange=(0, 50), pRange=(0, 2000), alpha=0.85, rScale='symlog', innerOffset=0.75, clockwise=True, colorsTop=('#311AA8', '#D60E6E'), colorBars='#6A1EC1', innerText=True, innerTextFmt='{:.2f}', fontSize=20, fontColor='#00000066', innerGuides=(0, 10, 1), innerGuidesColor='#00000066', outerGuides=(0, 50, 10), outerGuidesColor='#00000088', frameColor='#00000011')

These plots show the kill to death ratios as bars arranged in a circular pattern.

Parameters:
  • figAx (tuple) – (fig, ax) tuple as initialized by matplotlib (plt.subplots).

  • playerHistory (dataframe) – Player history dataframe with kills, deaths and assists categories.

  • kassist (bool, optional) – Combine the kill and assist statistics as kassist=kill+0.5*assist. Defaults to True.

  • paint (bool, optional) – Use paint stat to plot it as a bar behind the main stats. Defaults to True.

  • kRange (tuple, optional) – y-range for the kill+death ratios. Defaults to (0, 50).

  • pRange (tuple, optional) – y-range for the paint statistic. Defaults to (0, 2000).

  • rScale (str, optional) – Way the circular axis will be scaled. Defaults to ‘symlog’.

  • innerOffset (float, optional) – Radius of the innermost circle to create a clear area at the centar of the plot. Defaults to 0.75.

  • clockwise (bool, optional) – Sorting of the battles starts at 12 o’clock and goes clockwise. Defaults to True.

  • colorsTop (tuple, optional) – Color of the line if kills are larger than deaths, and if they are not. Defaults to (cst.CLR_STATS[‘kill’], cst.CLR_STATS[‘death’]).

  • colorBars (color, optional) – Color of the bars assigned to the paint statistic. Defaults to cst.CLR_PAINT.

  • innerText (bool, optional) – Add the inner label as the ratio of kills or kassists to deaths. Defaults to True.

  • innerTextFmt (str, optional) – Formatting string for the inner label. Defaults to ‘{:.2f}’.

  • fontSize (int, optional) – Font size for the inner label. Defaults to 20.

  • fontColor (str, optional) – Font color for the inner label. Defaults to ‘#00000066’.

  • innerGuides (tuple, optional) – Start, stop, increment values for the innermost guides on the radial axis. Defaults to (0, 6, 1).

  • innerGuidesColor (str, optional) – Color for the innermost guides. Defaults to “#00000066”.

  • outerGuides (tuple, optional) – Start stop, increment values for the outermost guides on the radial axis. Defaults to (0, 50, 10).

  • outerGuidesColor (str, optional) – Color for the outer guides. Defaults to “#00000088”.

  • frameColor (str, optional) – Color for the outermost radial frame. Defaults to “#00000011”.

Returns:

Matplotlib’s fig and ax objects.

Return type:

(fix, ax)

polarBarChart(xVals, yVals, figAx=None, logScale=False, ticksStep=10, rRange=(0, 270), yRange=None, colors=['#83C91A', '#E1772B', '#AD7710', '#4D24A3', '#CF3350', '#FABF50', '#25B100', '#9A6FCC', '#E75A2D', '#2BDCED', '#EFF66E', '#308766', '#9208B2', '#009A6E', '#C42138', '#4E4EDD', '#60AB43', '#26229F', '#4E85C1', '#E24FE5', '#2922B5', '#6A1EC1', '#D60E6E', '#FF7D9A', '#0A7A5E', '#995935', '#E4E567', '#E3D704', '#C54D4F', '#FBD704', '#7D5C26', '#058F00', '#00A0B0', '#6B0A29', '#307087', '#B1DBD1', '#D611E0', '#9025C6', '#009A82', '#6325CD', '#525CF5', '#EC0B68', '#2FCF46', '#E6B30D', '#81DE17', '#005BFF', '#891A7F', '#ED2403', '#4A2126', '#E114C3', '#FFB600', '#E36D60', '#4B22C8', '#5DAB21', '#7B0393', '#98039B', '#ED7004', '#8EBB1A', '#0935A6', '#E9DD14', '#A6AD8C', '#91B00B', '#BF3E24', '#488DB5', '#B62EA7', '#0D6E74', '#DE0B64', '#00993A', '#F5498B', '#00CA0E', '#A577FF', '#0D195E', '#CF581B', '#0A6E17', '#A67308', '#32A200', '#BC326D', '#88214D', '#3A28C4', '#695240', '#EDD926', '#4545AB', '#5451EC', '#FA8E00', '#9361EA', '#C920B7', '#14BBE7', '#F86300', '#CE334F', '#E38D24', '#6BD52C', '#4F55ED', '#1A1AAE', '#E59D0D', '#2ac29e', '#E29440', '#0DA182', '#531BBA', '#FAB01D', '#B1008D', '#FFE500', '#BAD421', '#655A99', '#A34C3B', '#F3B000', '#A5267F', '#B400FF', '#79B726', '#D94C79', '#734024', '#425113', '#BF586B', '#0199B8', '#E70F21', '#A1482B', '#A714D4', '#00A2E8', '#4717A9', '#BECD41', '#6642D0', '#7EC27A', '#059E9C', '#FF8787', '#E8540A', '#4A14AA', '#DCE317', '#0EB6A7', '#D3DD1E', '#EE8711', '#571DB1', '#3BC335', '#228CFF', '#CE8003', '#42D0EA', '#990F2B', '#E869BF', '#B44AEF', '#1BC3D8', '#F9891B', '#C2238F', '#DEA801', '#50D525', '#6C0676', '#C6D314', '#C93457', '#1D07AC', '#D88602', '#DEC109', '#CFD1C7', '#2FB89A', '#409D3B', '#ED12E4', '#8CE47F', '#3D59DE', '#0D8B51', '#9030FF', '#7D26B5', '#DB7821', '#007AC9', '#0FBA9D', '#D6CD25', '#DCA41D', '#FA5A2A', '#1BBEAB', '#6735AF', '#DDA024', '#B986ED', '#1AB46A', '#FFCE0C', '#38C8D0', '#C03E3E', '#A18E3B', '#C70864', '#CB0856', '#41A782', '#EEAA05', '#7F7F99', '#AEF4F0', '#8BFF06', '#78D04F', '#43BA05', '#D4C2B5', '#DA4514', '#C75304', '#05E7CE', '#8C0C7F', '#6ABF0B', '#C12D74', '#DACD12', '#CA21A5', '#EFF2EB', '#523B40', '#E95F9A', '#FD636A', '#CC1F1F', '#8ACF47', '#bc6d75', '#BBC905', '#5C0A61', '#0CAE6E', '#B97E1A', '#461362', '#FB321E', '#D1ED73', '#B0C444', '#0118E3', '#EE8122', '#FFFF00', '#EBCD62', '#ED1D9A', '#FE6829', '#FF7F19', '#D4B873', '#A52B85', '#9736B2', '#cca770', '#C83D79', '#E64D73', '#118F32', '#FF6D40', '#DC1C1E', '#38377A', '#0037B8', '#B3A10D', '#435BF3', '#C21405', '#F75900', '#DDD112', '#AF16AC', '#098A71', '#2120CC', '#2E14D4', '#DD9016', '#DD0DD3', '#A8B700', '#BFD002', '#17CFDE', '#FF6C00', '#FF7536', '#D64703', '#C52ADB', '#EC7125', '#B4D933', '#03C1CD', '#0D37C3', '#6B87BF', '#ECC50A', '#6E068A', '#4B25C9', '#285EEA', '#82878F', '#373DBB', '#D645C8', '#35BA49', '#003B89', '#D84011', '#5F0FB4', '#C44B21', '#E2E2E2', '#B14A8D', '#E6E6E6', '#002AFF', '#C43A6E', '#048188', '#8A19F7', '#1021BE', '#3F2CD2', '#FFE80A', '#59BE9C', '#00B278', '#1B18D7', '#C0AE26', '#C95431', '#51C71B', '#03B362', '#28C05E', '#ED2635', '#6363D6', '#1384BA', '#14247F', '#F52E71', '#EEC70E', '#2DD9B6', '#D01D79', '#C1CC47', '#D0BE08', '#88AF45', '#4F9E00', '#17A80D', '#ED9408', '#03A65F', '#CACACA', '#8805CC', '#AB66B8', '#757A2B', '#4EE69F', '#830B9C', '#CD510A', '#FB5C03', '#BA0A07', '#FDFF00', '#695C3B', '#14B8A0', '#127A87', '#CF0466', '#E56F87', '#311AA8', '#08B672', '#BDBA14', '#1FAFE8', '#4828AB', '#890B5D', '#DF641A', '#BEB013', '#2CB721', '#3A0CCD', '#008006', '#A1E896', '#141494', '#793199', '#E7E710', '#E85407', '#4517D1', '#65B799', '#FF5937', '#413BBA', '#20837D', '#FFB500', '#2D9314', '#94C921', '#0D40DE', '#8ED11E', '#FFCA0E', '#6BFF00', '#31C4A9', '#6E04B6', '#098264', '#008040', '#047B8B', '#067E63', '#5EB604', '#003DA2', '#319471', '#1BB026', '#09950B', '#C64184', '#ABB012', '#FFA427', '#CD43A6', '#6B4221', '#799516', '#2E0CB5', '#CECE28', '#FFE99B', '#13A715', '#D6BF8F', '#ECE8B1', '#FC6D75', '#03644B', '#E1A307', '#8EDBB8', '#ED580B', '#596666', '#0D0DDC', '#CD2D7E', '#FF5E17', '#801AB3', '#3D1F7A', '#E1D6B6', '#007EDC', '#AB2A5C', '#DA3781', '#17774F', '#D1D1D1', '#C4354D', '#D9C100', '#118991', '#9090BA', '#086312', '#71DA0C', '#00967A', '#0943F0', '#1BA974', '#D74B31', '#6A3BE0', '#FFD624', '#014BD0', '#801A00', '#E900D2', '#BE7118', '#941A88', '#00A39A', '#CEB121', '#BEE600', '#788C87', '#AD5438', '#F1E61C', '#A5B533'], edgecolor='#00000000', linewidth=0, labels=True, labelQty=False, origin='N', direction=1, ticksFmt={'color': '#000000DD', 'fmt': '{:.1f}', 'fontsize': 8, 'lw': 1, 'range': (-0.5, -0.25)}, labelFmt={'color': '#000000EE', 'fmt': '{:.1f}', 'fontsize': 10, 'ha': 'left'})
polarBarRanks(dfRank, ranksNum, cats=['kill', 'death', 'assist', 'paint'], yRange=(0, 1), ticksStep=10, colors=['#EC0B68', '#3D59DE', '#6BFF00', '#38377A'])

SplatStats.plotsAux module

align_yaxis(ax1, v1, ax2, v2)

adjust ax2 ylimit so that v2 in ax2 is aligned to v1 in ax1

mapNumberToSaturation(num, colorHex, numLims=(0, 15, 50), satLims=(0, 0.1, 1))

Linearly maps a variable within a range (numLim) to the saturation value of a color.

Parameters:
  • num (float) – Number in the (numLim) range.

  • colorHex (str) – Color of which the saturation will be changed.

  • numLims (tuple, optional) – Range of values the number can take. Defaults to (0, 15, 50).

  • satLims (tuple, optional) – Range of saturations the values will be linearly mapped to. Defaults to (0, 1, 1).

Returns:

Hex of the new color with saturation changed dependent on the number value.

Return type:

str

SplatStats.plotsTeam module

plotStreamTeam(figAx, team, teamHistBT, colors=['#83C91A', '#E1772B', '#AD7710', '#4D24A3', '#CF3350', '#FABF50', '#25B100', '#9A6FCC', '#E75A2D', '#2BDCED', '#EFF66E', '#308766', '#9208B2', '#009A6E', '#C42138', '#4E4EDD', '#60AB43', '#26229F', '#4E85C1', '#E24FE5', '#2922B5', '#6A1EC1', '#D60E6E', '#FF7D9A', '#0A7A5E', '#995935', '#E4E567', '#E3D704', '#C54D4F', '#FBD704', '#7D5C26', '#058F00', '#00A0B0', '#6B0A29', '#307087', '#B1DBD1', '#D611E0', '#9025C6', '#009A82', '#6325CD', '#525CF5', '#EC0B68', '#2FCF46', '#E6B30D', '#81DE17', '#005BFF', '#891A7F', '#ED2403', '#4A2126', '#E114C3', '#FFB600', '#E36D60', '#4B22C8', '#5DAB21', '#7B0393', '#98039B', '#ED7004', '#8EBB1A', '#0935A6', '#E9DD14', '#A6AD8C', '#91B00B', '#BF3E24', '#488DB5', '#B62EA7', '#0D6E74', '#DE0B64', '#00993A', '#F5498B', '#00CA0E', '#A577FF', '#0D195E', '#CF581B', '#0A6E17', '#A67308', '#32A200', '#BC326D', '#88214D', '#3A28C4', '#695240', '#EDD926', '#4545AB', '#5451EC', '#FA8E00', '#9361EA', '#C920B7', '#14BBE7', '#F86300', '#CE334F', '#E38D24', '#6BD52C', '#4F55ED', '#1A1AAE', '#E59D0D', '#2ac29e', '#E29440', '#0DA182', '#531BBA', '#FAB01D', '#B1008D', '#FFE500', '#BAD421', '#655A99', '#A34C3B', '#F3B000', '#A5267F', '#B400FF', '#79B726', '#D94C79', '#734024', '#425113', '#BF586B', '#0199B8', '#E70F21', '#A1482B', '#A714D4', '#00A2E8', '#4717A9', '#BECD41', '#6642D0', '#7EC27A', '#059E9C', '#FF8787', '#E8540A', '#4A14AA', '#DCE317', '#0EB6A7', '#D3DD1E', '#EE8711', '#571DB1', '#3BC335', '#228CFF', '#CE8003', '#42D0EA', '#990F2B', '#E869BF', '#B44AEF', '#1BC3D8', '#F9891B', '#C2238F', '#DEA801', '#50D525', '#6C0676', '#C6D314', '#C93457', '#1D07AC', '#D88602', '#DEC109', '#CFD1C7', '#2FB89A', '#409D3B', '#ED12E4', '#8CE47F', '#3D59DE', '#0D8B51', '#9030FF', '#7D26B5', '#DB7821', '#007AC9', '#0FBA9D', '#D6CD25', '#DCA41D', '#FA5A2A', '#1BBEAB', '#6735AF', '#DDA024', '#B986ED', '#1AB46A', '#FFCE0C', '#38C8D0', '#C03E3E', '#A18E3B', '#C70864', '#CB0856', '#41A782', '#EEAA05', '#7F7F99', '#AEF4F0', '#8BFF06', '#78D04F', '#43BA05', '#D4C2B5', '#DA4514', '#C75304', '#05E7CE', '#8C0C7F', '#6ABF0B', '#C12D74', '#DACD12', '#CA21A5', '#EFF2EB', '#523B40', '#E95F9A', '#FD636A', '#CC1F1F', '#8ACF47', '#bc6d75', '#BBC905', '#5C0A61', '#0CAE6E', '#B97E1A', '#461362', '#FB321E', '#D1ED73', '#B0C444', '#0118E3', '#EE8122', '#FFFF00', '#EBCD62', '#ED1D9A', '#FE6829', '#FF7F19', '#D4B873', '#A52B85', '#9736B2', '#cca770', '#C83D79', '#E64D73', '#118F32', '#FF6D40', '#DC1C1E', '#38377A', '#0037B8', '#B3A10D', '#435BF3', '#C21405', '#F75900', '#DDD112', '#AF16AC', '#098A71', '#2120CC', '#2E14D4', '#DD9016', '#DD0DD3', '#A8B700', '#BFD002', '#17CFDE', '#FF6C00', '#FF7536', '#D64703', '#C52ADB', '#EC7125', '#B4D933', '#03C1CD', '#0D37C3', '#6B87BF', '#ECC50A', '#6E068A', '#4B25C9', '#285EEA', '#82878F', '#373DBB', '#D645C8', '#35BA49', '#003B89', '#D84011', '#5F0FB4', '#C44B21', '#E2E2E2', '#B14A8D', '#E6E6E6', '#002AFF', '#C43A6E', '#048188', '#8A19F7', '#1021BE', '#3F2CD2', '#FFE80A', '#59BE9C', '#00B278', '#1B18D7', '#C0AE26', '#C95431', '#51C71B', '#03B362', '#28C05E', '#ED2635', '#6363D6', '#1384BA', '#14247F', '#F52E71', '#EEC70E', '#2DD9B6', '#D01D79', '#C1CC47', '#D0BE08', '#88AF45', '#4F9E00', '#17A80D', '#ED9408', '#03A65F', '#CACACA', '#8805CC', '#AB66B8', '#757A2B', '#4EE69F', '#830B9C', '#CD510A', '#FB5C03', '#BA0A07', '#FDFF00', '#695C3B', '#14B8A0', '#127A87', '#CF0466', '#E56F87', '#311AA8', '#08B672', '#BDBA14', '#1FAFE8', '#4828AB', '#890B5D', '#DF641A', '#BEB013', '#2CB721', '#3A0CCD', '#008006', '#A1E896', '#141494', '#793199', '#E7E710', '#E85407', '#4517D1', '#65B799', '#FF5937', '#413BBA', '#20837D', '#FFB500', '#2D9314', '#94C921', '#0D40DE', '#8ED11E', '#FFCA0E', '#6BFF00', '#31C4A9', '#6E04B6', '#098264', '#008040', '#047B8B', '#067E63', '#5EB604', '#003DA2', '#319471', '#1BB026', '#09950B', '#C64184', '#ABB012', '#FFA427', '#CD43A6', '#6B4221', '#799516', '#2E0CB5', '#CECE28', '#FFE99B', '#13A715', '#D6BF8F', '#ECE8B1', '#FC6D75', '#03644B', '#E1A307', '#8EDBB8', '#ED580B', '#596666', '#0D0DDC', '#CD2D7E', '#FF5E17', '#801AB3', '#3D1F7A', '#E1D6B6', '#007EDC', '#AB2A5C', '#DA3781', '#17774F', '#D1D1D1', '#C4354D', '#D9C100', '#118991', '#9090BA', '#086312', '#71DA0C', '#00967A', '#0943F0', '#1BA974', '#D74B31', '#6A3BE0', '#FFD624', '#014BD0', '#801A00', '#E900D2', '#BE7118', '#941A88', '#00A39A', '#CEB121', '#BEE600', '#788C87', '#AD5438', '#F1E61C', '#A5B533'], metric='kill', normalized=False, smooth=True, smoothness=0.75, gridSize=500, baseline='sym')

SplatStats.statInkConstants module

SplatStats.statInkPlots module

barChartLobby(lbyFreq, figAx=None, scaler=('k', 1000.0), fontSizes=(8.5, 20), colors=['#2E0CB5', '#B400FF', '#6BFF00', '#525CF5', '#FDFF00', '#D01D79', '#E2E2E2'])
plotDominanceMatrix(sNames, sMatrix, sSort, mMatrix, figAx=None, vRange=(-1, 1), scaler=('k', 1000.0), cmap=<matplotlib.colors.LinearSegmentedColormap object>)
plotGaussianLobby(lbyDaily, lbyGaussDaily, figAx=None, ylim=(0, -1250), xticksDelta=30, gModesColors=['#DE0B64FF', '#FDFF00FF', '#0D37C3FF', '#71DA0CFF', '#531BBAFF'])
plotPolarFrequencies(wpnFreq, wpnRank, figAx=None, topRank=None, yRange=(0, 300000.0), rRange=(0, 180), ticksStep=4, fontSizes=(1, 3.75), direction=1, colors=['#83C91A', '#E1772B', '#AD7710', '#4D24A3', '#CF3350', '#FABF50', '#25B100', '#9A6FCC', '#E75A2D', '#2BDCED', '#EFF66E', '#308766', '#9208B2', '#009A6E', '#C42138', '#4E4EDD', '#60AB43', '#26229F', '#4E85C1', '#E24FE5', '#2922B5', '#6A1EC1', '#D60E6E', '#FF7D9A', '#0A7A5E', '#995935', '#E4E567', '#E3D704', '#C54D4F', '#FBD704', '#7D5C26', '#058F00', '#00A0B0', '#6B0A29', '#307087', '#B1DBD1', '#D611E0', '#9025C6', '#009A82', '#6325CD', '#525CF5', '#EC0B68', '#2FCF46', '#E6B30D', '#81DE17', '#005BFF', '#891A7F', '#ED2403', '#4A2126', '#E114C3', '#FFB600', '#E36D60', '#4B22C8', '#5DAB21', '#7B0393', '#98039B', '#ED7004', '#8EBB1A', '#0935A6', '#E9DD14', '#A6AD8C', '#91B00B', '#BF3E24', '#488DB5', '#B62EA7', '#0D6E74', '#DE0B64', '#00993A', '#F5498B', '#00CA0E', '#A577FF', '#0D195E', '#CF581B', '#0A6E17', '#A67308', '#32A200', '#BC326D', '#88214D', '#3A28C4', '#695240', '#EDD926', '#4545AB', '#5451EC', '#FA8E00', '#9361EA', '#C920B7', '#14BBE7', '#F86300', '#CE334F', '#E38D24', '#6BD52C', '#4F55ED', '#1A1AAE', '#E59D0D', '#2ac29e', '#E29440', '#0DA182', '#531BBA', '#FAB01D', '#B1008D', '#FFE500', '#BAD421', '#655A99', '#A34C3B', '#F3B000', '#A5267F', '#B400FF', '#79B726', '#D94C79', '#734024', '#425113', '#BF586B', '#0199B8', '#E70F21', '#A1482B', '#A714D4', '#00A2E8', '#4717A9', '#BECD41', '#6642D0', '#7EC27A', '#059E9C', '#FF8787', '#E8540A', '#4A14AA', '#DCE317', '#0EB6A7', '#D3DD1E', '#EE8711', '#571DB1', '#3BC335', '#228CFF', '#CE8003', '#42D0EA', '#990F2B', '#E869BF', '#B44AEF', '#1BC3D8', '#F9891B', '#C2238F', '#DEA801', '#50D525', '#6C0676', '#C6D314', '#C93457', '#1D07AC', '#D88602', '#DEC109', '#CFD1C7', '#2FB89A', '#409D3B', '#ED12E4', '#8CE47F', '#3D59DE', '#0D8B51', '#9030FF', '#7D26B5', '#DB7821', '#007AC9', '#0FBA9D', '#D6CD25', '#DCA41D', '#FA5A2A', '#1BBEAB', '#6735AF', '#DDA024', '#B986ED', '#1AB46A', '#FFCE0C', '#38C8D0', '#C03E3E', '#A18E3B', '#C70864', '#CB0856', '#41A782', '#EEAA05', '#7F7F99', '#AEF4F0', '#8BFF06', '#78D04F', '#43BA05', '#D4C2B5', '#DA4514', '#C75304', '#05E7CE', '#8C0C7F', '#6ABF0B', '#C12D74', '#DACD12', '#CA21A5', '#EFF2EB', '#523B40', '#E95F9A', '#FD636A', '#CC1F1F', '#8ACF47', '#bc6d75', '#BBC905', '#5C0A61', '#0CAE6E', '#B97E1A', '#461362', '#FB321E', '#D1ED73', '#B0C444', '#0118E3', '#EE8122', '#FFFF00', '#EBCD62', '#ED1D9A', '#FE6829', '#FF7F19', '#D4B873', '#A52B85', '#9736B2', '#cca770', '#C83D79', '#E64D73', '#118F32', '#FF6D40', '#DC1C1E', '#38377A', '#0037B8', '#B3A10D', '#435BF3', '#C21405', '#F75900', '#DDD112', '#AF16AC', '#098A71', '#2120CC', '#2E14D4', '#DD9016', '#DD0DD3', '#A8B700', '#BFD002', '#17CFDE', '#FF6C00', '#FF7536', '#D64703', '#C52ADB', '#EC7125', '#B4D933', '#03C1CD', '#0D37C3', '#6B87BF', '#ECC50A', '#6E068A', '#4B25C9', '#285EEA', '#82878F', '#373DBB', '#D645C8', '#35BA49', '#003B89', '#D84011', '#5F0FB4', '#C44B21', '#E2E2E2', '#B14A8D', '#E6E6E6', '#002AFF', '#C43A6E', '#048188', '#8A19F7', '#1021BE', '#3F2CD2', '#FFE80A', '#59BE9C', '#00B278', '#1B18D7', '#C0AE26', '#C95431', '#51C71B', '#03B362', '#28C05E', '#ED2635', '#6363D6', '#1384BA', '#14247F', '#F52E71', '#EEC70E', '#2DD9B6', '#D01D79', '#C1CC47', '#D0BE08', '#88AF45', '#4F9E00', '#17A80D', '#ED9408', '#03A65F', '#CACACA', '#8805CC', '#AB66B8', '#757A2B', '#4EE69F', '#830B9C', '#CD510A', '#FB5C03', '#BA0A07', '#FDFF00', '#695C3B', '#14B8A0', '#127A87', '#CF0466', '#E56F87', '#311AA8', '#08B672', '#BDBA14', '#1FAFE8', '#4828AB', '#890B5D', '#DF641A', '#BEB013', '#2CB721', '#3A0CCD', '#008006', '#A1E896', '#141494', '#793199', '#E7E710', '#E85407', '#4517D1', '#65B799', '#FF5937', '#413BBA', '#20837D', '#FFB500', '#2D9314', '#94C921', '#0D40DE', '#8ED11E', '#FFCA0E', '#6BFF00', '#31C4A9', '#6E04B6', '#098264', '#008040', '#047B8B', '#067E63', '#5EB604', '#003DA2', '#319471', '#1BB026', '#09950B', '#C64184', '#ABB012', '#FFA427', '#CD43A6', '#6B4221', '#799516', '#2E0CB5', '#CECE28', '#FFE99B', '#13A715', '#D6BF8F', '#ECE8B1', '#FC6D75', '#03644B', '#E1A307', '#8EDBB8', '#ED580B', '#596666', '#0D0DDC', '#CD2D7E', '#FF5E17', '#801AB3', '#3D1F7A', '#E1D6B6', '#007EDC', '#AB2A5C', '#DA3781', '#17774F', '#D1D1D1', '#C4354D', '#D9C100', '#118991', '#9090BA', '#086312', '#71DA0C', '#00967A', '#0943F0', '#1BA974', '#D74B31', '#6A3BE0', '#FFD624', '#014BD0', '#801A00', '#E900D2', '#BE7118', '#941A88', '#00A39A', '#CEB121', '#BEE600', '#788C87', '#AD5438', '#F1E61C', '#A5B533'])
plotStackedBar(data, series_labels, labels=None, figAx=None, category_labels=None, show_values=False, value_format='{}', y_label=None, colors=None, textColor='#000000', fontsize=12, xTickOffset=5)
plotWeaponStrip(weaponsHists, weaponName, wpnStats, figAx=None, weaponsSummary=None, styleDictionary={'assist': {'color': '#C12D74DD', 'range': (0, 10), 'scaler': <function <lambda>>}, 'death': {'color': '#801AB3DD', 'range': (0, 15), 'scaler': <function <lambda>>}, 'kill': {'color': '#1A1AAEDD', 'range': (0, 15), 'scaler': <function <lambda>>}, 'paint': {'color': '#35BA49DD', 'range': (0, 20), 'scaler': <function <lambda>>}, 'special': {'color': '#1FAFE8DD', 'range': (0, 10), 'scaler': <function <lambda>>}}, binSize=1)
plotWeaponsStrips(weaponsHists, weaponsList, stat, figAx=None, weaponsSummary=None, color='#1A1AAEDD', range=(0, 50), cScaler=<function <lambda>>, binSize=1)

SplatStats.statInkStats module

calculateDominanceMatrix(btls, wpnsNames=None, dtype=<class 'numpy.uint32'>)
calculateDominanceMatrixRatio(domMatrix, sorted=True)
countDailyLobbies(btls)
flatten(l)
getLobbyFrequencies(btls)
getModeFrequencies(btls)
getTeamsWeapons(btls)
getWeaponStatsHistograms(weaponDF, range, stats=['kill', 'death', 'assist', 'special', 'inked'], normalized=True, binSize=1)
getWeaponStatsMean(weaponDF, stats=['kill', 'death', 'assist', 'special', 'inked'], mFun=<function mean>)
getWeaponsDataframe(battlesResults, stats=['weapon', 'kill', 'assist', 'death', 'inked', 'special'])
getWeaponsFrequencies(btls)
getWeaponsSet(btls)
getWeaponsStatsHistograms(weaponsDF, weapons, range, stats=['kill', 'death', 'assist', 'special', 'inked'], normalized=True, binSize=1)
getWeaponsStatsSummary(weaponsDF, weapons, summaryFunction=<function mean>, stats=['kill', 'death', 'assist', 'special', 'inked'])
getWeaponsWLT(btls, wpnsNames=None)
normalizeDominanceMatrix(wNames, domMtx, sorted=True)
rankWeaponsFrequency(wpnFreq, wpnWLT)
smoothCountDailyLobbies(lbyDaily, gridSize=1000, sd=0.75)

SplatStats.stats module

aggregateStatsByPeriod(playerHistory, period='h')

Sums the stats over a given period of time.

Parameters:
  • playerHistory (dataframe) – Player history dataframe.

  • period (str, optional) – Time period over which the stats will be aggregated. Defaults to ‘h’.

Returns:

Dataframe of states where the rows are the beginning of the periods.

Return type:

dataframe

ammendStagesStatsByType(dfList, stagesList=['Inkblot Art Academy', 'Hagglefish Market', 'MakoMart', 'Eeltail Alley', 'Wahoo World', 'Undertow Spillway', 'Mahi-Mahi Resort', 'Hammerhead Bridge', 'Sturgeon Shipyard', 'Mincemeat Metalworks', "Museum d'Alfonsino", 'Scorch Gorge'], matchModes=('Turf War', 'Tower Control', 'Rainmaker', 'Splat Zones', 'Clam Blitz'))

Flattens the dictionary obtained from calcStageStatsByType into a single object adding a stages column.

Parameters:
  • dfList (list of dataframes) – Dataframes list as obtained by calcStageStatsByType.

  • stagesList (list, optional) – List of all stages to be used in the analysis. Defaults to [ ‘Inkblot Art Academy’, ‘Hagglefish Market’, ‘MakoMart’, ‘Eeltail Alley’, ‘Wahoo World’, ‘Undertow Spillway’, ‘Mahi-Mahi Resort’, ‘Hammerhead Bridge’, ‘Sturgeon Shipyard’, ‘Mincemeat Metalworks’, “Museum d’Alfonsino”, ‘Scorch Gorge’ ].

  • matchModes (tuple, optional) – Match types in order to be processed. Defaults to (‘Turf War’, ‘Tower Control’, ‘Rainmaker’, ‘Splat Zones’, ‘Clam Blitz’).

Returns:

Flattened dataframe.

Return type:

dataframe

calcBattleHistoryStats(bHist, kassistWeight=0.5)

Calculates the basic player stats for a battle history dataframe.

Parameters:

bHist (dataframe) – Battle history dataframe for a player.

Returns:

Stats (kills, paint, assists, deaths, specials) in normal, average, and per minute forms.

Return type:

dict

calcBinnedFrequencies(array, xMin, xMax, binSize=1, normalized=False)

Calculates the binned frequencies of numbers in the array in the ranges defined.

Parameters:
  • array (array) – Array from which all the frequencies will be calculated.

  • xMin (int) – Lowest possible value that will be counted.

  • xMax (int) – Highest possible value that will be counted.

  • binSize (int, optional) – Step size for the binning (from xMin to xMax in intervals of binSize). Defaults to 1.

  • normalized (bool, optional) – If true, the frequencies are divided by the total so that they sum to 1. Defaults to False.

Returns:

Frequencies of ocurrences in the defined ranges.

Return type:

array

calcStagesStats(bHist, sortBy='win ratio', ascending=False)

Given a battle history dataframe, this function calculates the stats broken down by stage and returns them as a dataframe (legacy wrapper for ‘calcStatsByKey’).

Parameters:
  • bHist (dataframe) – Battle history dataframe for a player.

  • key (str, optional) – Column name on the dataframe upon that will work as the grouping element for stats. Defaults to ‘stage’.

  • sortBy (str, optional) – Sorting key for the output dataframe (no sorting if False). Defaults to ‘win ratio’.

  • ascending (bool, optional) – Ascending or descending order for sorting. Defaults to False.

Returns:

Stats over stages (general, kpads, kpads avg, kpads per min)

Return type:

dataframe

calcStagesStatsByType(bHist)

Given a battle history dataframe, this function calculates the stats broken down by match type and stage; and returns them as a dictionary of dataframes.

Parameters:

bHist (dataframe) – Battle history dataframe for a player.

Returns:

Dictionary of dataframes where the key is the match type, and the dataframe is calculated with ‘calcStagesStats’.

Return type:

dict

calcStatsByKey(bHist, key, sortBy='win ratio', ascending=False)

Given a battle history dataframe, this function calculates stats broken down by the supplied key (column).

Parameters:
  • bHist (dataframe) – Battle history dataframe for a player.

  • key (str, optional) – Column name on the dataframe upon that will work as the grouping element for stats. Defaults to ‘stage’.

  • sortBy (str, optional) – Sorting key for the output dataframe (no sorting if False). Defaults to ‘win ratio’.

  • ascending (bool, optional) – Ascending or descending order for sorting. Defaults to False.

Returns:

Stats over provided key (general, kpads, kpads avg, kpads per min)

Return type:

dataframe

frequencyInRange(array, xMin, xMax)

Calculates the number of entries of an array that fall within the defined range.

Parameters:
  • array (array) – Array from which the frequencies will be calculated.

  • xMin (float) – Lower bound of the range for the count (inclusive).

  • xMax (float) – Upper bound of the range for the count (non-inclusive).

Returns:

Frequency of occurrences that fall within the range.

Return type:

int

gaussianSmooth(y, gridSize=500, sd=1)

Performs a gaussian smoothing process upon the provided data.

Parameters:
  • y (np array) – Values of the signal to be smoothed.

  • gridSize (int, optional) – Number of samples in the x range. Defaults to 500.

  • sd (int, optional) – Standard deviation for the smoothing process. Defaults to 1.

Returns:

Smoothed values over the provided X range.

Return type:

list of np arrays

getTeamRanks(teamDF, cats=['kill', 'death', 'assist', 'special', 'paint'], inverted=['death'])

Returns a dataframe with the rankings of the players in the dataframe across categories (higher numbers being better unless in inverted list).

Parameters:
  • teamDF (dataframe) – Team battle dataframe.

  • cats (list, optional) – Categories over which the data will be totaled. Defaults to [‘kill’, ‘death’, ‘assist’, ‘special’, ‘paint’].

  • inverted (list, optional) – In the original rankings more is considered better, this list should contain the categories that should be inverted. Defaults to [‘death’].

Returns:

Team ranking dataframe over categories.

Return type:

dataframe

getTeamTotals(teamDF, cats=['kill', 'death', 'assist', 'special', 'paint'])

Get the team total over the selected categories.

Parameters:
  • teamDF (dataframe) – Team battle dataframe.

  • cats (list, optional) – Categories over which the data will be totaled. Defaults to [‘kill’, ‘death’, ‘assist’, ‘special’, ‘paint’].

Returns:

Team totals over the categories.

Return type:

dict

longestRun(myList, elem='W')

Returns the longest consecutive run of appearances of the same element.

Parameters:
  • myList (list) – List of elements.

  • elem (str, optional) – Element to check for run. Defaults to ‘W’.

Returns:

Longest run.

Return type:

int

statPerMinute(playerHistory, stat, summaryFun=None)
statSummaries(playerHistory, stat, summaryFuns=(<function sum>, <function mean>))
windowAverage(data, kernelSize=5, mode='valid')

Calculates the window average on the data array.

Parameters:
  • data (np array) – Data on which the window average will be calculated.

  • kernelSize (int, optional) – . Defaults to 5.

  • mode (str, optional) – Size of the output array as accepted by np.convolve {‘full’, ‘valid’, ‘same’}. Defaults to ‘valid’.

Returns:

Window-averaged data array.

Return type:

np array

Module contents