scatter

Speeding up matplotlib scatter plots

旧巷老猫 提交于 2019-12-03 12:48:11
I'm trying to make an interactive program which primarily uses matplotlib to make scatter plots of rather a lot of points (10k-100k or so). Right now it works, but changes take too long to render. Small numbers of points are ok, but once the number rises things get frustrating in a hurry. So, I'm working on ways to speed up scatter, but I'm not having much luck There's the obvious way to do thing (the way it's implemented now) (I realize the plot redraws without updating. I didn't want to alter the fps result with large calls to random). import matplotlib.pyplot as plt import numpy as np

Matplotlib: Scatter Plot to Foreground on top of a Contour Plot

瘦欲@ 提交于 2019-12-03 10:37:13
问题 Does anyone know a way to bring a scatter plot to the foreground in matplotlib? I have to display the scatter plotting on top of the contour, but by default it is plotted underneath... Thanks in advance! 回答1: You can manually choose in which order the different plots are to be displayed with the zorder parameter of e.g. the scatter method. To demonstrate, see the code below, where the scatter plot in the left subplot has zorder=1 and in the right subplot it has zorder=-1 . The object with the

Combining scatter plot with surface plot

烈酒焚心 提交于 2019-12-03 02:28:13
How can I combine a 3D scatter plot with a 3D surface plot while keeping the surface plot transparent so that I can still see all the points? sissi_luaty To combine various types of plots in the same graph you should use the function plt.hold(True). The following code plots a 3D scatter plot with a 3D surface plot: from mpl_toolkits.mplot3d import * import matplotlib.pyplot as plt import numpy as np from random import random, seed from matplotlib import cm fig = plt.figure() ax = fig.gca(projection='3d') # to work in 3d plt.hold(True) x_surf=np.arange(0, 1, 0.01) # generate a mesh y_surf=np

how to solve scatterplot error in matlab

谁说胖子不能爱 提交于 2019-12-02 13:21:59
following is a part of the code I am writing, for ii=1:length(k31) B = [k31(ii);k32(ii)]; X=abs( pinv(A)*B); g1(ii)=X(1,:); g2(ii)=X(2,:); g3(ii)=X(3,:); end scatter(x(1:end-1), y(1:end-1), 5, g1); But I am not able to plot the data, the error is as follows ??? Error using ==> scatter at 79 C must be a single color, a vector the same length as X, or an M-by-3 matrix. x and y have the same dimensions as k31...but still it is showing such an error You are feeding scatter with 4 arguments: scatter(X, Y, S, C) . Your error states: C must be a single color, a vector the same length as X , or an M

python scatter plot area size proportional axis length

拟墨画扇 提交于 2019-12-02 11:30:14
问题 I'm getting quite desperate about this, I couldn't find anything on the www so far. Here's the situation: I am working with Python. I have 3 arrays: the x-coordinates, the y-coordinates and the radius. I want to create a scatter plot with the given x- and y-coordinates. So far, everything works how I want it to. Here is what's bothering me: The circle size of each point in the scatter plot should be defined by the radius array. The the values of the coordinates and the radius are in same

MPI Matrix Multiplication with scatter gather

淺唱寂寞╮ 提交于 2019-12-02 07:39:15
I'm trying to do matrix multiplication using MPI in C and we have to do a version that sequential and one parallel version. My parallel version is not giving the correct answers and I'm not sure why. I think I'm not sending the right communications to the processes but I can't be sure. The professor just went over the different send/receive/gather etc messages, but didn't really get into much detail... I've seen a lot of different examples but none complete and none using scatter/gather. If anyone can take a look at my code and tell me if anything pops out at them I'd appreciate it. I'm pretty

python scatter plot area size proportional axis length

自闭症网瘾萝莉.ら 提交于 2019-12-02 06:45:15
I'm getting quite desperate about this, I couldn't find anything on the www so far. Here's the situation: I am working with Python. I have 3 arrays: the x-coordinates, the y-coordinates and the radius. I want to create a scatter plot with the given x- and y-coordinates. So far, everything works how I want it to. Here is what's bothering me: The circle size of each point in the scatter plot should be defined by the radius array. The the values of the coordinates and the radius are in same units. More explicitly: Let's assume I have a point at (1, 1) with radius 0.5 assigned. Then I want to get

Matplotlib: Group different scatter markers under the same legend

你离开我真会死。 提交于 2019-12-02 01:49:13
问题 I have the following question about a Matplotlib plot. I am plotting data from different experiment as scatter plot; each of the set of data has its own marker and color. I would like to have them grouped in one single line of the legend because for me they have all the same "meaning". Es. Let's say I have 3 set of data from 3 research group: plt.plot(group1, marker='^', c='r', label='groupdata') plt.plot(group2, marker='o', c='b', label='groupdata') plt.plot(group3, marker='s', c='g', label=

Matplotlib: Group different scatter markers under the same legend

℡╲_俬逩灬. 提交于 2019-12-02 01:11:50
I have the following question about a Matplotlib plot. I am plotting data from different experiment as scatter plot; each of the set of data has its own marker and color. I would like to have them grouped in one single line of the legend because for me they have all the same "meaning". Es. Let's say I have 3 set of data from 3 research group: plt.plot(group1, marker='^', c='r', label='groupdata') plt.plot(group2, marker='o', c='b', label='groupdata') plt.plot(group3, marker='s', c='g', label='groupdata') I'd like to have a single line in legend that shows: ^ o s = groupdata The best way to

`map.scatter` on basemap not displaying markers

江枫思渺然 提交于 2019-12-01 18:56:33
I have a map of Germany, and the coords of a few cities. plot displays the dots properly. I would like to use scatter instead, in order to be able to color the markets with respect to an other variable and then display a colorbar . The code runs in the console, but the dots are not visualized when I replace map.plot with map.scatter . from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np plt.figure(1) map = Basemap(projection='merc', resolution='l', llcrnrlat=44.0, llcrnrlon=5.0, urcrnrlat=57.0, urcrnrlon=17) map.drawcoastlines() map.drawcountries() map