Note, you can drag and drop to different perspectives and may want to save multiple views for presentations, posterity.A clustered column chart vs a stacked column chart in Excel. The results for about 75k data points of mine are below. Rgba = Īx.bar3d(xpos, ypos, zpos, dx, dy, dz, color=rgba, zsort='average') # scale each z to, and get their rgb values Max_height = np.max(dz) # get range of colorbars so we can normalize Xpos, ypos = np.meshgrid(xedges xedges, yedges yedges)Ĭmap = cm.get_cmap('jet') # Get desired colormap - you can change this! Hist, xedges, yedges = np.histogram2d(x, y, bins=(20,20)) #make histogram stuff - set bins - I choose 20x20 because I have a lot of data X = np.array(xAmplitudes) #turn x,y data into numpy arraysįig = plt.figure() #create a canvas, tell matplotlib it's 3dĪx = fig.add_subplot(111, projection='3d') Adjust accordingly! xAmplitudes = #your data here Note: result will vary substantially depending on how much data you have and how many bins your choose for you histogram. If you had few data points in the bin where (x,y) = (100,100) it would be low and blue. So, for example, if you had many data point where (x,y) = (20,20) it would be high and red. The height represents the frequency of values in that bin. This code generates a histogram scatterplot for any sort of x-y data. I posted this in a related thread about colored 3d bar plots, but I think it's also relevant here as I couldn't find a complete answer for what I needed in either thread. H, xedges, yedges = np.histogram2d(x, y, bins = (10, 10))Īm I missing a step or a parameter? Any advice would be greatly appreciated. I have also tried the function from numpy without success I have tried the code with and without the "[" in the line TypeError: can only concatenate list (not "float") to list M, bins = np.histogram(x, bins, weights=w, **hist_kwargs)įile "C:\Python27\lib\site-packages\numpy\lib\function_base.py", line 169, in histogram However, I am getting the following error Traceback (most recent call last):įile "C:/Users/ckiser/Desktop/Projects/Tom/Python Files/threedhistogram.py", line 24, in a3dhistogramįile "C:\Python27\lib\site-packages\matplotlib\axes.py", line 7668, in hist I have attempted to create a 3d histogram using the X and Y arrays in the following code import matplotlibįrom mpl_3d import Axes3DĪx.hist(, bins=10, range=, ]) This is more of a general question about 3d histogram creation in python.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |