I would like to write a function that passes different keyword arguments to different functions.
For example, I want to write a function that plots a histogram of my data by first creating axes via gca and then adding the histogram via hist. I would like the user to be able to pass additional keyword arguments to both gca and hist.
Something like this (syntax error in the defintion line) is what I'm looking for,
import matplotlib.pyplot as plt def plot_hist(data, **kwargs_hist, **kwargs_gca): ax = plt.gca(**kwargs_gca) fig = ax.hist(data, **kwargs_hist)[0] return fig
inspect.signature(plt.gca) -> <Signature (**kwargs)>histand which togcaplot_hist(DATA, dict(var1=1, var2=2), dict(var3=3, var4=4))and just remove the**in the definition line.