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?

asked May 30, 2014 at 9:28
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.

answered May 30, 2014 at 10:39
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!!!!

answered May 30, 2014 at 14:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.