color-mapping

Python 3d scatterplot colormap issue

∥☆過路亽.° 提交于 2019-12-20 01:15:30
问题 I have four dimensional data (x, y, z displacements; and respective voltages) which I wish to plot in a 3d scatterplot in python. I've gotten the 3d plot to render, but I want to have the colour of the points change using a colourmap, dependent upon the magnitude of the point's voltage. I've tried a few things, but can't seem to get it to work I'm getting the error ValueError: Cannot convert argument type <type 'numpy.ndarray'> to rgba array . I'm not sure exactly how to convert what I need

pcolor map in matlab

余生颓废 提交于 2019-12-18 09:23:39
问题 In matlab, we can use pcolor to show the magnitude of data in color. I am trying the following data A=[1:10; 16:25; 86:95]; pcolor(A); It only show two rows. Why is that and how to show all those three data set? Thanks. 回答1: From documentation of pcolor In the default shading mode, 'faceted', each cell has a constant color and the last row and column of C are not used. Use imagesc instead imagesc(A); 来源: https://stackoverflow.com/questions/12662815/pcolor-map-in-matlab

Specify absolute colour for 3D points in MayaVi

笑着哭i 提交于 2019-12-17 23:44:52
问题 I am using the MayaVi Python library to plot 3d points, using the points3d class. The documentation specifies that the colour of each point is specified through a fourth argument, s : In addition, you can pass a fourth array s of the same shape as x, y, and z giving an associated scalar value for each point, or a function f(x, y, z) returning the scalar value. This scalar value can be used to modulate the color and the size of the points. This specifies a scalar value for each point, which

How to set default colormap in Matplotlib

女生的网名这么多〃 提交于 2019-12-17 15:48:10
问题 Especially when working with grayscale images it is tedious to set the color map for every imshow command as imshow(i, cmap='gray') . How can I set the default color map matplotlib uses to grayscale or any other colormap? 回答1: To change the default colormap only for the current interactive session or one script use import matplotlib as mpl mpl.rc('image', cmap='gray') For versions of matplotlib prior to 2.0 you have to use the rcParams dict. This still works in newer versions. import

Color Space Mapping YCbCr to RGB

萝らか妹 提交于 2019-12-13 15:03:23
问题 I am experimenting with JPEG compression using python. I load in a tiff image and store it as numpy uint8 RGB array. I was doing this for color mapping. def rgb2ycbcr(im): cbcr = np.empty_like(im) r = im[:,:,0] g = im[:,:,1] b = im[:,:,2] # Y cbcr[:,:,0] = .299 * r + .587 * g + .114 * b # Cb cbcr[:,:,1] = 128 - .169 * r - .331 * g + .5 * b # Cr cbcr[:,:,2] = 128 + .5 * r - .419 * g - .081 * b return np.uint8(cbcr) def ycbcr2rgb(im): rgb = np.empty_like(im) y = im[:,:,0] cb = im[:,:,1] - 128

(MATLAB) Colormap for video/animation

廉价感情. 提交于 2019-12-13 02:23:51
问题 I have some code that produces a series of grayscale images. I am then able to save the images individually in a loop and save them with a colormap applied. i.e. file = sprintf('image_%04d.png',x); imwrite(image1,jet,file,'png'); So i get my images out the other end and they have the correct colormapping which is colormap(jet). However, when in my next program, I try to cobble these images together to form a short animation (yes I know I should just make the movie in the same loop as above),

Heat map generator of a floor plan image

匆匆过客 提交于 2019-12-12 09:54:44
问题 I want to generate a heat map image of a floor. I have the following things: A black & white .png image of the floor A three column array stored in Matlab. -- The first two columns indicate the X & Y coordinates of the floorpan image -- The third coordinate denotes the "temperature" of that particular coordinate I want to generate a heat map of the floor that will show the "temperature" strength in those coordinates. However, I want to display the heat map on top of the floor plan so that the

Non-linear scaling of a colormap to enhance contrast

谁都会走 提交于 2019-12-12 09:37:51
问题 The following python code creates a heatmap of a matrix that contains normally distributed values import numpy as np from matplotlib import pylab as plt np.random.seed(123) #make sure we all have same data m = np.random.randn(200).reshape(10, 20) plt.imshow(m, cmap='RdYlGn', interpolation='nearest') plt.colorbar() This is the output of this code I would like to enhance the contrast of this image by "fading out" the values close to zero. I can easily do this by using disigmoid scaling of the

Is there a way to merge palettes for indexed pygame.Surfaces?

邮差的信 提交于 2019-12-12 03:25:15
问题 I have a Surface BaseSurf with an indexed colour palette, and I want to blit another indexed-colour Surface to it (let's call it NewSurf ). BaseSurf's palette is different from NewSurf's, though, and pygame does not automatically add the missing colours to BaseSurf's palette. I therefore need some way to append NewSurf's colours to BaseSurf's palette without mangling either (overwriting palette indices which are actually used by the Surface's pixels). When I run this code: screen = pygame

Colormap entire subplot

喜欢而已 提交于 2019-12-11 03:15:45
问题 I'm having some trouble with color maps. Basically, what I would like to produce is similar to the image below. On the bottom subplot I would like to be able to plot the relevant colour, but spanning the entire background of the subplot.i.e it would just look like a colourmap over the entire plot, with no lines or points plotted. It should still correspond to the colours shown in the scatter plot. Is it possible to do this? what I would ideally like to do is put this background under the top