Für umfangreiche Plot-Skripts verwende ich matplotlibs rcParams, um einige Standard-Plot-Einstellungen für Pandas DataFrames zu konfigurieren.Pandas DataFrame Plot: Ständige Änderung der Standard-Farbpalette
Das funktioniert gut für Farben und Schriftgrößen, aber nicht für die Standard-colormap wie here
mein aktueller Ansatz hier:
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import cm
# global plotting options
plt.rcParams.update(plt.rcParamsDefault)
matplotlib.style.use('ggplot')
plt.rcParams['lines.linewidth'] = 2.5
plt.rcParams['axes.facecolor'] = 'silver'
plt.rcParams['xtick.color'] = 'k'
plt.rcParams['ytick.color'] = 'k'
plt.rcParams['text.color'] = 'k'
plt.rcParams['axes.labelcolor'] = 'k'
plt.rcParams.update({'font.size': 10})
plt.rcParams['image.cmap'] = 'Blues' # this doesn't show any effect
# dataframe with random data
df = pd.DataFrame(np.random.rand(10, 3))
# this shows the standard colormap
df.plot(kind='bar')
plt.show()
# this shows the right colormap
df.plot(kind='bar', cmap=cm.get_cmap('Blues'))
plt.show()
Die erste Handlung nicht die colormap über colormap (was es nicht verwendet sollte normalerweise tun):
es funktioniert nur, wenn ich es als Argument wie in dem zweiten Grundstück passieren:
Gibt es eine Möglichkeit, die Standard-Colormap für Pandas DataFrame Plots dauerhaft zu definieren?
Vielen Dank im Voraus!