# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: 'Python 3.9.6 64-bit (''wraeblast'': conda)'
#     name: python3
# ---

# %matplotlib widget

import asyncio
from wraeblast import insights

# +
from matplotlib import pyplot as plt
from matplotlib import rcParams
import pandas as pd
import seaborn as sns
from IPython.display import display, HTML

# sns.set(style="ticks", context="talk")
# plt.style.use("dark_background")
rcParams.update({'figure.autolayout': True})
# -

loop = asyncio.get_event_loop()
league = "Expedition"
ctx = await insights.initialize_filter_context(league=league)

display(HTML(ctx.currency.df[[
    "item_name", 
    "chaos_value", 
    "chaos_value_norm", 
    "quartile", 
    "quintile", 
    "decile", 
    "percentile",
]].to_html()))

ctx.currency.df.plot(x="chaos_value_norm", y=["quartile", "quintile", "decile", "percentile"]);

currency = ctx.currency.df[
    ctx.currency.df.item_name.str.contains("Orb") 
    | ctx.currency.df.item_name.str.contains("Shard")
    | ctx.currency.df.item_name.str.contains("Mirror")]
currency = currency[[
    "item_name", 
    "chaos_value_norm",
    "quartile",
    "quintile",
    "decile",
    "percentile",
]]
currency


# +
def label_point(x, y, val, ax):
    a = pd.concat({'x': x, 'y': y, 'val': val}, axis=1)
    for i, point in a.iterrows():
        ax.text(point['x']+.02, point['y'], str(point['val']), size="small")

sns.set_style("whitegrid")
ax = sns.lmplot(data=currency, x="percentile", y="chaos_value_norm", hue="item_name", height=10);
# label_point(currency.percentile, currency.chaos_value_norm, currency.item_name, plt.gca())
# -

fig, ax = plt.subplots()
fig.suptitle("Normalized chaos values of currency by quintile")
sns.boxenplot(x="quintile", y="chaos_value_norm", data=currency, showfliers=False);
sns.stripplot(x="quintile", y="chaos_value_norm", data=currency, color=".26");

StarcoderdataJupyterScriptsDedupFiltered