Skip to content

args, kwargs in presentation #15

@Castau

Description

@Castau

Moved this to it's own separate isuue, instead of #12

See df.plot documentation, and notice how you can pass kwargs to matplotlib:
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.plot.html

So my guess is that it can be done like this: (pseudo)

def line_plot(df, title, save=None, **kwargs):
    # <...>
    df.plot(kind="line", title=title, kwargs=kwargs)
    # <...>

More on stackoverflow:
https://stackoverflow.com/questions/29504573/panda-dataframe-passing-in-parameters-for-plotting

Another stackoverflow example:

def valid_mpl(**kwargs):
    fig, ax = plt.subplots()

    fake_kwargs = ['my_fake_kwarg']
    plot_kwargs = {k: v for k, v in kwargs.items() if k not in fake_kwargs}

    ax.plot([1,2,3], [-3, -2, -1], **plot_kwargs)
    return fig, ax

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions