Questions tagged [scatter]

A scatter plot is a type of mathematical diagram using Cartesian coordinates to display values for two variables for a set of data.

A scatter plot is a type of mathematical diagram using Cartesian coordinates to display values for two variables for a set of data.

943 questions
3
votes
1 answer

matplotlib: how can I convert a XYZ scatter to a pixel image?

I'm looking for some way in to convert a scatter plot (X vs Y, color normalized by Z) into a 2D "pixel" image. I.e. how can I plot a pixelized image where the pixels are colored according to a third variable? In my case, I have a list of galaxies,…
aim
  • 657
  • 2
  • 12
  • 26
3
votes
1 answer

Matplotlib scatter plot marker type from dictionary

Using Matplotlib to make a scatter plot (not Seaborn, Pandas, or other high-level interface), how can I use a dictionary to specify marker types? This example works with a color dictionary: x = [4, 8, 1, 0, 2] y = [0.1, 1, 0.4, 0.8, 0.9] name =…
a11
  • 3,122
  • 4
  • 27
  • 66
3
votes
2 answers

How to make a scatter plot with two y axes (x, y1 and y2) with Python

I want to make a scatter plot graph on which I can have two axes of 'y' (axis of y1 = yield (Kg / ha) on the right; axis of y2 = area (hectare) on the left) and have on the year 'x' axis. and show the 'Trendline'. thanks in advance. crops1 =…
3
votes
1 answer

Seaborn scatterplot does not color correctly 'hue'

I am having some trouble with coloring my scatterplot markers. I have a simple dataframe with a value "pos" and two other values, "af_min" and "af_max". I want to color the markers based on some conditions for af_x and af_y, but since I don't any…
eliss
  • 69
  • 1
  • 7
3
votes
2 answers

How to plot different shades of a color for each point in a scatter plot in matplotlib?

I am trying to plot a scatter plot where each point in the scatter plot should correspond to a particular shade of a given color of my choice. The mpl documentation states that if I set something like: color = '0.7' it gives me a shade of grey with…
Megh
  • 67
  • 1
  • 1
  • 7
3
votes
1 answer

Python scatter plot with numpy-masked arrays

I'm stuck trying to mask data for a scatter plot. All data seems to plot. I'm using numpy arrays as shown in the snippet below. I'm thinking that perhaps I cannot mask on the "c" array. I can't seem to find any documentation for doing this. I'll…
Bob
  • 41
  • 1
  • 3
3
votes
1 answer

How to extract R-squared from plotly px.scatter trendline result?

how can I extract R-squared value from the following summary(): import plotly.express as px df = ... fig = px.scatter(df, x="...", y="...", trendline="ols") a = px.get_trendline_results(fig).px_fit_results.iloc[0].summary() I know how to extract…
Marzie Gh
  • 121
  • 1
  • 8
3
votes
3 answers

Python evenly scatter coordinates around fixed center based on distance

I want to scatter a lot of datapoints around a centre one (2.5,2.5) based on a given distance for each datapoint to the centre. How do I do that and also evade duplicates/scatter them evenly around the centre? Thanks in advance
Luca R
  • 197
  • 2
  • 14
3
votes
0 answers

ValueError: microsecond must be in 0..999999 When trying to plot a series using scatter plot

I get ValueError: microsecond must be in 0..999999 when I try to plot two series using scatter plot. I have two datasets(contains the posts made on a platform with the time they where created and number of comments each post receiced) the goal here…
3
votes
1 answer

How to Highlight Plottly Graph marker

plotlyDiv.on('plotly_click', function (data) { var x, y, x_axis, y_axis; data.points.map(function (d) { x = d.x; y = d.y; x_axis = d.xaxis.title.text.toLowerCase().replace(' ','_'); y_axis =…
Anoop
  • 505
  • 8
  • 23
3
votes
2 answers

How to create a scatter plot in Python with cbar

I am trying to create a scatter plot with a cbar of my data which I have stored in a .txt file. I found a piece of code here on stackoverflow and tested it to see whether it would work with my data. The example code is as follows: for record in…
Mason
  • 79
  • 7
3
votes
3 answers

Circle Plot with Color Bar

I'm trying to do a Circle Plot with a Color Bar, almost like this: However, the minimum value of the colour bar is currently 1; I would like to be able to set it to 0. import pandas as pd import matplotlib.pyplot as plt import…
R. Cox
  • 819
  • 8
  • 25
3
votes
1 answer

How to create a scatter plot with timestamps

How to produce a scatter plot using timestamps? Below is an example but I get an error ValueError: First argument must be a sequence import pandas as pd import matplotlib.pyplot as plt d = ({ 'A' : ['08:00:00','08:10:00'], 'B' : ['1','2'], …
user9410826
3
votes
1 answer

Why is Pandas inverting my x-axis order?

When I was plotting two series of data against eachother, the X axis was inverted unexpectedly. I know this question sounds pretty similar to this other: x-axis inverted unexpectedly by pandas.plot(...) and it actually is, but I want to know if this…
Una Rata
  • 31
  • 3
3
votes
1 answer

Color plotly text annotation

I have clustered xy data which I'd like to plot using R's plotly where the points are colored by their cluster membership and there's text annotating the cluster number and the fraction of the points out of the total. I'm also trying to get this…
dan
  • 6,048
  • 10
  • 57
  • 125