embed({
$schema: 'https://vega.github.io/schema/vega-lite/v4.json',
data: {
url:
'https://raw.githubusercontent.com/cienciadedados-ufcg/vis-cancoes/master/data/playlists-spotify.csv',
format: {
type: 'csv'
}
},
width: 800,
height: 300,
layer: [
{
mark: {
type: 'circle',
tooltip: true
},
encoding: {
y: {
field: 'energy',
type: 'quantitative',
title: 'Energia da música'
},
x: {
field: 'danceability',
type: 'quantitative',
title: 'Dançante'
}
}
},
{
mark: {
type: 'line',
color: 'firebrick'
},
transform: [
{
regression: 'energy',
on: 'danceability'
}
],
encoding: {
y: {
field: 'energy',
type: 'quantitative'
},
x: {
field: 'danceability',
type: 'quantitative'
}
}
}
]
})