Can someone please help converting from mps to mph for my graph in matplotlib to show up in mph. I have this code:
def mps_to_mph(mps):
return 2.23694 * mps
and this is my graph:
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
fig = plt.figure(figsize=(10,5))
ax = plt.subplot(111)
plt.grid()
ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d %H:%M:%S'))
fig.autofmt_xdate()
# Pass the DataFrame 'sheet' to the plot function, and reference columns by name
plt.plot(sheet['Date Time'], sheet['Wind Speed (m/s)'], color='crimson')
plt.title('Wind Speed, Providence, RI', fontsize=12)
plt.xlabel('Date', fontsize=11)
plt.ylabel('Wind Speed (m/s)', fontsize=11)
plt.show()
But I am not sure how to or where to input the conversion code for the conversion to reflect in the graph
I input the code for the graph and the conversion above it, but it still gave me mps
New contributor
Sarah Bednarskivmhdn Xxbsr2q s is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.