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
15
votes
3 answers

add x=y line to scatterplot

I am using the scatterplot function from the car package to generate a scatterplot. I want to be able to generate a reference line in the plot that should be x=y. I tried using abline and it does add a line but it is not the x=y line. Can someone…
CadisEtRama
  • 1,071
  • 5
  • 18
  • 31
14
votes
1 answer

How to move legend to outside of a seaborn scatterplot?

import matplotlib.pyplot as plt import seaborn as sns import pandas as pd sns.set(style="darkgrid") g = sns.scatterplot(x="Area", y="Rent/Sqft", hue="region", style="availability", data=df) When I run this I get the below plot. I want to move the…
Vinay
  • 1,149
  • 3
  • 16
  • 28
14
votes
1 answer

Reading objects from shiny output object not allowed?

I'm trying to write a little app that will allow the user to make a scatterplot, select a subset of points on the plot, then output a table in .csv format with just those selected points. I figured out how to get the page up and running and how to…
KrisF
  • 143
  • 1
  • 1
  • 5
14
votes
2 answers

Using colormap with bokeh scatter

In matplotlib the scatterplot offers the possibility of using the color of a plot to indicate value or magnitude like this plot: For bokeh, similar examples seem to manually generate the rgb colors, which makes it difficult to produce plots with…
M.T
  • 4,917
  • 4
  • 33
  • 52
14
votes
3 answers

Scatterplot with different size, marker, and color from pandas dataframe

I am trying to do a scatter plot with speed over meters for each point where marker indicate different types, size indicate different weights and color indicate how old a point is over 10 minutes scale. However, I was only able to plot by size so…
Kexin Xu
  • 691
  • 3
  • 10
  • 20
14
votes
3 answers

Nonparametric quantile regression curves to scatterplot

I created a scatterplot (multiple groups GRP) with IV=time, DV=concentration. I wanted to add the quantile regression curves (0.025,0.05,0.5,0.95,0.975) to my plot. And by the way, this is what I did to create the scatter-plot: attach(E) ## E is…
shirleywu
  • 674
  • 10
  • 23
13
votes
3 answers

scatterplot instead of a lineplot while using the plotfile function of matplotlib

I know the general usage of plotfile: import matplotlib.pyplot as plt plt.plotfile(csvfile,sometuple) But this produces a line plot by default. I want a scatterplot. Is there some special argument that i need to pass to this method? I have already…
DevilFi5h
  • 163
  • 1
  • 1
  • 5
13
votes
2 answers

Plotting circles with no fill, colour & size depending on variables using scatter

The information I have to show on a plot are 2 coordinates: size & colour (no fill). The colour is important as I need a colormap type of graph to display the information depending on a colour value. I went about trying two different ways of doing…
Raket Makhim
  • 147
  • 1
  • 2
  • 9
13
votes
1 answer

Pandas - scatter matrix set title

I'm searching for a way to set a title to Pandas scatter matrix: from pandas.tools.plotting import scatter_matrix scatter_matrix(data, alpha=0.5,diagonal='kde') I tried plt.title('scatter-matrix') but it creates a new figure. Any help is…
J.To
  • 251
  • 2
  • 4
  • 10
13
votes
1 answer

matplotlib scatter plot with different markers and colors

I would like to make a plot with different markers and different colors according to the values of 2 external vectors. Here what I have tried: >>> s = [u'+', u'+', u'o'] >>> col = ['r','r','g'] >>> x = np.array([1,2,3]) >>> y =…
Donbeo
  • 17,067
  • 37
  • 114
  • 188
13
votes
2 answers

Using D3 transition method with data for scatter plot

So I'm new to D3 and have little exp with JavaScript in general. So I have been following some tutorials am currently using source code that creates a basic scatter plot. Now my question is how do I use the transition() method to moves the circles…
Travis Shanks
  • 137
  • 1
  • 2
  • 5
13
votes
2 answers

How to reproduce smoothScatter's outlier plotting in ggplot?

I am trying to get something like what the smoothScatter function does, only in ggplot. I have figured out everything except for plotting the N most sparse points. Can anyone help me with this? library(grDevices) library(ggplot2) # Make two new…
Ryan C. Thompson
  • 40,856
  • 28
  • 97
  • 159
12
votes
3 answers

Plotly: Create a Scatter with categorical x-axis jitter and multi level axis

I would like to make a graph with a multi-level x axis like in the following picture: import plotly.graph_objects as go fig = go.Figure() fig.add_trace( go.Scatter( x = [df['x'], df['x1']], y = df['y'], mode='markers' ) ) But also…
Daniel Zapata
  • 812
  • 3
  • 9
  • 31
12
votes
1 answer

Specify color points depending on conditions

I have two numpy arrays, x and y, with 7000 elements each. I want to make a scatter plot of them giving each point a different color depending on these conditions: -BLACK if x[i]<10. -RED if x[i]>=10 and y[i]<=-0.5 -BLUE if x[i]>=10 and y[i]>-0.5…
Argumanez
  • 123
  • 1
  • 1
  • 7
12
votes
4 answers

Logarithmic grid for plot with 'ggplot2'

I am trying to create a plot with logarithmically spaced grids using ggplot2 just like in the below figure. I get equidistant grids, but not log spaced ones. I know I am missing some parameter which I don't seem to get as of now. I have seen a lot…
pravi
  • 2,029
  • 3
  • 13
  • 9