Questions tagged [matplotlib-3d]

For questions about 3d plotting with matplotlib. Also use the matplotlib tag.

Filter by
Sorted by
Tagged with
0 votes
0 answers
35 views

show() from matplotlib.pyplot is not working, how can I fix it?

I am trying to make a plot of an equation for a homework problem. I didn't write the code, just copied and pasted it. Shown below is the code. Does anyone know why the plot is not showing/how to fix ...
David Eckland II's user avatar
0 votes
1 answer
50 views

matplotlib 3D plot Z label cut off

When using matplotlib in jupyter notebook in VS code the Z-label of my 3D plot is cut off. I also used the example code from the official matplotlib documentation: import matplotlib.pyplot as plt ...
Tanne's user avatar
  • 61
0 votes
1 answer
39 views

How to create a 3D fill-between plot from an array

I have a 3D matrix from simulating four random variables during 6 hours 2000 times: # Display the shape of the matrix_outputs array print(matrix_outputs.shape) (2000, 86400, 4) the first term is the ...
K. Rincon's user avatar
-1 votes
0 answers
34 views

matplotlib.pyplot's set_zlim function returns a is undefined error [duplicate]

I'm trying to make a 3 element vector but my ax.set_zlim gives an undefined error. both ylim and xlim work perfectly fine so I'm not sure what's causing this. import numpy as np import matplotlib....
80XD's user avatar
  • 1
0 votes
0 answers
21 views

3d bar chart with dataframe

datadata.csv(Pandas DataFrame) Item Action Cost Item1 UK 100 Item2 USA 425 Item3 China 4587 Item4 USA 1234 Item5 China 1705 Item6 USA 870 Item7 China 1578 Item8 UK 3721 ...
Eric's user avatar
  • 1
0 votes
0 answers
67 views

How to create and dynamically update a 3D graph in C++ using matplotlibcpp or an alternative library?

I'm working on a project in C++ where I need to create a 3D graph to visualize and update real-time data. Initially, I attempted to use the matplotlibcpp library to draw the 3D graph, but I could not ...
Drad Wing's user avatar
2 votes
0 answers
55 views

3D plot with custom oblique projection

Orthogonal Projection I can use the proj_type='ortho' argument to get an isometric projection which will use the following projection matrix: def _ortho_transformation(zfront, zback): # note: w ...
gewa's user avatar
  • 31
0 votes
2 answers
62 views

How to plot a multidimensional array in a 3D plot

I have a multidimensional array (P x N x M) and I want to plot each N x M array in a 3D plot in such a way the P images are stacked along the z-axis. Do you know how to do this in Python?
Krystal's user avatar
  • 53
0 votes
1 answer
48 views

Color on surface of a 3D plot does not match the data

I want to plot the intensity over a sphere using plot_surface. The problem is, that it is not possible for me to normalize the color and to set the colobar correctly. All solutions I found in the ...
FilouUms's user avatar
1 vote
1 answer
31 views

Interactive Ploting with Matplotlib

When I adjust the position slider, for example pdfReader X,Y,Z, the point(pdfReader) in the plot won't be updated accordingly. Instead, I would see <Figure size 640x480 with 0 Axes> in my ...
user22773661's user avatar
0 votes
2 answers
122 views

Create 3D RGB Cube with possible rotation

I want to create/draw a 3D RGB Cube with possibility to rotate it. Something like this: I assumed that matplotlib would be a good option to create it, because it has built-in rotation function. I ...
rzymski's user avatar
-1 votes
1 answer
59 views

Infinite axline in 3D

I am trying to draw a scene like in the picture below using Python matplotlib, but I got stuck on drawing the infinite line (the black & dotted one in the picture). In 2D, this line can be drawn ...
Matej's user avatar
  • 790
0 votes
1 answer
41 views

Efficient video rendering in a 3D plot using animation and blitting

I'm currently doing a visualization task where I want to display a video within a 3D plot using matplotlib animation class. The purpose is to visualize feature tracking within the image. I have a ...
cody's user avatar
  • 1
0 votes
0 answers
20 views

Making bbox_inches="tight" work when using multiple 3d plots [duplicate]

I am trying to figure out how to make a tight box around my 3 plots to use it in a Latex document. I think it has to do with the 3d plots but I am not sure why this happens and what to do. #Load data ...
user296811's user avatar
0 votes
0 answers
45 views

Arrange matplotlib trisurf plots in subplots

I want to properly present results of a 2D-FEA using matplotlib. Plots, consisting of matplotlib trisurf plots, should be arranged in a gird of subplots and use the same colorbar. In some subplots, it ...
Daniel Stoffels's user avatar
2 votes
1 answer
67 views

How to get a surface plot to sync with the associated scatter points

I have a simple problem, wherein I have a training set of 80 points and a testing set of 20 points, which I am plotting against their corresponding values of bearing stress on the z axis, where the x ...
atharvanaik's user avatar
-1 votes
1 answer
60 views

Matplotlib 3D ValueError shape mismatch: objects cannot be broadcast to a single shape [duplicate]

