Home > Software design >  How to have automatic (or manual) scaling of xticks and yticks with pyplot?
How to have automatic (or manual) scaling of xticks and yticks with pyplot?

Time:03-18

Basically, I want my curve to be properly fitted onto the graph, as it obviously isn't the case currently. My xtick intervals are equal according to pyplot, but they clearly have values that do not match that. I want pyplot to understand that, and I'm not sure why it's forcing the curve to be 'boxed' in a square graph when it has ample space... What am I doing wrong? enter image description here

Here is my current code for creating the plot.

plt.figure(sheet_name, figsize=(12, 6))
plt.plot(beam_deformation, '-x')
plt.xticks([sensor[0] for sensor in sensors], [f"{sensor[0]} ({i 1})" for i, sensor in enumerate(sensors)], rotation=20)
plt.xlabel('sensors (position)')
plt.ylabel('Extent of Deformation (in)')

CodePudding user response:

When you provide only one array to

  • Related