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
4
votes
1 answer

matplotlib 0.99 Mplot3d AttributeError: 'list' object has no attribute 'ndim'

I'm trying to plot a 3d graph like this one here: Using this code and receiving an error that says: line 1621, in plot_surface if Z.ndim != 2: AttributeError: 'list' object has no attribute 'ndim' import cobra import os from os.path import…
Stephen Chapman
  • 61
  • 1
  • 2
  • 5
4
votes
2 answers

How to make 3D plots in Python?

This is the MATLAB version of the 3D plotting code: EDIT: This is the current code: plt.figure(2) fig_b = Axes3D(fig2) xx2 = np.arange(0, L+h_grid*L, h_grid*L) yy2 = np.arange(-b, b+h_grid*b, h_grid*b) X, Y =…
user569474
  • 451
  • 3
  • 7
  • 14
4
votes
0 answers

Can't set axis scale to logarithmic in 3D plot in matplotlib

I would like to 3D plot the surface of a data 2d array with dimension [50,250]. Two of the axes (x, z) should be in logarithmic scale. Here's a MWE: import numpy as np xx = np.asanyarray([np.ones([250])*(m+1) for m in range(50)]) yy =…
andrea
  • 525
  • 1
  • 5
  • 21
4
votes
1 answer

Multiple independent lines in the same 3D Axes

I would like to draw multiple independent lines in a 3D plot in Python. It looks like: . I am new at Python. Would you help me?
huangteng1220
  • 41
  • 1
  • 2
4
votes
2 answers

How can I produce a 3D space-time trajectory plot?

Let's say I have 3 dataframes with info on latitudes, longitudes and timetag of objects, such that every column represents a different object, and every row represents a point in time. latitudes = object 1 2 3 …
Helk
  • 121
  • 10
4
votes
1 answer

How to use plot_trisurf

After updating matplotlib version from 1.3.1 to 2.0.2, when I want to use plot_trisurf to generate a TIN by 3d-points, I got an incomprehensible results. My test code is following: import sys import matplotlib import matplotlib.pyplot as plt from…
zxgao
  • 61
  • 1
  • 1
  • 4
4
votes
1 answer

Colorbar for matplotlib plot_surface using facecolors

I'm trying to plot in 3D colouring the surface with predefined colours using facecolors. The problem here is that cm.ScalarMappable normalizes surface V of colours while plt.cm.jet don't normalizes, so there is a mismatch of colours and colorbar.…
MLguy
  • 1,776
  • 3
  • 15
  • 28
4
votes
1 answer

Python 3d Pyramid

I'm new to 3d plotting. I just want to build a pyramid out of 5 Points and cut a plane through it. My problem is I don't know how to fill the sides. points = np.array([[-1, -1, -1], [1, -1, -1 ], [1, 1, -1], …
J.To
  • 251
  • 2
  • 4
  • 10
4
votes
1 answer

change view, plot3D, Julia language (similar to matplotlib)

I'm trying to change the perspective of a 3D scatter plot. (Julia Language) This code, for example, changes the perspective, but the points are plotted individually with each change, rather than together. for i=1:10 X=i; Y=i+2; Z = i+3 fig =…
haxtar
  • 1,962
  • 3
  • 20
  • 44
4
votes
1 answer

How to create a 3d surface plot

I have referred to matplotlib.org and a lot of threads but I can't plot a 3d surface. I am able to plot a 3d scatter but as soon as I try to plot a 3d surface it breaks for a lot of different errors. I fix errors but I get new ones. After fighting…
HarleyH
  • 59
  • 1
  • 6
4
votes
1 answer

Move 3D plot z-axis label right (or left)

In the plot below, how does one manipulate the z-axis label in such a way as to move it to the right? Here is the code I'm using to create the plot: fig = plt.figure() ax = fig.gca(projection='3d') ax.auto_scale_xyz([0, 100], [0, 30], [0, 1]) Z =…
user2256085
  • 483
  • 4
  • 15
4
votes
1 answer

Plotting using PolyCollection in matplotlib

I am trying to plot a 3 dimensional plot in matplotlib. I have to plot Frequency vs Amplitude Distribution for four (or multiple) Radii in a single 3D plot. I was looking at PolyCollection command available in matplotlib.collections and I also went…
Karthik Venkatesh
  • 329
  • 2
  • 3
  • 8
4
votes
1 answer

How do you keep the axes constant while adding new data?

I'm using matplotlib to display data that is constantly being updated (changes roughly 10 times per second). I'm using a 3D scatter plot, and I would like the axes to be fixed to a specific range, since the location of the data with respect to the…
Brent
  • 719
  • 2
  • 9
  • 18
4
votes
3 answers

Drawing a rectangle or bar between two points in a 3D scatter plot in Python and matplotlib

I have a 3D scatter plot which, on one of its planes, plots 2 points for each date. I've asked about how to draw a LINE between every pair of points, and received an answer for which I'm thankful. What I want now is to draw a BAR or a RECTANGLE to…
Zambi
  • 363
  • 1
  • 3
  • 9
3
votes
1 answer

Python matplotlib : plot3D with a color for 4D

I am trying to make a 3D plot from x, y, z points list, and I want to plot color depending on the values of a fourth variable rho. Currently I have ; fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax.plot3D(cell_x, cell_y, cell_z,…
Vincent
  • 57,703
  • 61
  • 205
  • 388