Linting scripts/daily_plot.py
This commit is contained in:
+28
-7
@@ -1,6 +1,5 @@
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
import os
|
import os
|
||||||
import configparser
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import seaborn as sns
|
import seaborn as sns
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
@@ -72,8 +71,6 @@ colors = plt.cm.Greens(norm(confmax))
|
|||||||
plot = sns.countplot(y='Com_Name', data=df_plt_top10_today, palette=colors, order=freq_order, ax=axs[0])
|
plot = sns.countplot(y='Com_Name', data=df_plt_top10_today, palette=colors, order=freq_order, ax=axs[0])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Try plot grid lines between bars - problem at the moment plots grid lines on bars - want between bars
|
# Try plot grid lines between bars - problem at the moment plots grid lines on bars - want between bars
|
||||||
z = plot.get_ymajorticklabels()
|
z = plot.get_ymajorticklabels()
|
||||||
plot.set_yticklabels(['\n'.join(textwrap.wrap(ticklabel.get_text(), 15)) for ticklabel in plot.get_yticklabels()], fontsize=10)
|
plot.set_yticklabels(['\n'.join(textwrap.wrap(ticklabel.get_text(), 15)) for ticklabel in plot.get_yticklabels()], fontsize=10)
|
||||||
@@ -94,7 +91,20 @@ heat_frame = pd.DataFrame(data=0, index=heat.index, columns = hours_in_day)
|
|||||||
heat = (heat + heat_frame).fillna(0)
|
heat = (heat + heat_frame).fillna(0)
|
||||||
|
|
||||||
# Generatie heatmap plot
|
# Generatie heatmap plot
|
||||||
plot = sns.heatmap(heat, norm=LogNorm(), annot=True, annot_kws={"fontsize":7}, fmt="g", cmap = pal , square = False, cbar=False, linewidths = 0.5, linecolor = "Grey", ax=axs[1], yticklabels = False)
|
plot = sns.heatmap(
|
||||||
|
heat,
|
||||||
|
norm=LogNorm(),
|
||||||
|
annot=True,
|
||||||
|
annot_kws={
|
||||||
|
"fontsize": 7},
|
||||||
|
fmt="g",
|
||||||
|
cmap=pal,
|
||||||
|
square=False,
|
||||||
|
cbar=False,
|
||||||
|
linewidths=0.5,
|
||||||
|
linecolor="Grey",
|
||||||
|
ax=axs[1],
|
||||||
|
yticklabels=False)
|
||||||
plot.set_xticklabels(plot.get_xticklabels(), rotation=0, size=7)
|
plot.set_xticklabels(plot.get_xticklabels(), rotation=0, size=7)
|
||||||
|
|
||||||
# Set heatmap border
|
# Set heatmap border
|
||||||
@@ -142,8 +152,6 @@ colors = plt.cm.Reds(norm(confmax))
|
|||||||
plot = sns.countplot(y='Com_Name', data=df_plt_Bot10_today, palette=colors, order=freq_order, ax=axs[0])
|
plot = sns.countplot(y='Com_Name', data=df_plt_Bot10_today, palette=colors, order=freq_order, ax=axs[0])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Try plot grid lines between bars - problem at the moment plots grid lines on bars - want between bars
|
# Try plot grid lines between bars - problem at the moment plots grid lines on bars - want between bars
|
||||||
z = plot.get_ymajorticklabels()
|
z = plot.get_ymajorticklabels()
|
||||||
plot.set_yticklabels(['\n'.join(textwrap.wrap(ticklabel.get_text(), 15)) for ticklabel in plot.get_yticklabels()], fontsize=10)
|
plot.set_yticklabels(['\n'.join(textwrap.wrap(ticklabel.get_text(), 15)) for ticklabel in plot.get_yticklabels()], fontsize=10)
|
||||||
@@ -163,7 +171,20 @@ heat_frame = pd.DataFrame(data=0, index=heat.index, columns = hours_in_day)
|
|||||||
heat = (heat + heat_frame).fillna(0)
|
heat = (heat + heat_frame).fillna(0)
|
||||||
|
|
||||||
# Generatie heatmap plot
|
# Generatie heatmap plot
|
||||||
plot = sns.heatmap(heat, norm=LogNorm(), annot=True, fmt="g", annot_kws={"fontsize":7}, cmap = pal , square = False, cbar=False, linewidths = 0.5, linecolor = "Grey", ax=axs[1], yticklabels = False)
|
plot = sns.heatmap(
|
||||||
|
heat,
|
||||||
|
norm=LogNorm(),
|
||||||
|
annot=True,
|
||||||
|
fmt="g",
|
||||||
|
annot_kws={
|
||||||
|
"fontsize": 7},
|
||||||
|
cmap=pal,
|
||||||
|
square=False,
|
||||||
|
cbar=False,
|
||||||
|
linewidths=0.5,
|
||||||
|
linecolor="Grey",
|
||||||
|
ax=axs[1],
|
||||||
|
yticklabels=False)
|
||||||
plot.set_xticklabels(plot.get_xticklabels(), rotation=0, size=7)
|
plot.set_xticklabels(plot.get_xticklabels(), rotation=0, size=7)
|
||||||
|
|
||||||
# Set heatmap border
|
# Set heatmap border
|
||||||
|
|||||||
Reference in New Issue
Block a user