1

I've created a figure with this

  fig8 = plt.figure()
  ax8 = fig8.gca(projection = '3d')
  ax8.set_xlim(0,0.8)

It gives me this

enter image description here

My problem is I really need the limit of axis x to be exactly 0.8. It seems that matplotlib always make the axis a little bit longer than the limits that we've set. Any idea?

1

2 Answers 2

2

It seems to be hard-coded: https://github.com/matplotlib/matplotlib/blob/master/lib/mpl_toolkits/mplot3d/axis3d.py#L178

If you replace this line by:

deltas = 0*(maxs - mins) / 12.

you get the desired output but labels are now weirdly positioned.

0
0

Thanks @Nicolas Rougier for the suggestion

to fix the positions of the labels, instead of changing that line. I kept it and change the two lines below

deltas = (maxs - mins) / 12.
mins = mins
maxs = maxs

It works!!!!

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.