Public
Edited
Nov 22, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
csv = FileAttachment("MarnArtworksSelection.csv").csv()
Insert cell
Insert cell
Insert cell
MarnArtworksSelection.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
keys = csv.columns
Insert cell
Insert cell
Insert cell
classificationsFromCSV = new Set(csv.map(d => d.Classification))
Insert cell
Insert cell
mediumsFromCSV = new Set (csv.map(d => d.Medium))
Insert cell
Insert cell
gendersFromCSV = new Set (csv.map(d => d.Gender))
Insert cell
Insert cell
acquisitionsDateFromCSV = new Set (csv.map(d => d.AcquisitionDate))
Insert cell
Insert cell
data = csv.map(d => {
var gender = "";
if(d.Gender) {
if (d.Gender.includes("Male") && d.Gender.includes("Female"))
gender = "Multiple"
else if (d.Gender.includes("Male"))
gender = "Masculin"
else if (d.Gender.includes("Female"))
gender = "Féminin"
else
gender = "Inconnu"
};
return {
title: d.Title,
artist: d.ArtistName,
nationality: d.Nationality,
birthDate: d.BirthDate,
deathDate: d.DeathDate,
gender: d.Gender ? gender : "Inconnu",
medium: d.Medium,
classification: d.Classification,
department: d.Department,
acquisitionDate: d.AcquisitionDate ? Number(d.AcquisitionDate.substring(0, 4)) : '',
date: d.Date ? Number(d.Date.substring(0, 4)) : '',
// date: d.Date
}
})//.filter(d => d.acquisitionDate !== "" && d.date !== "")
Insert cell
Insert cell
Insert cell
Plot.plot({
height: 400,
width: 900,
marginLeft: 150,
marginRight: 20,
marginTop: 50,
marginBottom: 80,
x: {label: "Quantités"},
y: {label: "Artistes"},
marks: [
Plot.barX(
data,
Plot.groupY(
{x: "count"},
{y: "artist", fill:"gender", tip: true, sort: {y: "x", reverse: true, limit: 15}}
)
),
Plot.ruleX([0])
],
color:{
domain: ["Féminin", "Inconnu", "Masculin", "Multiple"],
scheme: "Set2",
legend: true
},
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
categories = new Set(data.map(d => d.classification))
Insert cell
Plot.plot({
width: 900,
marginLeft: 180,
marginRight: 20,
marginTop: 50,
marginBottom: 80,
x: {
label: "Quantités",
grid: true,
},
y: {
label: "Catégories"
},
marks: [
Plot.barX(
data,
Plot.groupY(
{x: "count"},
{y: "classification", tip: true, sort: {y: "x", reverse: true}}
)
),
Plot.ruleX([0]),
],
color:{
scheme: "Set2",
legend: true
},
})
Insert cell
Insert cell
Insert cell
Insert cell
acquisitionYears = Array.from(new Set(data.map(d => d.acquisitionDate))).sort()
Insert cell
nbYears = acquisitionYears.length
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
height: 650,
width: 900,
marginLeft: 50,
marginRight: 20,
marginTop: 50,
marginBottom: 80,
x: {
label: "Dates d’acquisition",
domain: [2000, 2023],
tickFormat: d => d.toString().substr(0, 4),
tickRotate: -45,
},
y: {
label: "Quantités",
grid: true
},
marks: [
Plot.rectY(
data,
Plot.binX(
{y: "count"},
{x: "acquisitionDate", fill: "classification", tip: true})
)
],
color: {
scheme: "Set2",
legend: true
}
})
Insert cell
Insert cell
Plot.plot({
width: 900,
height: 900,
marginLeft: 50,
marginRight: 20,
marginTop: 50,
marginBottom: 50,
y: {
label: "Dates d’acquisition",
domain: [2002, 2023],
tickFormat: d => d.toString().substr(0, 4),
},
x: {
label: "Dates de production",
domain: [1900, 2023],
tickFormat: d => d.toString().substr(0, 4),
tickRotate: -45,
},
marks: [
Plot.dot(
data,
Plot.bin({r: "count"},
{x: "date", y: "acquisitionDate", thresholds: 60, tip: true},),
),
Plot.linearRegressionX(data, {x: "date", y: "acquisitionDate", stroke: "red"}),
Plot.crosshairX(data, {x: "date", y: "acquisitionDate"})
],
color: {
legend: true,
scheme: "Set2",
range: ["blue"]
}
})
Insert cell
Insert cell
categoriesinfomuse = FileAttachment("categoriesInfomuse.json").json()
Insert cell
categoriesMuseum = new Set(data.map(d => d.classification))
Insert cell
import {toc} from "@lenamk/toc"

Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more