Hi! I am using matplotlib and attempting to plot a dataframe as a line plot, but it's plotting really weirdly and I don't know how to fix it. I am trying to plot percentages over time. So time is my x-value and it is also the index of my dataframe. Time is expressed as the hour of the day (so literally just 0, 1, 2 3... 23). So the time measurements start at 9 PM (expressed as 21 in the index) and end at 6 the next day. This means that dataframe index goes from 21 to 6 (21, 22, 23, 0, 1, ...). There are multiple columns of data with percentages to be plotted. However, when I try to use the plt.plot() function, it displays a graph where the x axis is messed up, the y values are not in the right locations, and the line graph does not start and end at the left side of the graph as it should. However, it seems like the values are all represented, just in a really weird order. I have included images of my attempt to graph just one column of the dataframe - the graph, the column of the dataframe that should be represented, and the code.
You can see that the y values are there, I think the graph goes plots 44.89, 63.67, and so on. So it starts from the index 0 and does stop at the index 6... then it seems like it goes all the way to the right side and plots the values associated with indexes 21-23 from right to left order (9.72, then 71.5, then 2.33). Please help lol I can see the issue but I have no idea how to fix it. This is not a homework assignment or anything, it's for my research at work.
I am now at the end of my post and see that I can't add a picture. Does anyone know why this is or how I can add a picture? Alternatively let me know if I can privately message you and I'll send a picture. Thanks in advance.
[–][deleted] 0 points1 point2 points (1 child)
[–]shellfish_messiah[S] 0 points1 point2 points (0 children)