fusion-flap / flap

Fusion Library of Analysis Programs
MIT License
11 stars 5 forks source link

Lines for plot.py simple plots: #66

Closed thelampire closed 4 years ago

thelampire commented 4 years ago

For plot.py simple plots:

It would be useful if it was possible to plot vertical lines on the plots. It could be an input in plot.py options as such:

options['Vertical lines']=[[x1,'blue'], [x2,'red']] etc.

Vertical lines can be drawn with the following code:

import matplotlib.lines as mlines

def vertical_line(x, color=None):

    ax = plt.gca()
    xmin, xmax = ax.get_xbound()

    xmin = xmax = x
    ymin, ymax = ax.get_ybound()

    l = mlines.Line2D([xmin,xmax], [ymin,ymax], color=color)
    ax.add_line(l)
    return l

This is mediocre, but works for a single plot. It could be modified to work for the plot_IDs, but I do not understand that part of the flap plot yet.

Originally posted by @thelampire in https://github.com/fusion-flap/flap/issues/40#issuecomment-541246372

thelampire commented 4 years ago

I just opened this to be able to delete it from the enhancement proposals and have a reference to it in the future. The feature is implemented in the newest thelampire-patch-3 push.