Open StephanHQ opened 2 months ago
You can fill in null data in the missing time intervals on the second dataframe, then you should be able to display them in the same axis.
Thank your for your lightning speed reply. I tried that before and i receive "Segmentation fault: 11". I uploaded the used df just in case. this function is used when the errors occurs: fplt.plot(df['pivot_point'], ax=ax, style='o-', color='#ff00ff') ofc using this function fplt.plot(df['pivot_point'].dropna(), ax=ax, style='o-', color='#ff00ff') doesnt lead to an error.
There is no timestamp on your data. Is this intended? The pivot_point
is all null, so .dropna()
is going to lead to an empty sequence.
my bad. the df has been indexed after timestamp. df.to_csv doesnt inherit timestamp indexing. I adjusted to normal indexing and inserted timestamp as a column (see dv.csv). dv.csv Im using this plot function now: fplt.plot(df['timestamp'],df['pivot_point'], ax=ax, style='o-', color='#ff00ff') However, it still leads to the error: "Segmentation fault: 11".
That sounds like I'm supplying Qt with some bad data, or possibly a bug in Qt. Any chance you could create a minimal example with only the plot call and only the data causing the error?
I can not currently recreate the error in a single file. I will take some more time to do that. However, going to my main question, how can we align both plots on timestamp x? I provided the csv and the py to show you.
import finplot as fplt import pandas as pd
data = pd.read_csv('data.csv', parse_dates=['timestamp']) data.set_index('timestamp', inplace=True) ax, ax2 = fplt.create_plot('Stock Price with Zigzag Indicator', rows=2)
fplt.candlestick_ochl(data[['open', 'close', 'high', 'low']], ax=ax) zigzag_points = data['pivot_point'].dropna() fplt.plot(zigzag_points.index, zigzag_points.values, ax=ax2, color='#0000ff', width=1.5)
fplt.show()
Replace .dropna()
with .interpolate()
?
Hello,
my question is, how can finplot plot two different df which both have different intervals. Also the second df has no real interval, but sporadic values. I managed to plot both, but both ax do not align. The second df is currently being plotted with equal x spacing between rows, although the timestamp significantly varies between each one.