import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap import numpy as np plt.style.use('dark_background') fig = plt.figure() ax = plt.axes(projection='3d') x = np.arange(1,11) y = ...
doughstone's user avatar
1 vote
2 answers
77 views

How to plot a 2D contour plot and a 3D surface plot side by side [duplicate]

I want these two plots to appear side by side I am using this code. fig, ax = plt.subplots(1, 1) cs = ax.contour(W, B, contour_cost, levels=50) ax.plot(model_1.w_hist, model_1.b_hist, color='magenta')...
Shashwat Gupta's user avatar
1 vote
2 answers
75 views

Remove white area around 3d plot [duplicate]

I created a surface plot of a gaussian using matplotlib: num_pts = 1000 σ = 1.5 x = np.linspace(-5, 5, num_pts) kernel1d = np.exp(-np.square(x) / (2 * σ * σ)) kernel2d = np.outer(kernel1d, kernel1d) ...
Mark's user avatar
  • 227
0 votes
2 answers
99 views

A complex function 3D plot

I have a complex function and want to plot a 3D graph using Matplotlib. Here is my code: import numpy as np from mpl_toolkits import mplot3d import matplotlib.pyplot as plt plt.style.use('seaborn-...
SAHAR GOHARSHENASAN's user avatar
1 vote
2 answers
98 views

Scale vertical (z) axis of 3D surface plot with plot_surface

How can I scale the Z-axis of a surface plot in matplotlib? Take the following example dataset and plot. import numpy as np import matplotlib.pyplot as plt x = np.linspace(-5, 5, 50) y = np.linspace(-...
Muon's user avatar
  • 1,346
1 vote
1 answer
79 views

3D plot with orthogonal style with diagonal axis

I would like to plot a plot in the style how we are used to plot them in school. Here is an example: Summary: 3D Plot the y-z plane is parallel to the screen (horizontal y, vertical z) the x axis is ...
Torben's user avatar
  • 345
3 votes
1 answer
158 views

How to Draw 3D Synthesis of Fourier Series

I saw this by using Tikz: https://tikz.net/fourier_series/ I want to create this 3D synthesis of Fourier Series: with Python 3D plot, there is matplotlib that is able to do that. My MWE / What I have ...
Freya the Goddess's user avatar
0 votes
0 answers
87 views

i want to plot a 3D surface from {x,y,z}-measured data set [duplicate]

I have a measured data set, where I measured z by varying x and y. It turns out, that z is a complicated function of x and y. I wanted to illustrate this correlation by plotting a surface in the same ...
physics_girl's user avatar
0 votes
1 answer
98 views

How does the x,y,z in `plot_surface` work

I am trying to figure out how to work with the input data for pyplot's plot_surface, as it is quite confusing. For a start the y-axis does not represent height as I am used to with geometrics. There ...
n247s's user avatar
  • 1,900
2 votes
1 answer
54 views

Problems using zdir in contour

I'm attempting to plot 2D slices from a 3D scatter plot using matplotlib, and am having problems with the zdir argument. Here is my code: import numpy as np import matplotlib.pyplot as plt from ...
HLL's user avatar
  • 405
0 votes
1 answer
57 views

Need help making a 3D surface plot a 4D surface plot with color as separate dimension

As the title says. I have tried so many different ways of doing this. I have 4 vectors of length 48. X: [ 25 25 25 25 25 25 50 50 50 50 50 50 75 75 75 75 75 75 100 100 100 100 100 ...
darrahts's user avatar
  • 383
1 vote
1 answer
78 views

How to Highlight a 3D Surface Plot slice

I was wondering how to highlight a 3D surface plot (done by SymPy Plotting Backends) with the help of matplotlib (because I find an example here: How do I highlight a slice on a matplotlib 3D surface ...
Freya the Goddess's user avatar
1 vote
1 answer
26 views

various 2d plots in a 3d frame in python

I want to plot 2d arrays that intersect in different planes in a 3d frame. I explain more I have 2 sets of velocity fields, components in (x,z) and (y,z) I would like to plot this in a 3d frame so i ...
jsp's user avatar
  • 175
-2 votes
1 answer
248 views

How to display a 3d image of .stl file [closed]

I've got a task of reading a stl image and need to display in my python environment. To do that, I have written the code below, but it is not working. When I tried with plt.imshow instead of plt.show()...
sripathi akhil's user avatar
1 vote
0 answers
56 views

How do I plot a vector? [duplicate]

I was trying to plot the following vector (B = [x, py, -(p+1)z]) from a paper that I'm working on. I have taken $p$ equal to 1 in order to replicate a graph from the paper. I wrote the following code ...
SMA47's user avatar
  • 11
0 votes
1 answer
85 views

How to plot crystal field d orbitals

As the question said , i was trying to plot the crystal field orbitals using python. i know the spherical harmonics calculation can be a bit complex so this is how i tried to do it : import numpy as ...
Aleja Carmento's user avatar
1 vote
1 answer
42 views

3D surface is messed up for some angles

I'm trying to plot a 3d graph with MatPlotLib. However, when I render it, it comes out really weird from some angles, but alright from others. The equation for this particular graph is: a(x,y)= -0.25(...
Aarush Abrol's user avatar
0 votes
1 answer
44 views

Matplotlib 3d plot_surface make edgecolors a function of z-value

How can we make edgecolors of a 3D surface plot a function of the z value? The following will make the edgecolors uniformly black: import numpy as np import matplotlib.pyplot as plt from matplotlib ...
feetwet's user avatar
  • 3,330
0 votes
1 answer
40 views

Non-matching colors for arrows in matplotlib 3D quiver plot

I'm having this weird problem with coloring the arrows on a matplotlib 3d quiver plot. The following minimum example correctly colors the base (from the scatter plot) the shaft and the ends of the ...
elfnor's user avatar
  • 469
2 votes
0 answers
65 views

Alternatives to Matplotlib's 3-D bar plot rendering issues

Following the example code provided in this answer, I was able to plot my data using Python Matplotlib's bar3d function to obtain a stacked bar plot. The figure is shown below (plot (a)). My data are ...
Carlos Herrera's user avatar
1 vote
1 answer
23 views

updating a line object via a function in 3D matplotlib

I would like to use a widget to plot the y-trace of a 3d function. I 2D everything goes well, the update function update the y values of the 2D line object. But in 3D , noting happens, I set the y ...
Frederic Vanden eynden's user avatar
0 votes
0 answers
38 views

scientific notation is not available in 3D axes

I use the ax.ticklabel_format(scilimits=[0,0]) to format. But it does not show the scientific notation in 3D axes, how to fix this problem? from matplotlib import cbook from matplotlib import cm from ...
JieJiang's user avatar
1 vote
1 answer
65 views

Matplotlib won't scatter on Axes3d

In Jupyter Notebook, it appears that when I call .scatter on a 3d axes object created in another cell, it doesn't scatter anything on it. Concretely, consider the following import statements, import ...
Plop's user avatar
  • 131
1 vote
1 answer
112 views

Colors on 3d plot of density matrix in matplotlib

I was reproducing results from a paper and I came across this plot with these colors. I want to reproduce this plot, but I could not figure out how. Here is my current code: fig = plt.figure() ax = ...
Dimitri's user avatar
  • 141
0 votes
1 answer
31 views

Extra lines present in 3d graph using matplotlib.pyplot

I'm trying to create a 3d graph plotting the planets' orbits, the code works fine for 2d projection, however 3d encounters some extra lines (brown line). I can't find the problem. import matplotlib....
DrVendetta's user avatar
0 votes
0 answers
39 views

Retrieve Matplotlib 3D surface projection to 2D view

I'm trying to do raycasting/triangulation to a 3D surface that has shadowing (i.e. parts that are occulted by a front face of the surface) and decide which surface comes closest for each image pixel. ...
Nebula's user avatar
  • 1
1 vote
1 answer
50 views

Plotting independent dataset in matplotlib 3D

I am interested in plotting independent dataset using matplotlib. For that purpose I incorporated the independent data coordinates in column of X, Y and Z. Consider the following python code- import ...
pkj's user avatar
  • 581
1 vote
1 answer
163 views

How to plot a matrix as a 3D imshow plot in matplotlib?

I am trying to plot a 4x4 array as a 3D plot in matplotlib, but I'm facing issues with the plot_surface function. The resulting graph only displays a surface with a 3x3 color grid, instead of a 4x4 ...
Robson Barreto's user avatar
1 vote
3 answers
114 views

matplotlib 3D scatter points not placed correctly

I'm trying to do some simple 3D plots but the scatter points appear not to align properly with the axes. This graph should have points aligned with x=1, y=1, z=1. This issue also occurs using the ...
craigB's user avatar
  • 382
4 votes
1 answer
120 views

Plot ellipsoid from matrix

I would like to plot an ellipsoid from a (3x3) matrix in matplotlib I have this code: import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import FancyArrowPatch from ...
tommy J's user avatar
  • 123
1 vote
0 answers
47 views

How to plot one surface over another

so for my research on rattleback, I've been plotting the ellipsoid(rattleback) and now I need additional vectors to be plotted. For example, the basic vectors. My code looks like this: " import ...
alygg's user avatar
  • 11
1 vote
0 answers
35 views

How can I make matplotlib's PolyCollection not interfere with the rendering of lines in a 3d plot?

PolyCollections seems to render in the foreground of the image, thus making the plot lines obscure. I need to fill the area under the curve in a Joyplot/ridgeline style plot. I have used the example ...
Lyxn's user avatar
  • 11
0 votes
0 answers
25 views

Setting an image as the background to a specific surface of my 3d plot [duplicate]

I have written the following code to plot lat,long and colorbar for temperature within certain height constraints using the following code - import os import pandas as pd import matplotlib.pyplot as ...
Keshav Aggarwal's user avatar
0 votes
0 answers
63 views

Add polar projection to 3D projection

I'm generating a 3D plot in Matplotlib using the following the code X, Y = np.meshgrid(np.linspace(0,1,x_data.shape[1]), np.linspace(0,1,x_data.shape[0])) fig = plt.figure() ax = fig.add_subplot(111, ...
Camille Woicekowski's user avatar

1
2 3 4 5
8