Can't see pyplot figures when on a detached screen
Pyplot figures were visible when on attached screen and I expected its behavior to not change. It did.
Code I'm using for the plots:
def plot(self, _):
def total_seconds(fecha):
return (fecha - time_limit).total_seconds()
df = self.df.copy()
df['fecha'] = df['fecha'].apply(to_datetime)
dias = int(input('Días de búsqueda (Ilimitado): ') or 0)
if dias > 0:
today = erep_time()
time_limit = today - timedelta(days=dias)
busqueda = df[df['fecha'] > time_limit]
else:
time_limit = df['fecha'].min()
busqueda = df
fecha = busqueda['fecha']
fecha_dif = busqueda['fecha'].apply(total_seconds)
ccp_g = busqueda['ccpG']
trend = np.poly1d(
np.polyfit(fecha_dif, ccp_g, 10)
)
plt.figure(figsize=FIGSIZE)
plt.scatter(fecha, ccp_g, color='k', marker='o')
plt.plot(fecha, trend(fecha_dif))
plt.xticks(rotation=90)
plt.ylabel('cc/G')
plt.title('Historial MM')
plt.show()
As Wayne pointed out, the output from matplotlib won't be handled by any channel, since it is a detached screen.