scatter-plot

How to modify 2d Scatterplot to display color based off third array in csv file?

折月煮酒 提交于 2019-12-05 04:57:43
I am using Python and a CSV file. I am currently trying to modify the scatter plot(2d) below to change colors based on a third column in my csv file. After searching through multiple posts, I basically want to use a generic colormap (rainbow) and multiply my third array by the colormap in order to display different colors for each of the xy points. I think I can do everything from the ax.scatter function but I am not sure how to multiply each different x,y coordinate by the colormap and the third array number. It should look similar to a contour plot, but I would prefer a different colored

Why does my linear regression fit line look wrong?

三世轮回 提交于 2019-12-05 03:55:21
I have plotted a 2-D histogram in a way that I can add to the plot with lines, points etc. Now I seek to apply a linear regression fit at the region of dense points, however my linear regression line seems totally off where it should be? To demonstrate here is my plot on the left with both a lowess regression fit and linear fit. lines(lowess(na.omit(a),na.omit(b),iter=10),col='gray',lwd=3) abline(lm(b[cc]~a[cc]),lwd=3) Here a and b are my values and cc are the points within the densest parts (i.e. most points lay there), red+yellow+blue. Why doesn't my regression line look more like that on

tiny pie charts to represent each point in an scatterplot using ggplot2

。_饼干妹妹 提交于 2019-12-05 02:38:57
问题 I want to create a scatter plot, in which each point is a tiny pie chart. For instance consider following data: foo <- data.frame(X=runif(30), Y=runif(30),A=runif(30),B=runif(30),C=runif(30)) The following code will make a scatter plot, representing X and Y values of each point: library(reshape2) library(ggplot2) foo.m <- melt(foo, id.vars=c("X","Y")) ggplot(foo.m, aes(X,Y))+geom_point() And the following code will make a pie chart for each point: p <- ggplot(foo.m, aes(variable,value,fill

Choosing marker size in Matplotlib

落爺英雄遲暮 提交于 2019-12-05 01:23:52
I am doing a scatter plot with square marker in matplotlib like this one: . I want to achieve something like this: Which means I have to adjust the marker size and the figure size/ratio in such a way that there are no white space between markers. Also there should be a marker per index unit ( x and y are both integers) so if y goes from 60 to 100, there should be 40 markers in y direction. At the moment I am tuning it manually. Any idea on what is the best way to achieve this? Schorsch I found two ways to go about this: The first is based on this answer . Basically, you determine the number of

Scatter-plot matrix with lowess smoother

和自甴很熟 提交于 2019-12-04 18:12:18
What would the Python code be for a scatter-plot matrix with lowess smoothers similar to the following one? I'm not sure about the original source of the graph. I saw it on this post on CrossValidated. The ellipses define the covariance according to the original post. I'm not sure what the numbers mean. I adapted the pandas scatter_matrix function and got a decent result: import pandas as pd import numpy as np frame = pd.DataFrame(np.random.randn(100, 4), columns=['A','B','C','D']) fig = scatter_matrix_lowess(frame, alpha=0.4, figsize=(12,12)); fig.suptitle('Scatterplot matrix with lowess

Scatter pie plot

坚强是说给别人听的谎言 提交于 2019-12-04 14:42:39
I'm trying to visualize a soft clustering. There are a number of points and a small number of clusters, each point belongs to each cluster with some probability. Currently, I'm overlaying a scatterplot for each cluster, with the size of 'o' markers varying by the probability. This allows easy identification of the most probable cluster, but not much beyond that. I'd like to draw a scatterplot of pie charts, i.e. one small pie chart for each of the many data points, showing these probabilities. Is that possible in Matlab? I haven't found a way to draw pies as markers or place multiple pie

Adding text annotation to a clustering scatter plot (tSNE)

丶灬走出姿态 提交于 2019-12-04 11:22:51
I have XY data (a 2D tSNE embedding of high dimensional data) which I'd like to scatter plot . The data are assigned to several cluster s, so I'd like to color code the points by cluster and then add a single label for each cluster , that has the same color coding as the cluster s, and is located outside (as much as possible) from the cluster 's points. Any idea how to do this using R in either ggplot2 and ggrepel or plotly ? Here's the example data (the XY coordinates and cluster assignments are in df and the labels in label.df ) and the ggplot2 part of it: library(dplyr) library(ggplot2) set

Change point colour based on value for Google Scatter Chart

安稳与你 提交于 2019-12-04 09:24:43
I am creating a Google scatter chart. I have one data series which looks something like: var data = new google.visualization.DataTable(); data.addColumn('number', 'ID'); data.addColumn('number', 'Value'); data.addRows([[1,100], [2,150], [3,200], [4,250], [5,300], [6,350], [7,400], [8,450]]); I want the colour of the points on the scatter chart to vary, between green and red, based on the 'Value' of each point. i.e. the colour of point ID=1 should be green, however ID=8 should be red! Is this possible? Add an extra column to your DataTable, with the role style : data.addColumn( {'type': 'string

scatter plot in matplotlib

孤人 提交于 2019-12-04 08:29:53
问题 This is my first matplotlib program, so sorry for my ignorance. I've two arrays of string. say, A = ['test1','test2'] and B = ['test3','test4'] . If any correlation exists between A and B element, their corr value will be set to 1 . test1 | test2 test3 | 1 | 0 test4 | 0 | 1 Now, I want to draw a scatter diagram where my X axis will be elements of A , Y axis will be elements of B and if correlation value is 1 , it'll be marked in the scattered plot. how to do that? 回答1: Maybe something like

How to create a time scatterplot with R?

℡╲_俬逩灬. 提交于 2019-12-04 08:19:20
问题 The data are a series of dates and times. date time 2010-01-01 09:04:43 2010-01-01 10:53:59 2010-01-01 10:57:18 2010-01-01 10:59:30 2010-01-01 11:00:44 … My goal was to represent a scatterplot with the date on the horizontal axis (x) and the time on the vertical axis (y). I guess I could also add a color intensity if there are more than one time for the same date. It was quite easy to create an histogram of dates. mydata <- read.table("mydata.txt", header=TRUE, sep=" ") mydatahist <- hist(as