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
29
votes
2 answers

Plotting a horizontal line on multiple subplots in python using pyplot

I am plotting three subplots on the same page. I want to draw a horiZontal line through all the subplots. Following is my code and the resultant graph: (You can notice I can get the horizontal line on one of the plots, but not all) gs1 =…
Abhinav Kumar
  • 1,613
  • 5
  • 20
  • 33
27
votes
4 answers

How to label points on a scatterplot with R?

I am new to R and would like to know how to label data points on a scatterplot. I tried the following code but I am getting error. x = c(102856,17906,89697,74384,91081,52457,73749,29910,75604,28267,122136, …
lara
  • 503
  • 5
  • 10
  • 15
26
votes
2 answers

Any easy way to plot a 3d scatter in Python that I can rotate around?

Currently I'm using matplotlib to plot a 3d scatter and while it gets the job done, I can't seem to find a way to rotate it to see my data better. Here's an example: import pylab as p import mpl_toolkits.mplot3d.axes3d as p3 #data is an ndarray…
pnodbnda
  • 649
  • 2
  • 8
  • 12
26
votes
0 answers

Interactive selection in ggplotly with geom_hex() scatterplot

I am trying to create a scatterplot matrix with interactive selection between geom items in individual matrix plots. This works when I am dealing with geom_points (inside ggpairs()). When a user selects points in any of the 3 bottom-left individual…
user2808302
26
votes
3 answers

How to show all x-axis tick values in Plotly?

I am using this library https://plot.ly/nodejs/axes/ to plot graphs in node.js. I have this code: var data = [ { x: xs, y: ys, type: "scatter" } ]; var graphOptions = {filename: "date-axes", fileopt: "overwrite"}; plotly.plot(data,…
omega
  • 40,311
  • 81
  • 251
  • 474
26
votes
1 answer

Colors lost in 3D scatter plot

For a project I am making some 3D scatter plots with the three corresponding projections under it. I use different colors to indicate a fourth parameter. First I plot data with a certain color and then I overplot that with other data with a…
Nikki
  • 363
  • 3
  • 7
25
votes
2 answers

Can I draw a regression line and show parameters using scatterplot with a pandas dataframe?

I would like to produce a Scatterplot from a Pandas dataframe using the following code: df.plot.scatter(x='one', y='two, title='Scatterplot') Is there a Parameter I can send with the Statement, so it plots a Regression line and shows the…
Markus W
  • 1,451
  • 5
  • 19
  • 32
25
votes
1 answer

scatter plot in matplotlib

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 |…
bray
  • 601
  • 1
  • 9
  • 13
24
votes
2 answers

python matplotlib update scatter plot from a function

I am trying to automatically update a scatter plot. The source of my X and Y values is external, and the data is pushed automatically into my code in a non-predicted time intervals (rounds). I have only managed to plot all the data when the whole…
Yair
  • 859
  • 2
  • 12
  • 27
24
votes
2 answers

How to highlight one point in a matplotlib plot

Suppose, I have the following two lists that correspond to x- and y-coordinates. x = [1,2,3,4,5,6] y = [3,4,5,6,7,8] I want the first pair (1,3) to be in a different color or shape. How can this be done using python?
Abhinav Goel
  • 401
  • 1
  • 6
  • 13
24
votes
3 answers

MATLAB - Plot multiple data sets on a scatter plot

I have two sets of data, (Ax, Ay; Bx, By). I'd like to plot both of these data sets on a scatter plot with different colors, but I can't seem to get it to work, because it seems scatter() does not work like plot(). Is it possible to do this? I've…
Mark
  • 315
  • 3
  • 4
  • 6
24
votes
9 answers

Scatter Plots in C++

What is the best way to graph scatter plots in C++? Do you write data to a file and use another tool? Is there a library like matplotlib in Python?
oz10
  • 153,307
  • 27
  • 93
  • 128
23
votes
2 answers

3D scatter plot with color gradient

How can I create a 3D plot with a color gradient for the points? See the example below, which works for a 2D scatter plot. Edit (thanks to Chris): What I'm expecting to see from the 3D plot is a color gradient of the points ranging from red to green…
andrea.ge
  • 1,937
  • 1
  • 18
  • 27
22
votes
2 answers

Multivariate (polynomial) best fit curve in python?

How do you calculate a best fit line in python, and then plot it on a scatterplot in matplotlib? I was I calculate the linear best-fit line using Ordinary Least Squares Regression as follows: from sklearn import linear_model clf =…
Zach
  • 4,624
  • 13
  • 43
  • 60
21
votes
2 answers

How can a data ellipse be superimposed on a ggplot2 scatterplot?

I have an R function which produces 95% confidence ellipses for scatterplots. The output looks like this, having a default of 50 points for each ellipse (50 rows): [,1] [,2] [1,] 0.097733810 0.044957994 [2,] 0.084433494 …
radu
  • 241
  • 2
  • 3
  • 7