0

How can I extend y-axis in the way that line in the top don't finish sharply with the end of graph. In this case would be fine to extend y-axis to 8 or even 9, note that I can't set limit to 8 because speed value will be always different. It's only about visual effect.

Second question, also estetic, graph start with double 0, how can I delete one of them but still keep graph in same way

enter image description here

2 Answers2

1

Without seeing your code it is difficult to understand what you have already done and how your data is structured to create the graph, is it a pandas df? it is a list of values? Also what librarys are you using. Assuming you are using matplotlib this has already been answered here How to set the y-axis limit.

Get current axis via plt.gca(), and then set its limits:

ax = plt.gca()
ax.set_xlim([xmin, xmax])
ax.set_ylim([ymin, ymax])

You could look at doing

ymax = int(round(max(list of y values)+2,0))

This would give you a ceiling of plus 2 and round it to a whole number.

The second question is just usual, from my experience, however looking at your graph you could use the above code and set the limit to be higher/lower for the x&y axis.

0

I fixed first problem with ymax = round(max(y))+1 but not the one with zeros, when I'm trying to use same pattern for example ax.set_xlim([1,xmax]) it's just moving my graph, I would like to keep it unchanged just make one 0 disappear, but it's not so big of a deal