BCDA-APS / bluesky_training

Bluesky training, including instrument package
https://bcda-aps.github.io/bluesky_training/
Other
11 stars 0 forks source link

DOC xy plotting could be clearer #144

Closed prjemian closed 1 year ago

prjemian commented 1 year ago

The instructions at https://bcda-aps.github.io/bluesky_training/howto/_plot_x_y_databroker.html#4.-Get-data-for-the-x-and-y-axes could be improved:

def xyplot(dataset, xname, yname, title=None):
    """
    Plot the data from the primary stream (above).

    ::

        xyplot(cat[-1].primary.read(), sim.x.name, sim.y.name)
    """
    import matplotlib.pyplot as plt

    x = dataset[xname]
    y = dataset[yname]
    title = title or f"{yname} v. {xname}"

    plt.plot(x.values, y.values)
    plt.title(title)
    plt.xlabel(xname)
    plt.ylabel(yname)