8000 the limits of axes are inexact with mplot3d · Issue #18052 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
the limits of axes are inexact with mplot3d #18052
Closed
@ultimatile

Description

@ultimatile

I take an example from
https://stackoverflow.com/questions/23951230/python-axis-limit-in-matplotlib

In mplot3d, when you set, for example, set_xlim(0, 0.8), the outcome has an extra like set_xlim(0 - eps, 0.8 + eps), where eps is related to deltas.

deltas = (maxs - mins) / 12.

To show the exact lims, you have to change deltas to, for example, 0 * (maxs - mins) / 12.

You need something to set exact lims without touching the inside of matplotlib.

Code for reproduction

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.gca(projection = '3d')
ax.set_xlim(0,0.8)
plt.show()

Actual outcome
fig

Matplotlib version

  • Operating system:macOS 10.14.6
  • Matplotlib version: 3.1.1
  • Python version: 3.7.4

The problem was discussed many times in STACK OVERFLOW:
https://stackoverflow.com/questions/23951230/python-axis-limit-in-matplotlib
https://stackoverflow.com/questions/46380464/matplotlib-3d-axis-bounds-always-too-large-doesnt-set-lims-correctly
https://stackoverflow.com/questions/16488182/removing-axes-margins-in-3d-plot

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0