Stream: python-questions

Topic: scatter plots


view this post on Zulip Daniel Marsh (Aug 03 2021 at 23:17):

Probably a dumb question, but has anyone been able to easily control lines connecting points without having to restructure their plotting call.
e.g.,
ds['T'].plot() plots a line
ds['T'].plot(marker='o') plots markers connected by a line
but to get just markers you must use the scatter method
ds.plot.scatter('time', 'T')
there's no linestyle = 'none' option to plot.

view this post on Zulip Deepak Cherian (Aug 03 2021 at 23:22):

linestyle='none' should work.

(
    xr.tutorial.load_dataset("air_temperature")
    .air.isel(time=1, lat=0)
    .plot(marker="o", linestyle="none")
)

image.png

view this post on Zulip Daniel Marsh (Aug 03 2021 at 23:28):

See, I said it was a dumb question. I swear I couldn't get it to work before :rolling_eyes: Thanks!


Last updated: Jan 30 2022 at 12:01 UTC