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

Changing the background color of the axes planes of a 3D plot

On the basis of the scatterplot example of matplotlib, how can I change the gray background color of the 3 axes grid planes? I would like to set it to white, keeping the grid lines with the default gray color. I found this question but I couldn't…
user1520280
  • 665
  • 1
  • 6
  • 8
41
votes
5 answers

How to improve the label placement in scatter plot

I use matplotlib to plot a scatter chart: And label the bubble using a transparent box according to the tip at How to annotate point on a scatter automatically placed arrow Here is the code: if show_annote: for i in range(len(x)): …
bigbug
  • 55,954
  • 42
  • 77
  • 96
40
votes
2 answers

3D Scatter Plot with Colorbar

Borrowing from the example on the Matplotlib documentation page and slightly modifying the code, import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt def randrange(n, vmin, vmax): return…
JC.
  • 629
  • 3
  • 8
  • 13
40
votes
3 answers

How to change the font size and color of x-axis and y-axis label in a scatterplot with plot function in R?

I used the following code to draw a scatterplot. How to increase the font size and change colour of x-axis and y-axis label? data=read.csv("data.csv") plot(data$column1,data$column2,xlab="x axis", ylab="y axis", pch=19)
rebca
  • 1,179
  • 3
  • 10
  • 11
39
votes
5 answers

Plotting multiple scatter plots pandas

I think there are many questions on plotting multiple graphs but not specifically for this case as shown below. The pandas documentation says to 'repeat plot method' to plot multiple column groups in a single axes. However, how would this work for 3…
Amoroso
  • 945
  • 2
  • 10
  • 21
39
votes
4 answers

Adding y=x to a matplotlib scatter plot if I haven't kept track of all the data points that went in

Here's some code that does scatter plot of a number of different series using matplotlib and then adds the line y=x: import numpy as np, matplotlib.pyplot as plt, matplotlib.cm as cm, pylab nseries = 10 colors = cm.rainbow(np.linspace(0, 1,…
kuzzooroo
  • 6,788
  • 11
  • 46
  • 84
39
votes
3 answers

Superimpose scatter plots

I am using Python matplotlib. i want to superimpose scatter plots. I know how to superimpose continuous line plots with commands: >>> plt.plot(seriesX) >>> plt.plot(Xresampl) >>> plt.show() But it does not seem to work the same way with scatter. Or…
kiriloff
  • 25,609
  • 37
  • 148
  • 229
37
votes
2 answers

"Error: Continuous value supplied to discrete scale" in default data set example mtcars and ggplot2

I am trying to replicate the example here (sthda.com) using the following code: # Change point shapes and colors manually ggplot(mtcars, aes(x=wt, y=mpg, color=cyl, shape=cyl)) + geom_point() + geom_smooth(method=lm, se=FALSE, fullrange=TRUE)+ …
Katherine Hepworth
  • 375
  • 1
  • 3
  • 4
36
votes
6 answers

How to make Matplotlib scatterplots transparent as a group?

I'm making some scatterplots using Matplotlib (python 3.4.0, matplotlib 1.4.3, running on Linux Mint 17). It's easy enough to set alpha transparency for each point individually; is there any way to set them as a group, so that two overlapping points…
Jason
  • 463
  • 1
  • 4
  • 5
36
votes
1 answer

How to jitter text to avoid overlap in a ggplot2 scatterplot?

I would like to create a clean version of a scatterplot of text labels in ggplot2. The goal is to represent visually the increasing values associated with about 25 items. I am already using "position_jitter," but I wonder if I can do better. Here is…
user1257313
  • 1,057
  • 4
  • 11
  • 10
34
votes
3 answers

How to annotate point on a scatter automatically placed arrow

if I make a scatter plot with matplotlib: plt.scatter(randn(100),randn(100)) # set x, y lims plt.xlim([...]) plt.ylim([...]) I'd like to annotate a given point (x, y) with an arrow pointing to it and a label. I know this can be done with annotate,…
user248237
33
votes
3 answers

How to change spot edge colors in seaborn scatter plots

I have created a scatter plot using seaborn: import seaborn as sns sns.set(style="ticks", color_codes=True) g=sns.scatterplot(x="length", y="coverage", data=df, hue = 'Products', edgecolors=None, alpha =…
Steve Xu
  • 489
  • 1
  • 7
  • 12
33
votes
3 answers

Specify color of each point in 3d scatter plot

I have a 3D Plot that I created using matplotlib, and I have a list of rbg values that correspond to each point. I have the X, Y, and Z data, and then I have a "color list" of the form: [ (r,g,b), (r,g,b), ... , (r,g,b) ] to match each (x, y, z)…
codycrossley
  • 571
  • 1
  • 6
  • 17
30
votes
3 answers

Make contour of scatter

In python, If I have a set of data x, y, z I can make a scatter with import matplotlib.pyplot as plt plt.scatter(x,y,c=z) How I can get a plt.contourf(x,y,z) of the scatter ?
JuanPablo
  • 23,792
  • 39
  • 118
  • 164
29
votes
2 answers

Fixing color in scatter plots in matplotlib

I want to fix the color range on multiple scatter plots and add in a colorbar to each plot (which will be the same in each figure). Essentially, I'm fixing all aspects of the axes and colorspace etc. so that the plots are directly comparable by…
AllenH
  • 577
  • 1
  • 4
  • 13