Plot.plot({
width: 800,
color: {
legend: true,
scheme: "Cool"
},
x: {
label: "Population ",
domain: [-10000,90000000 ]
},
y: {
label: "GDP per Capita",
grid: true,
domain: [0,190000],
tickRotate: 30
},
marks: [
Plot.dot(data1, {
x: "pop",
y: "gdpPerCapita",
r: "gdpPerCapita",
fill: "gdpPerCapita",
fillOpacity: 0.9,
marginLeft: 100,
}),
Plot.linearRegressionY(data1, {
x: "pop",
y: "gdpPerCapita",
stroke: "steelblue",
ci: 0.95,
}),
Plot.text(data1,
{
x: "pop",
y: "gdpPerCapita",
text: d=> d["gdpPerCapita"]> 100000? d["country"] : "",
fontSize: 10,
fill: "blue"
})
]
})