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

Fill area between two curves in python

I am trying to shade the area between two curves that I have plotted. This is what I plotted. Using the following code. plt.scatter(z1,y1, s = 0.5, color = 'blue') plt.scatter(z2,y2, s = 0.5, color = 'orange') I tried using plt.fill_between() but…
Susan-l3p
  • 157
  • 1
  • 13
8
votes
4 answers

Seaborn Jointplot add colors for each class

I want to plot the correlation plot of 2 variables using seaborn jointplot. I have tried a lot of different things but I am not able to add colors to the points according to class. Here is my code: import numpy as np import seaborn as sns import…
seralouk
  • 30,938
  • 9
  • 118
  • 133
8
votes
1 answer

How to convert an image into point data for ggplot2 scatterplot

I recently found a package on Github where the dev analyzed fan-curated data on the 248 installments of the Spy vs Spy comic by Antonio Prohias appearing in Mad Magazine. He goes through some basic exploratory data analysis, computes a running net…
8
votes
2 answers

Adding legend based on existing color series

I plotted some data using scatter plot and specified it as such: plt.scatter(rna.data['x'], rna.data['y'], s=size, c=rna.data['colors'], edgecolors='none') and the rna.data object is a pandas dataframe that is organized such…
Vince
  • 305
  • 1
  • 3
  • 7
8
votes
2 answers

Match legend text color with symbol in scatter plot

I made a scatter plot with 3 different colors and I want to match the color of the symbol and the text in the legend. A nice solution exist for the case of line plots: leg = ax.legend() # change the font colors to match the line colors: for…
Phyinmi
  • 450
  • 7
  • 15
8
votes
3 answers

Scatter plotting pandas DataFrame with categorically labeled rows/columns

I would like to produce a scatter plot of pandas DataFrame with categorical row and column labels using matplotlib. A sample DataFrame looks like this: import pandas as pd df = pd.DataFrame({"a": [1,2], "b": [3,4]}, index=["c","d"]) # a b #c 1 …
DYZ
  • 55,249
  • 10
  • 64
  • 93
8
votes
3 answers

scatter plot with single pixel marker in matplotlib

I am trying to plot a large dataset with a scatter plot. I want to use matplotlib to plot it with single pixel marker. It seems to have been solved. https://github.com/matplotlib/matplotlib/pull/695 But I cannot find a mention of how to get a…
user2532296
  • 828
  • 1
  • 10
  • 27
8
votes
2 answers

How to create multiple series scatter plot with connected points using seaborn?

I have a set of data stored in a pandas dataframe. I'm trying to use seaborn's pointplot() to create a multiple-series scatter plot with connected points. Each series has different (x,y) values, and they are stored as floats in my data frame. Each…
mark s.
  • 656
  • 2
  • 7
  • 14
8
votes
2 answers

Equal distance among all points on an axis

I am trying to plot a simple scatter plot like this: The minimal code I am using for generating this plot is as follows: ggplot(fig1c, aes(x=xvar, y=yvar)) + scale_x_log10(breaks=unique(fig1c$xvar)) + scale_y_continuous(breaks=seq(0, 10,…
lukas
  • 349
  • 4
  • 13
8
votes
1 answer

matplotlib 3D scatterplot with marker color corresponding to RGB values

I have loaded a picture into a numpy array using mahotas. import mahotas img = mahotas.imread('test.jpg') Each pixel in img is represented by an array of RGB values: img[1,1] = [254, 200, 189] I have made a 3D scatterplot of R values on one axis,…
Flux Capacitor
  • 1,215
  • 5
  • 24
  • 40
8
votes
1 answer

Extracting data from a scatter plot in Matplotlib

I'm writing an interface to do scatter plots in Matplotlib, and I'd like to be able to access the data from a python script. Right now, my interface is doing: scat = self.axes.scatter(x_data, y_data, label=label, s=size) With a standard axes.plot I…
gjenness
  • 373
  • 1
  • 3
  • 6
8
votes
4 answers

Align matplotlib scatter marker left and or right

I am using the matplotlib scatterplot function to create the appearance of handles on vertical lines to delineate certain parts of a graph. However, in order to make them look correct, I need to be able to align the scatter plot marker to the left…
benjaminmgross
  • 2,052
  • 1
  • 24
  • 29
8
votes
1 answer

Updating the positions and colors of pyplot.scatter

I have been struggling with this for a while and can't get it to work. I am reading a file in chunks and scatter plotting data from it, and I would like to "animate" it by updating the scatter plot for each chunk in a for loop (and also adapt it to…
endolith
  • 25,479
  • 34
  • 128
  • 192
8
votes
1 answer

Why does my linear regression fit line look wrong?

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…
8
votes
2 answers

Change ylab position in R Scatterplot3D

I´m working with R scatterplot3D and I need to use expression() in labels because I have to use some Greek letters; my question is: is there a way to pull the y.lab name down or write it along the axis (in a diagonal position)? I went to help and…
Maria D
  • 113
  • 2
  • 5