scatter

pandas scatter matrix display correlation coefficient

谁说我不能喝 提交于 2019-12-04 13:07:55
问题 I've tried to find a way to display correlation coefficients in the lower or upper tri of a pandas scatter matrix - can someone point me in the right direction? Thank you. 回答1: A working minimal example import matplotlib.pyplot as plt import pandas as pd import numpy as np from pandas.plotting import scatter_matrix df = pd.DataFrame(np.random.randn(100, 4), columns=['a', 'b', 'c', 'd']) axes = scatter_matrix(df, alpha=0.5, diagonal='kde') corr = df.corr().as_matrix() for i, j in zip(*plt.np

Saving scatterplot animations with matplotlib produces blank video file

回眸只為那壹抹淺笑 提交于 2019-12-04 08:35:34
I am having a very similar problem to this question but the suggested solution doesn't work for me. I have set up an animated scatter plot using the matplotlib animation module. This works fine when it is displaying live. I would like to save it to an avi file or something similar. The code I have written to do this does not error out but the video it produces just shows a blank set of axes or a black screen. I've done several checks and the data is being run and figure updated it's just not getting saved to video... I tried removing "animated=True" and "blit=True" as suggested in this

how to solve scatterplot error in matlab

元气小坏坏 提交于 2019-12-04 07:05:56
问题 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 回答1: You are feeding scatter with 4 arguments:

Specify color of each point in scatter plot (matplotlib)

不羁岁月 提交于 2019-12-04 06:04:30
I have a 3D Plot that I created using matplotlib, and I have a list of rbg values that correspond to each point. I have the X, Y, and Z data, and then I have a "color list" of the form: [ (r,g,b), (r,g,b), ... , (r,g,b) ] to match each (x, y, z) point. Right now, I have fig = plt.figure() ax = fig.add_subplot(111, projection = '3d') ax.scatter(X, Y, Z) plt.show() What's the appropriate way to incorporate those rgb tuples so that each point will be assigned a specific color? I used a for loop to individually assign each color to each point. Here is my code: X = [1, 2, 3] Y = [2, 5, 8] Z = [6, 4

Spread overlapping points in a circle - R

帅比萌擦擦* 提交于 2019-12-04 05:08:27
问题 I have a number of points in R which are overlapping -> my idea is to create a new coordinates column where I spread them out in a circle. I don't want to jitter; it looks ugly and is misleading -> it makes the viewer think that the data is actually like that, rather than it has just been presented like that for visibility. I think a circle or sunflower or star spread looks nice so that's what I want to do. What I have is not working great I think because of the geographic projections: Before

Different marker sizes in highcharts?

不羁的心 提交于 2019-12-04 04:56:26
问题 For my scatter chart in highcharts I would like different series to have different marker radius. Is this possible? "plotOptions": {"series": {"marker": {"enabled": true ,"symbol": "circle" ,"radius": 15} } } { It does not work to use: "plotOptions": {"series": {"marker": {"enabled": true ,"symbol": "circle" ,"radius": 15,20,10,5,2} } } { 回答1: You can provide marker option for radius in each individual data series So series will be as series: [{ name: 'Female', color: 'rgba(223, 83, 83, .5)',

axis range in scatter graphs

被刻印的时光 ゝ 提交于 2019-12-04 04:01:51
I have been using the code below to plot the time spent to run 4 functions. The x axis represents the number of executions whereas the y axis represents the time spent running a function. I was wondering if you could help me accomplish the following: 1) set the limits of the x axis so that only positive values are shown (x represents the number of times each function was executed and is, therefore, always positive) 2) create a legend for the 4 functions Thank you, Mark import matplotlib from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import

`map.scatter` on basemap not displaying markers

时光怂恿深爱的人放手 提交于 2019-12-04 03:56:50
问题 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',

How to color a specific gridline/tickline in 3D Matplotlib Scatter Plot figure?

自闭症网瘾萝莉.ら 提交于 2019-12-03 23:11:21
问题 I am trying to modify the color/thickness of a specific gridline in a 3D matplotlib scatter plot, in this case I want the -30 z axis grid line to be black, bold, or thickened so it stands out amongst the other gridlines. Here is the basic code seen from the mplot3d scatter plot tutorial: import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt def randrange(n, vmin, vmax): return (vmax-vmin)*np.random.rand(n) + vmin fig = plt.figure() ax = fig.add_subplot(111

Is there a way to make matplotlib scatter plot marker or color according to a discrete variable in a different column?

≡放荡痞女 提交于 2019-12-03 15:56:12
I'm making scatterplots out of a DF using matplotlib. In order to get different colors for each data set, I'm making two separate calls to plt.scatter: plt.scatter(zzz['HFmV'], zzz['LFmV'], label = dut_groups[0], color = 'r' ) plt.scatter(qqq['HFmV'], qqq['LFmV'], label = dut_groups[1], color = 'b' ) plt.legend() plt.show() This gives me the desired color dependence but really what would be ideal is if I could just get pandas to give me the scatterplot with several datasets on the same plot by something like df.plot(kind = scatter(x,y, color = df.Group, marker = df.Head) Apparently there is no