390 questions
2
votes
0
answers
84
views
How to bring 3D surfaces (triangular cuts, arrows, and text) to the front in a Matplotlib 3D plot?
I’m trying to reproduce the classic HSV color cone matplotlib in Python.
The idea is to draw a 3D cone in HSV space, with two triangular internal faces removed so we can see the inside of the cone.
...
1
vote
0
answers
100
views
How to view the scene from a given pose (4x4 transformation matrix) in Matplotlib
I'm trying to place the camera at a particular pose (given as a 4x4 transformation matrix) with the camera looking along the +ve z-axis in a Matplotlib 3D plot.
There are a few reference poses and a ...
5
votes
1
answer
114
views
FancyArrowPatch in 3D with curve (connectionstyle)
I'm trying to draw a curved FancyArrowPatch to annotate an angle in a 3D plot. How do I get the arrow to curve, stay in the plane of the two lines, and span the whole angle?
Based on https://...
0
votes
1
answer
97
views
How can I clip a 3D surface plot in matplotlib with a horizontal plane?
I am trying to create a 3D surface plot similar to the one shown below. view of 3D surface plot with defined z-bounds and added contour lines I have been able to have some luck with the basic pyplot ...
0
votes
1
answer
90
views
In matplotlib 3D line plots, how to ensure lines that are behind actually appear behind those drawn later?
I am plotting families of orbits in python using matplotlib and the add_subplots() routine:
fig=plt.figure()
ax=fig.add_subplots(projection='3d')
I then loop through my list of [X,Y,Z] series and ...
1
vote
1
answer
54
views
How do I color 3d triangular mesh using another scalar in matplotlib?
I have 3d vertex position data (x,y,z), scalar values at each vertex v, and vertex indices for each triangle tri.
If I were to draw the surface geometry itself, I could use plot_trisurf. If I were to ...
0
votes
0
answers
45
views
How to prevent 3D Matplotlib axis extension past set_[x/y/z]lim()? [duplicate]
I have an issue where the 3D axis limits set in Matplotlib are not respected in the plot, as shown by the minimal working example below. It can be seen that the extent of the plot goes beyond zero, ...
0
votes
0
answers
55
views
How do I clearly combine a 3D scatter plot and a surface plot together?
I think my problem is fairly simple. I've managed to find a way to plot my 3D surface against a set of discrete data points, but the issue now is that it is not clear to see whether the points lie ...
1
vote
0
answers
69
views
Python - XYZ plot coloring cluster region
Current this is my code for XY axis:
import numpy as np
import matplotlib.pyplot as plt
def plot_with_tricontourf_customized(dfs, figures_organizer, figsize_setting, list_points_mean, ...
0
votes
1
answer
75
views
How to display minor ticks without gridlines on the z axis?
I want to display the minor z ticks on an Axes3D plot without minor gridlines.
The starting figure looks like this:
The code is here:
import numpy as np
import matplotlib
from matplotlib.figure ...
2
votes
2
answers
94
views
How to turn off gridlines from 3d axes?
How do I turn off the major x axis grid from this axes?
This code below works on 2d plots to hide the major x gridlines. On 3d plots it doesn't seem to do anything.
I prefer to use general axes ...
0
votes
0
answers
28
views
How can I recreate these 3D vector plots of a rotating vector using matplotlib?
I want to recreate figures like this by using Matplotlib, how would I do so?
The second figure is hard to create using drawn lines; I'd like a helical spiral from the tip of the vector along z', so ...
0
votes
0
answers
53
views
3d Bar Plot in Matplotlib: "floating" bars and other issues
I have latitude and longitude coordinates in UTM with some data associated with them in a .csv file.
I want to make a 3d bar graph with the height's representing an area's associated data value. I ...
0
votes
0
answers
25
views
3D surface in matplotlib.pyplot does not correspond to data
I am trying to plot a simple 3D surface (just for testing). It appears to me that the surface does not correspond with the data matrix (defined as the sum of two input vectors using the Numpy add....
0
votes
1
answer
57
views
Extend a 3d plot to the edge of a figure with matplotlib
The following code results in a figure saved with large white spaces around it, while there is enough space to stretch the axes.
import matplotlib.pyplot as plt
import numpy as np
X = np.arange(-5, 5,...
1
vote
1
answer
135
views
matplotlib 3D line plot
I am trying to plot a two series of data in 3d as lines but cant find a good example of how to structure the data to do this in python.
My example data is:
x = np.array([[1,1,1,1,5,1,1,1,1], [4.5,5,5,...
1
vote
1
answer
101
views
Plot a partially transparent plane in matplotlib
I want to plot a sequence of three colormaps in a 3D space, with a line crossing all the planes of the colormaps, as shown in the figure below.
https://i.sstatic.net/65yOib6B.png
To do that, I am ...
0
votes
1
answer
88
views
How to draw grid planes uniformly using matplotlib?
Basically I have this code:
import matplotlib.pyplot as plt
import numpy as np
from itertools import product, combinations
fig = plt.figure()
ax = fig.add_subplot(1,1,1,projection='3d')
but that ...
1
vote
1
answer
117
views
Creating a 3d Bar Chart in Python
I tried to replicate the following code to create 3D bar charts:
https://pythonprogramming.net/3d-bar-chart-matplotlib-tutorial/
The idea behind the code below is to compute the Likelihood ratio of ...
0
votes
1
answer
68
views
how to fix import matplotlib.pylot as plt can't be recognized I've checked everything and verified that it is installed [duplicate]
ImportError: DLL load failed while importing _cext: The specified module could not be found.
It says that it fails to import the matplotlib.pyplot as plt.
I've checked the Matplotlib uninstalled and ...
0
votes
1
answer
25
views
How to plot 2D with contourf in 3D projection of matplotlib.pyplot?
I want to plot a kind of torus in such a way:
def flux2cart(RHO, PHI, THETA):
XX = (R0 + DEL0*(1.0-RHO**2) + RHO*A0* np.cos(THETA) - RHO*A0*DELTA*np.sin(THETA)**2)*np.cos(PHI)
YY ...
0
votes
1
answer
54
views
Matplotlib Can't remove all whitespaces when plotting an image at z=0 of a 3D scatter plot
I'm trying to plot Cartopy tiles as a surface for my 3D scatter at z=0.
To achieve this, I've created a 2D figure for the map data using the extents of my coordinates. The 2D figure looks correct. It ...
0
votes
2
answers
70
views
Setting 3D-plot scale to logarithmic in Matplotlib giving an almost empty 2D plot
I'm trying to set the scale of a plot to logarithmic, using the code below. When plotting without the log scale, it gives me a correct plot.
for it, folder in enumerate(norm_folder_list):
fig = ...
0
votes
0
answers
28
views
'update lines' function in 3d animation
I am trying to animate in 3D an arm represented by 2 segments (3 points A, B and C of which I have 3D coordinates in a numpy array (shape (n,3))). Only the arm at instant t (between 0 and n) should be ...
0
votes
0
answers
52
views
How to rotate colorbar to align with plot_surface in 3d plot
I would like to plot a colorbar next to an image plotted with plot_surface in a 3d plot, such that the colorbar also rotates with the plot_surface image when the 3d axes are rotated.
So far, my code ...
1
vote
1
answer
43
views
regression plane's color isn't uniform?
I don't understand why the color of the regression plane is not the same.
Here the code and output:
import numpy as np
import pandas as pandas
import statsmodels.api as sm
import matplotlib.pyplot as ...
0
votes
0
answers
76
views
convert 3D top view into 2D plot
After getting the 2D plot by using ax.view_init function like the following question:
Rotate 3d plot to look like 2d plot (no perspective)
How can I change and resize the photo with the same behavior ...
0
votes
1
answer
37
views
Why are my subplots not positioned properly after animating them?
I'm answering module on image processing and I wanted to show how the values of a given 2D image change based on the intensity of the values of each pixel. The only thing is that I can't seem to ...
0
votes
0
answers
34
views
plot_surface produces no accurate 3d plot
I am following the 3D surface (colormap) from Matplotlib tutorial in order to plot $f(x,y)=(y-x)^2+x^{5}$.
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import ...
-1
votes
1
answer
35
views
3D scatter of points with colors as a 4th var
I'm trying to scatter a dataset in 3D and for each point using a scalar variable as a color, to visualize better some phenomena.
In order to keep things simple, suppose i want that each point plotted ...
0
votes
1
answer
172
views
Draw an image and a stem plot in 3d with matpltolib
I'm trying to make a 3d plot with python that shows an image at a certain level and certain specific points as a stem plot (basically the image is a sort of 2d map and the stem plots represent the ...
1
vote
1
answer
309
views
Matplotlib 3d zoom issue
Here to ask a question about the basic matplotlib 3d plotting tools. Now, let me make some dummy data to explain my issue:
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-1, 1, ...
0
votes
1
answer
568
views
No roll argument in matplotlib axes3d view_init method
I grab this image from the matplotlib documentation page on "mplot3d View Angles":
Based on the documentation, it seems that the method view_init() should have three arguments: elev (short ...
0
votes
1
answer
140
views
Updating x/y/z limits in matplotlib Animation 3D
I came to this problem when I tried to adjust the limits of the axis in the 3D animation. It seemed that the range of the limits on the screen is not what I want, but the output of the limits on the ...
0
votes
1
answer
95
views
Set aspect ratio in matplotlib 3.8 3D plots
I am trying to plot this:
https://100.datavizproject.com/data-type/viz4/
Using matplotlib.
I have got this far:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as ...
0
votes
0
answers
57
views
Shaded area below curve in 3D projection
I am trying to do the graph, but I want to shade the area below the graph to to reach the (x,y)--plane. So I just want shaded plane along the z-axis. On my plot I can see, that this 'shading' is just ...
0
votes
1
answer
173
views
How to plot this 3D graph from excel using matplotlib
I have attached a graph:
This is a graph from excel
I want to create the same graph using code in matplotlib. I checked online for 3d graphs but didn't get anything similar to this.
This is the data ...
2
votes
1
answer
7k
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
...
0
votes
1
answer
61
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 ...
0
votes
1
answer
104
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
...
0
votes
0
answers
261
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 ...
4
votes
0
answers
236
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 ...
0
votes
1
answer
157
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 ...
1
vote
1
answer
54
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 ...
0
votes
2
answers
716
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 ...
-1
votes
1
answer
487
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 ...
1
vote
1
answer
188
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 ...
0
votes
0
answers
23
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
...
2
votes
1
answer
88
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 ...
-1
votes
1
answer
510
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 = ...