Questions tagged [scatter-plot]

A scatter plot is a type of data visualization that reveals possible correlations between two variables. Data points are plotted on a two-dimensional plane using Cartesian coordinates. Use this tag if you have a programming question related to scatter plots, such as problems with computing or displaying the data. You should also tag which language or software libraries you are using.

A scatter plot is a type of mathematical diagram that reveals possible correlations between two variables. Data points are plotted on a two-dimensional plane using Cartesian coordinates. Series of points may be colorized to display additional data.

Link:

3562 questions
17
votes
1 answer

matplotlib Slow 3D scatter rotation

I am using matplotlib to scatter plot a 3D matrix of points. I am using the following code: import pylab as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np my_data = np.random.rand(6500,3) # toy 3D points fig = plt.figure() ax =…
user2261062
17
votes
3 answers

Manipulating axis titles in ggpairs (GGally)

I'm using the code below to generate the following chart. # Setup data(airquality) # Device start png(filename = "example.png", units = "cm", width = 20, height = 14, res = 300) # Define chart pairs.chrt <- ggpairs(airquality, …
Konrad
  • 17,740
  • 16
  • 106
  • 167
17
votes
2 answers

How to draw half-filled points in R (preferably using ggplot)

I was wondering if it is possible to fill points with multiple colors. For example, in a scatter plot, I'd like to see for each point the upper half is filled with certain color while the lower half filled with a different one. If possible, I'd also…
17
votes
2 answers

Scatterplot Contours In Matplotlib

I have a massive scatterplot (~100,000 points) that I'm generating in matplotlib. Each point has a location in this x/y space, and I'd like to generate contours containing certain percentiles of the total number of points. Is there a function in…
astromax
  • 6,001
  • 10
  • 36
  • 47
17
votes
3 answers

How to overlay scatterplots in R?

If I have three sets of data : a1= rnorm(10) a2= rnorm(10) a3= rnorm(10) rather than looking at these side by side using: par(mfrow=c(1,3)) plot(a1) plot(a2) plot(a3) How do I get all these points on the same plot?
Cath Penfold
  • 281
  • 1
  • 3
  • 6
17
votes
1 answer

matplotlib: update position of patches (or: set_xy for circles)

Inspired by this example I'm trying to write a little matplotlib program that allows the user to drag and drop datapoints in a scatter plot dynamically. In contrast to the example which uses a bar plot (and thus allows dragging of rectangles) my…
bluenote10
  • 23,414
  • 14
  • 122
  • 178
16
votes
3 answers

Sklearn logistic regression, plotting probability curve graph

I'm trying to create a logistic regression similar to the ISLR's example, but using python instead data=pd.read_csv("data/Default.csv") #first we'll have to convert the strings "No" and "Yes" to numeric values data.loc[data["default"]=="No",…
Tony
  • 1,318
  • 1
  • 14
  • 36
16
votes
2 answers

Color scatter plot points based on a value in third column?

I am currently plotting a scatterplot based on two columns of data. However, I would like to color the datapoints based on a class label that I have in a third column. The labels in my third column are either 1,2 or 3. How would I color the…
Gary
  • 2,137
  • 3
  • 23
  • 41
16
votes
2 answers

How to add a border around a chart created via arrange.grid in gridExtra encompassing a set ggplot2 scatter plots

I'm using the code below: # Libs require(ggplot2); require(gridExtra); require(grid) # Generate separate charts chrts_list_scts <- list() # Data data("mtcars") # A chrts_list_scts$a <- ggplot(mtcars) + geom_point(size = 2, aes(x = mpg, y =…
Konrad
  • 17,740
  • 16
  • 106
  • 167
16
votes
2 answers

pylab 3d scatter plots with 2d projections of plotted data

I am trying to create a simple 3D scatter plot but I want to also show a 2D projection of this data on the same figure. This would allow to show a correlation between two of those 3 variables that might be hard to see in a 3D plot. I remember…
Labibah
  • 5,371
  • 6
  • 25
  • 23
16
votes
8 answers

How to add a diagonal line to a plot?

I want to add a diagonal line to the plot. It is not a linear regression line. I just want a diagnol line. Can anyone help me with this? Thanks a lot!
Junhua Zhao
  • 161
  • 1
  • 1
  • 3
16
votes
6 answers

creating a matplotlib scatter legend size related

I am looking for a way to include a (matplotlib) legend that describe the size of points in a scatter plot, as this could be related to another variable, like in this basic example: import numpy as np import matplotlib.pyplot as plt N = 50 x =…
gluuke
  • 1,179
  • 6
  • 15
  • 22
16
votes
2 answers

class labels in Pandas scattermatrix

This question has been asked before, Multiple data in scatter matrix, but didn't receive an answer. I'd like to make a scatter matrix, something like in the pandas docs, but with differently colored markers for different classes. For example, I'd…
bgschiller
  • 2,087
  • 1
  • 16
  • 30
16
votes
1 answer

ggplot2 custom legend shapes

When we have both shape and color legend in scatter plot, the shape of color legend is misleading: foo <- data.frame( length=runif(10), height=runif(10), group=as.factor(sample(3,10,rep=T)), …
Ali
  • 9,440
  • 12
  • 62
  • 92
15
votes
1 answer

overplot multiple sets of data with hexbin

I am doing some KMeans clustering on a large and really dense data set and I am trying to figure out the best way to visualize the clusters. In 2D, it looks like hexbin would do a good job but I am unable to overplot the clusters on the same…
Labibah
  • 5,371
  • 6
  • 25
  • 23