Skip to content

Scatter Plot

You can use scatterplot

Basics

Example below renders scatterplot comparing book wordcount and it's rating. It also adds interactive labels on hover so you know which book title point corresponds to. We also set minimum for y axis to 1 (as this is minimal rating book can get) and x axis to log2 scale.

TitleWordcountRating
War and Peace5870004.1
Don Quixote3450004.2
Les Misérables5310004.4
The Count of Monte Cristo3750004.6
Anna Karenina3490004.3
Crime and Punishment2110004.2
Pride and Prejudice1220004.5
Moby Dick2060003.9
Great Expectations1830004.0
Jane Eyre1830004.4
The Brothers Karamazov3640004.3
Middlemarch3160004.0
The Great Gatsby470004.2
Wuthering Heights1070004.1
One Hundred Years of Solitude1440004.3
To Kill a Mockingbird1000004.6
The Odyssey1230004.0
The Divine Comedy1120004.1
The Picture of Dorian Gray780004.2
sqlseal
TABLE d = table(0)
CHART {
	xAxis: {
		type: 'log',
		logBase: '2'
	},
	yAxis: {
		min: 1
	},
	tooltip: { },
	series: [{
		type: 'scatter',
		symbolSize: 5,
		encode: {
			x: 'wordcount',
			y: 'rating',
			tooltip: 'title'
		}
	}]
}
SELECT * FROM d

scatter plot

Advanced Functionality

With scatter plot you can perform even more advanced functionality like drawing regression line or running clustering algorithms. Check out advanced section of the documentation for more details on that.