scatter-plot

How to change the shape of the marker depending on a column variable?

爷,独闯天下 提交于 2020-05-26 09:39:06
问题 I am trying to create a scatter plot for a csv file in python which contains 4 columns x , y , TL , L . I am supposed to plot x versus y and change the color of the marker based on the class ID in the TL column which I have achieved in the below code. import pandas as pd from matplotlib import pyplot as plt import numpy as np df=pd.read_csv('knnDataSet.csv') df.columns=['SN','x','y','TL','L'] color=['red','green','blue'] groups = df.groupby('TL') fig, ax = plt.subplots() for name, group in

How to change the shape of the marker depending on a column variable?

别说谁变了你拦得住时间么 提交于 2020-05-26 09:39:05
问题 I am trying to create a scatter plot for a csv file in python which contains 4 columns x , y , TL , L . I am supposed to plot x versus y and change the color of the marker based on the class ID in the TL column which I have achieved in the below code. import pandas as pd from matplotlib import pyplot as plt import numpy as np df=pd.read_csv('knnDataSet.csv') df.columns=['SN','x','y','TL','L'] color=['red','green','blue'] groups = df.groupby('TL') fig, ax = plt.subplots() for name, group in

Need to select the range of points in google scatter chart by dragging the mouse

最后都变了- 提交于 2020-05-13 08:13:25
问题 Recently I started working on Google Charts. Till now it is fine but now I am facing an issue with multiple selection. I am able to select multiple points by mouse clicks but I need to select range of points by dragging the mouse. Could you please help me in this? 回答1: using this answer to draw the selection range --> Select area/rectangle in javascript use chart method --> chart.getChartLayoutInterface().getBoundingBox() to find the bounds for each point... chart.getChartLayoutInterface()

Need to select the range of points in google scatter chart by dragging the mouse

こ雲淡風輕ζ 提交于 2020-05-13 08:13:09
问题 Recently I started working on Google Charts. Till now it is fine but now I am facing an issue with multiple selection. I am able to select multiple points by mouse clicks but I need to select range of points by dragging the mouse. Could you please help me in this? 回答1: using this answer to draw the selection range --> Select area/rectangle in javascript use chart method --> chart.getChartLayoutInterface().getBoundingBox() to find the bounds for each point... chart.getChartLayoutInterface()

AttributeError: 'str' object has no attribute 'view' in Seaborn , Scatterplot

爱⌒轻易说出口 提交于 2020-05-13 04:58:20
问题 I am getting a bizarre exception in Seaborn. For a reproducible example: toy_data.to_json() '{"X":{"0":0.12765045,"1":0.0244816152,"2":0.1263715245,"3":0.0246376768,"4":0.1108581319,"5":0.1406719382,"6":0.1358105564,"7":0.1245863432,"8":0.1175445352,"9":0.1188479018,"10":0.1113148159,"11":0.117455495,"12":0.110555662,"13":0.1328567106,"14":0.103064284,"15":0.1119474442,"16":0.119390455,"17":0.1246727756,"18":0.1117827155,"19":0.1169972547},"Y":{"0":0.1241083714,"1":0.1394242378,"2":0

AttributeError: 'str' object has no attribute 'view' in Seaborn , Scatterplot

◇◆丶佛笑我妖孽 提交于 2020-05-13 04:56:04
问题 I am getting a bizarre exception in Seaborn. For a reproducible example: toy_data.to_json() '{"X":{"0":0.12765045,"1":0.0244816152,"2":0.1263715245,"3":0.0246376768,"4":0.1108581319,"5":0.1406719382,"6":0.1358105564,"7":0.1245863432,"8":0.1175445352,"9":0.1188479018,"10":0.1113148159,"11":0.117455495,"12":0.110555662,"13":0.1328567106,"14":0.103064284,"15":0.1119474442,"16":0.119390455,"17":0.1246727756,"18":0.1117827155,"19":0.1169972547},"Y":{"0":0.1241083714,"1":0.1394242378,"2":0

How to convert an image into point data for ggplot2 scatterplot

僤鯓⒐⒋嵵緔 提交于 2020-05-12 15:55:07
问题 I recently found a package on Github where the dev analyzed fan-curated data on the 248 installments of the Spy vs Spy comic by Antonio Prohias appearing in Mad Magazine. He goes through some basic exploratory data analysis, computes a running net score of Black Spy victories and then runs a non-parametric test (Wald Wolfowitz test) to look at clusters of consecutive victories by one of the Spies in order to ascertain if Prohias kept the score balance by reversing the previous outcome, or if

Fill area between two curves in python

穿精又带淫゛_ 提交于 2020-05-09 06:23:14
问题 I am trying to shade the area between two curves that I have plotted. This is what I plotted. Using the following code. plt.scatter(z1,y1, s = 0.5, color = 'blue') plt.scatter(z2,y2, s = 0.5, color = 'orange') I tried using plt.fill_between() but for this to work I need to have the same data on the x_axis (would need to do something like plt.fill_between(x,y1,y2) ). Is there any other function that might help with this or am I just using fill_between wrong. 回答1: You can try with: plt.fill(np

Height values for each point in a plot

吃可爱长大的小学妹 提交于 2020-04-13 07:22:32
问题 I have a data of protein-protein interactions in a data frame entitled: s1m. Each DB and AD pair make an interaction and I can plot it as well: > head(s1m) DB_num AD_num [1,] 2 8153 [2,] 7 3553 [3,] 8 4812 [4,] 13 7838 [5,] 24 3315 [6,] 24 6012 Plot of the data looks like: I then used code I found on this site to plot filled contour lines: ## compute 2D kernel density, see MASS book, pp. 130-131 require(MASS) z <- kde2d(s1m[,1], s1m[,2], n=50) plot(s1m, xlab="X label", ylab="Y label", pch=19,

How to iterate a list of list for a scatter plot and create a legend of unique elements

耗尽温柔 提交于 2020-03-04 21:34:30
问题 Background: I have a list_of_x_and_y_list that contains x and y values which looks like: [[(44800, 14888), (132000, 12500), (40554, 12900)], [(None, 193788), (101653, 78880), (3866, 160000)]] I have another data_name_list ["data_a","data_b"] so that "data_a" = [(44800, 14888), (132000, 12500), (40554, 12900)] "data_b" = [(None, 193788), (101653, 78880), (3866, 160000)] The len of list_of_x_and_y_list / or len of data_name_list is > 20. Question: How can I create a scatter plot for each item