Skip to content

plt.plot fails if given x and y kwargs #4059

Closed
@Garrett-R

Description

@Garrett-R

When I execute the following command:

python3 -c "import matplotlib.pyplot as plt; plt.plot(x=[0,1], y=[0,1]); plt.show()"

it outputs:

Empty_Plot


Edit: I see my error. I was not supposed to provide the data as keyword arguments. Indeed plt.plot([0,1], [0,1]) works fine.

I don't know anything about how matplotlib works, but perhaps plot should be able to handle this (similar to how pandas.DataFrame.plot can handle this):

import pandas as pd
df = pd.DataFrame([[0,0],[1,1]], columns=['A', 'B'])
df.plot('A', 'B')
df.plot(x='A', y='B')

If that's not desirable, then perhaps it could at least throw an error or give a warning that an unexpected keyword argument was given...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions