scatter

MPI_Scatter: Why do I have to allocate memory in all the processes?

前提是你 提交于 2019-12-10 22:00:53
问题 I am dealing with parallelizing Conways' Game of Life using MPI (in c++). I have to read a (very large) matrix from input, then scatter it in slices row-wise, and then process every slice in parallel. The idea I am following is to let only one process deal with the I/O stuff. In particular, process 0 read from file and saves the initial datas into a say RxC matrix, to be scattered among the process in (R/P)xC "slice matrices". Now, when I perform the routine MPI_Scatter, the compiler

ValueError: Invalid RGBA argument: 'o'

房东的猫 提交于 2019-12-10 17:35:59
问题 I am trying to draw a scatter plot in Python with color code stored in 'color' column of dataframe. And I get invalid RGBA argument error. Here's my code and data: df.plot.scatter(x='x', y='y', c='color') id x type color y 0 109 570.4 ha r 500.8 1 110 632.4 ha r 567.2 2 111 399.4 of b 487.2 3 112 250.2 of b 444.4 ... 回答1: I just solved it by this code. col = df['type'].map({'ha':'r', 'of':'b', 'cu':'y'}) df.plot.scatter(x='x', y='y', c=col) 来源: https://stackoverflow.com/questions/45739673

Updating the positions and colors of pyplot.scatter

老子叫甜甜 提交于 2019-12-10 17:32:58
问题 I have been struggling with this for a while and can't get it to work. I am reading a file in chunks and scatter plotting data from it, and I would like to "animate" it by updating the scatter plot for each chunk in a for loop (and also adapt it to a live stream of data). So something like this ugly example works for a single plot: x = [1, 2, 3, 4] y = [4, 3, 2, 1] alpha = [0.2, 0.3, 0.8, 1.0] c = np.asarray([(0, 0, 1, a) for a in alpha]) s = scatter(x, y, marker='o', color=c, edgecolors=c)

Why won't my Python scatter plot work?

天涯浪子 提交于 2019-12-10 14:54:53
问题 I created a very simple scatter plot using pylab. pylab.scatter(engineSize, fuelMile) pylab.show() The rest of the program isn't worth posting, because it's that line that's giving me the problem. When I change "scatter" to "plot" it graphs the data, but each point is part of a line and that makes the whole things a scribbly mess. I just want points, not a line, but I get this huge error message that ends with: File "C:\Python26\lib\site-packages\numpy\core\fromnumeric.py", line 1643, in amin

Animation in matplotlib with scatter and using set_offsets: Autoscale of figure is not working

痴心易碎 提交于 2019-12-10 10:33:28
问题 I'm using matplotlib plotting in python GUI using animation. And below is the code import sys from PyQt4 import QtGui from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar import matplotlib.pyplot as plt import matplotlib.animation import numpy as np class Window(QtGui.QDialog): def __init__(self, parent=None): super(Window, self).__init__(parent) self.figure = plt.figure() self

Find volume of 3d peaks in matlab

我的未来我决定 提交于 2019-12-10 10:29:46
问题 right now I have a 3d scatter plot with peaks that I need to find the volumes for. My data is from an image, so the x- and y- values indicate the pixel positions on the xy-plane, and the z value is the pixel value for each pixel. Here's my scatter plot: scatter3(x,y,z,20,z,'filled') I am trying to find the "volume" of the peaks of the data, like drawn below: I've tried findpeaks() but it gives me many local maxima without the the two prominent peaks that I'm looking for. In addition, I'm

matplotlib: how can I convert a XYZ scatter to a pixel image?

馋奶兔 提交于 2019-12-10 10:26:14
问题 I'm looking for some way in to convert a scatter plot (X vs Y, color normalized by Z) into a 2D "pixel" image. I.e. how can I plot a pixelized image where the pixels are colored according to a third variable? In my case, I have a list of galaxies, each a with sky coordinate (X,Y) and a distance (Z). I want to make a pixelized image of X vs Y, with the pixels color normalized according to Z (e.g. the median Z value for the galaxies in that pixel). I know I could do something like this with

Matplotlib - plot with a different color for certain data points

不想你离开。 提交于 2019-12-10 09:25:00
问题 My question is similar to this question. I am plotting latitude vs longitude. If the value in a variable is 0, I want that lat/long value to be marked with a different color. How do I do that? This is my attempt at it so far. Here x holds the latitude and y holds longitude. timeDiff is a list holding float values and if the value is 0.0, I want that color to be different. Since, matplotlib complained that it cannot use floats, I first converted the values to int. timeDiffInt=[int(i) for i in

Color code points of 3D scatter plot according to density of points

倾然丶 夕夏残阳落幕 提交于 2019-12-08 02:18:24
问题 I have a 3D scatter plot of points in the xyz-sphere. I was wondering if there is a way to colormap/hue the scatter plot based on the density of the data. Basically, the parts of the scatter plot with the most densely clustered data points would be dark red, semi densely clustered data points would be medium red, and sparsely clustered data points would be light red. This is the way that I was thinking of, but (hopefully) there might be a simpler function or command to do this. Set a

Pyplot 3d scatter: points at the back overlap points at the front

天大地大妈咪最大 提交于 2019-12-07 10:22:09
问题 I am preparing 3d plots with matplotlib and I am having a really weird behaviour with multiple datasets. I have two datasets that describe basically two shells in 3d: one inner shell and one outer shell. To plot them in 3d I do: fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax.scatter(outer_z[:n], outer_x[:n], outer_y[:n], c='black', marker='.', lw=0) ax.scatter(inner_z[:n], inner_x[:n], inner_y[:n], c='red', marker='.', lw=0) ax.set_xlabel("Z") ax.set_ylabel("X") ax.set