I am trying to plot a bar chart. However, the number on x-axis shows 0.0, 0.5, 1.0 and y-axis shows the np datetime.
I want the x-axis shows the exactly number and y-axis shows the date with dd-mm-yy only. May I know how can I solve it?
from pandas_datareader import data import datetime dateToday = datetime.datetime.today().strftime("%Y-%m-%d") # Only get the adjusted close. tickers = data.DataReader(['NFLX'], start='', end=dateToday, data_source='yahoo')['Volume'][-50:] import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns # Change the style of the figure to the "dark" theme sns.set_style("darkgrid") plt.figure(figsize=(12,6)) plt.title('Returns') sns.barplot(y=tickers.index,x=tickers['NFLX'],color='b',edgecolor='w',label='7d_returns',orient = 'h') plt.xticks(rotation = 0)
https://stackoverflow.com/questions/67237923/reformat-seaborn-axis-tick-labels-datetime-and-scientific-notation April 24, 2021 at 07:28AM
没有评论:
发表评论