Issue
x-axis automatically increment by 2, how do I increase it by 1 only?
price_Graph = sns.lineplot(x='TIMESTAMP', y='ASK', data=price_graph_df)
price_Graph.tick_params(axis='x', rotation=45)
price_Graph.set_xlim([pd.to_datetime(start_time, format = '%Y-%m-%d %H:%M:%S'), pd.to_datetime(end_time, format = '%Y-%m-%d %H:%M:%S')])
Sample:
{'TIMESTAMP': {0: Timestamp('2022-06-23 00:27:10+0000', tz='UTC'), 1: Timestamp('2022-06-23 11:06:19+0000', tz='UTC'), 2: Timestamp('2022-06-23 13:32:34+0000', tz='UTC'), 3: Timestamp('2022-06-23 12:55:07+0000', tz='UTC'), 4: Timestamp('2022-06-22 17:52:51+0000', tz='UTC'), 5: Timestamp('2022-06-22 10:05:45+0000', tz='UTC'), 6: Timestamp('2022-06-21 22:19:25+0000', tz='UTC'), 7: Timestamp('2022-06-23 16:50:05+0000', tz='UTC'), 8: Timestamp('2022-06-22 14:05:51+0000', tz='UTC'), 9: Timestamp('2022-06-23 07:10:18+0000', tz='UTC')}, 'ASK': {0: 92.6186, 1: 92.5252, 2: 92.876, 3: 92.7503, 4: 92.5049, 5: 92.3395, 6: 92.092, 7: 92.7962, 8: 92.5277, 9: 92.286}}
Solution
You can use HourLocator
to control the display on xaxis:
import matplotlib.dates as mdates
price_Graph = sns.lineplot(x='TIMESTAMP', y='ASK', data=price_graph_df)
price_Graph.tick_params(axis='x', rotation=45)
price_Graph.xaxis.set_major_locator(mdates.HourLocator(interval=1))
Answered By - Corralien
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.