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.

Sign up to request clarification or add additional context in comments.

Comments

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!!!!

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.