Skip to content

[Feature Request] Plot T/F mask directly as ones and zeros #30292

Closed
@halolord01

Description

@halolord01

Code Sample, a copy-pastable example if possible

x = pd.Series([False,True,True,False])
x.plot()
# Error thrown!
# Running version 0.24.2

Problem description

It would be nice to be able to directly use .plot() on true / false masks. Matplotlib currently supports plotting true / false masks with the below code (using the same x variable as above):

plt.plot(x.index, x.values)

Expected Output

Would be great if the code in the "code sample" section outputted the same as the matplotlib equivalent of ( plt.plot(x.index, x.values) ), where True translates to 1, and False to zero, and plots against the index values of the series.

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 2.7.13.final.0
python-bits: 64
OS: Windows
OS-release: 10
pandas: 0.24.2
numpy: 1.16.4
scipy: 1.2.2
pandas_gbq: None
pandas_datareader: None

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