Questions tagged [mplot3d]

a 3D plotting toolkit which ships with the matplotlib Python plotting library.

The mplot3d toolkit adds simple 3D plotting capabilities to the plotting library.

Resources

391 questions
3
votes
2 answers

Matplotlib 3d surface plot showing values outside of axis limits

In matplotlib 3d-plotting plot_surface even when the x, y and z axis limits are set to be >=0 the negative z-portion of the surface is still getting plotted. The same does not happen for 2d plots- if out of 20 data points provided as input for…
Anirban Chakraborty
  • 539
  • 1
  • 5
  • 15
3
votes
2 answers

Set axis limits on a 3d plot

I want to set axis limits in matplotlib 3D plot to get rid of the value over 15,000. I used 'set_zlim', but happened some error on my results. how can I do? from mpl_toolkits.mplot3d import Axes3D fig = plt.figure(figsize=(10, 5)) ax = fig.gca(…
Andy_KIM
  • 35
  • 1
  • 4
3
votes
0 answers

How can I change the camera center position in mplot3d?

This is my first time using stackoverflow. mplot3d seems to automatically centre the camera around the centre of mass of everything that has been plotted on the axis such that everything is always in view. In my basic example I plot a sphere of…
Billy Vale
  • 31
  • 2
3
votes
1 answer

Given a set of triangle vertices and faces, separate objects and form separate meshes

Edit: I have written a more succinct version of this question here but I am keeping this post because it is a full explanation. Given a 3D numpy array, marching cubes can form a 3D object around some threshold. import numpy as np from skimage…
McM
  • 471
  • 5
  • 21
3
votes
1 answer

Plot Trimesh object like with Axes3D.plot_trisurf()

I have a Trimesh object and I can't figure out how to plot it. My goal is something like the Axes3D.plot_trisurf() function from mplot3d would produce (see below). The Trimesh object even has an attribute containing the faces, but I don't know where…
vanessaxenia
  • 145
  • 1
  • 9
3
votes
1 answer

Plot image on plane in Matplotlib mplot3d

I have a 3D scene created with Matplotlib and I would like to apply a chessboard like pattern on the bottom plane in the image below. Do you have any idea how to achieve this? Here is the code to create this image: import numpy as np import…
Alexis.Rolland
  • 5,724
  • 6
  • 50
  • 77
3
votes
0 answers

Skew/rotate/otherwise transform 3D text in Matplotlib

I have a graph in Matplotlib that looks like this: I would like to skew the text (by an x-shear of 10.3 and a y shear of 9.0) in order to make it appear to be parallel with the bars. Here is my code that I am using: _x = [0,1,2,3] _y = [1, 2] _xx,…
3
votes
1 answer

error while using np.meshgrid to plot a 3d-plot because of loops

I have a function which is of the form : def f(x, y): total = 0 u = np.zeros(10) for i in range(0,10): u[i] = x * i + y* i if u[i] < 10: print('do something') total = total + u[i] return…
chink
  • 1,505
  • 3
  • 28
  • 70
3
votes
0 answers

Matplotlib: Have 3d orthogonal subplot share axis with 2d plot

I intend to plot an axis-aligned view on 3d objects with projection="ortho" side by side with 2d (profile) data, but I just cannot figure out how to make the vertical axes match. In the following example I would like to have the second and the third…
Bastian
  • 901
  • 7
  • 23
3
votes
2 answers

Animating a 3D vector

I need to animate both the magnitude and the position of a vector arrow in a 3D figure with matplotlib. As far as I can tell, I cannot animate the position of the vectors with Axes3D.quiver and there is no matplotlib.pyplot.arrow for a 3D figure. Is…
3
votes
1 answer

3D surface plot of a mountain python

I'm trying to reproduce a 3d surface plot that represents the profile of a mountain. I understand that I have to create a csv file to read in the code, and I'm trying to get the coordinates from google earth. could someone suggest a way? is there a…
Steren
  • 127
  • 2
  • 10
3
votes
1 answer

How to set the origin for the mesh with mplot3d?

Following the example in scikit-image doc I generate a spherical surface mesh with marching cubes algorithm. I want to center the unit sphere shell at the origin defined by the x,y,z grid. However, I cannot do that, since I don't know how to put…
Armut
  • 969
  • 8
  • 22
3
votes
1 answer

How to plot a perfectly smooth sphere

I am trying to plot a perfectly smooth sphere in python using matplotlib. I have been using the following code: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np fig = plt.figure(1) ax =…
Athul TR
  • 33
  • 1
  • 1
  • 3
3
votes
1 answer

How to plot regression predicted data in 3-D contour plot?

I'm trying to plot the predicted mean data from Gaussian process regression into a 3-D contour. I've followed Plot 3D Contour from an Image using extent with Matplotlib and mplot3d example code: contour3d_demo3.py threads. Following is my…
santobedi
  • 866
  • 3
  • 17
  • 39
3
votes
0 answers

Plotting randomly stacked cubes in 3D- mplot3d?

I am exploring random stackings of cubes. I started with 2D and can generate random packings within a rectangle like this: Now I have the code to generalize the stacking to 3D, but I am struggling to generalize the visualization. An example data…
kevinkayaks
  • 2,636
  • 1
  • 14
  • 30