All Questions
39 questions
7votes
2answers
4kviews
Convert timeseries to image matrix
I have a numpy array X of timeserieses. Something like that: [[0.05, -0.021, 0.003, 0.025, -0.001, -0.023, 0.095, 0.001, -0.018] [0.015, 0.011, -0.032, -0.044, -0.002, 0.032, -0.051, -0.03, -0.020] [...
3votes
2answers
4kviews
Can't modify numpy array
I got stuck practising with images in Python 3: import numpy as np from matplotlib.image import imread photo_data = imread('c:\jpeg.jpg') photo_data[0,0,1] = 0 I get this error ----------------------...
3votes
1answer
1kviews
Confidence Interval 3 dimensional plot
I have a 3-dimensional plot and I am able to plot it with the code written below. Considering that my point distribution is represented by a 100x100 matrix, is it possible to plot a confidence ...
2votes
2answers
101views
Trouble Shooting Python Quiverplots
I have been trying to get a plot of vector lines going using the matplotlib library and I keep getting something like this: Not sure what is happening since the code I'm running seems to follow the ...
2votes
1answer
59views
Numpy Equivalent of Nesting For loops for approximate pixel color change
The follow code shows how to change a a pixel in a 3D image with numpy using for loops. As you can see, the truth value is a few logical ANDs where an RGB pixel value must be within a certain range. I ...
2votes
1answer
1kviews
Unable to reshape numpy array to RGB image
I have an numpy array which is of all images from CIFAR10 dataset: (50000, 3072) I am taking a single array out of it, its shape is (3072,) then am trying to convert it to RGB image by doing .reshape(...
2votes
2answers
172views
Generating logscale ticks in python
I needed to generate a list containing logscale ticks between 10^a and 10^b with a < b, however I could not find any convenience functions so far. So I went ahead and did it manually: # List ...
1vote
2answers
125views
Plotting a cube on top of a plane, given all the vertices of the cube
I am tring to plot a cube on top of a plane using matplotib. I am doing a project on UAV(An unmanned aerial vehicle) Landing and there are these tests i have to visualize. I have a landing plane ...
1vote
1answer
46views
Creating a curved array diagram without contours
So I have a python array and a code that produces a 2D representation of it: import numpy as np import matplotlib.pyplot as plt # Define the input data as a 2D NumPy array arr = np.array([ ['x', '...
1vote
1answer
42views
Mapping 2d point (x,y) into grid index (row,col)
I have a particular **Grid ** for robot navigation showing as so: I have scaled this by a factor of 10 to create my Environment. This is given in Cartesian coordinates I would like to map a point in ...
1vote
1answer
6kviews
TypeError: Dimensions of C (50, 49) should be one smaller than X(50) and Y(50) while using shading='flat' see help(pcolormesh)
My outputs T_results and c_results have values of 0 at the end, which I do not want so I sliced theses arrays excluding their last column and got their respective arrays T_results_cleaned = T_results[:...
1vote
1answer
867views
How could I generate a 2D array from a known slope and aspect value?
Given a dummy heightmap (or digital elevation model) stored as a Numpy array like this: import numpy as np import matplotlib.pyplot as plt line = np.flip(np.arange(0, 10)) dem = np.tile(line, (10, 1))...
1vote
1answer
302views
Plotting a 3-dimensional numpy array
I have a 3d numpy array with the shape (128,128,384). Let's call this array "S". This array only contains binary values either 0s or 1s. \now \i want to get a 3d plot of this array in such ...
1vote
2answers
390views
How to find the closest value on the left
I have a function and I have detected the peaks of this function. I took the half of the height of each peak, now I want to find the intersection point, on the left only, between the function and the ...
1vote
1answer
26views
What am I doing wrong when trying to plot two numpy arrays?
I'm attempting to plot: x and y values on a ax.loglog plot but am receiving the following error: ValueError: x and y must have same first dimension, but have shapes (4000,) and (1,) I have a list of ...