I am able to create a figure using the default values assigned to weight and date (see image below), but I want to use a custom range for the weight.
So instead of using the min/max that is in the array I want the range to be 175-190 with an interval of .05.
I have tried a number of things, but usually what happens is 1 of two things...
1.) All the weight ranges get jammed into the upper left hand corner and displayed on top of each other
2.) Nothing is displayed on the y axis and the points are not plotted.
def displayplot(date, weight):
fig, ax = plt.subplots()
#Convert data types in more usuable types
dates = mdates.num2date(mdates.datestr2num(date))
x = np.array(dates)
y = np.array(weight).astype(np.float)
#set plot points and formatting
plt.plot(dates, weight, color='k', marker='o', label='January', linewidth=1,
markevery=1,markerfacecolor='blue')
#set limits
#ax.set_ylim(175,190)
# rotate and align the tick labels so they look better
fig.autofmt_xdate()
#Labels
ax.set_title('weight tracking - 2018')
plt.xlabel('Date')
plt.ylabel('Weight')
plt.legend()
#Show figure
plt.show(fig)
UPDATE 1:
def displayplot(date, weight):
fig, ax = plt.subplots()
#Convert data types in more usuable types
dates = mdates.num2date(mdates.datestr2num(date))
x = np.array(dates)
y = np.array(weight).astype(np.float)
rng = np.arange(175, 190.5, 0.5)
#set plot points and formatting
plt.plot(dates, weight, color='k', marker='o', label='January', linewidth=1,
markevery=1,markerfacecolor='blue')
#set limits
ax.set_yticks(rng)
# rotate and align the tick labels so they look better
fig.autofmt_xdate()
UPDATE 2: Version 2.1.2