![]() ![]() ![]() Import pandas_datareader as web # conda or pip install this not part of pandas For an array or list, refer to Converting numpy array of strings to datetime or Convert datetime list into date python, respectively. If using pandas, then use pd.to_datetime. The date column on the axis must be a datetime dtype.Given date = df.index, xmin=date, xmax=date + pd.Timedelta(days=3), where the index is a DatetimeIndex.xmin and xmax will accept a date like '' or datetime(2020, 9, 10).# extract the region from the title for use in selecting the index of fptĪx.hlines(y=, xmin=xmin, xmax=xmax, colors=, ls='-', lw=2, alpha=0.5) G = sns.relplot(data=fmri, x="timepoint", y="signal", col="region",hue="event", style="event", kind="line") # used to get the max values (y) for each event in each regionįpt = fmri.pivot_table(index=, columns='event', values='signal', aggfunc='mean') G.hlines(y=, xmin=xmin, xmax=xmax, colors=, ls='-', lw=2) G = sns.lineplot(data=fmri, x="timepoint", y="signal", hue="event") Seaborn axis-level plot import seaborn as snsĬ_max, s_max = fmri.pivot_table(index='timepoint', columns='event', values='signal', aggfunc='mean').max() Plt.hlines(y=, xmin=, xmax=, colors='purple', linestyles='-', lw=2, label='Multiple Lines') See this answer for vertical lines with.& can only plot a single location (e.g.If you're a plotting a figure with something like fig, ax = plt.subplots(), then replace plt.hlines or plt.axhline with ax.hlines or ax.axhline, respectively.y can be passed as multiple locations: y=.y can be passed as a single location: y=40.Plot multiple horizontal lines by passing a list to the y parameter.These methods are applicable to plots generated with seaborn and, which both use matplotlib. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |