Public
Edited
Jan 30, 2024
Insert cell
Insert cell
md `
The dataset I chose to visualize was the one about titanic deaths. \n
Visualization goal: Gain insights on the data and see which factors could be indicators to help predict whether a certain passanger survived the Titanic tragedy. \n
These visualizations were developed through Observable Plot.
`
Insert cell
titanic.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
md`
The first variable I want to observe is sex. I want to see if sex can be a good indicator of whether someone survived the tragedy. For this purpose, this visualization is a histogram of survivors colored according to sex.`
Insert cell
Plot.barY(
titanic,
Plot.groupX({ y: "count" }, { x: "Survived", fill: "Sex" })
).plot({ color: { legend: true } })
Insert cell
md`
The next variables I want to explore are age and fare. I also wanted to see if there was a relationship between age and fare as well. This visualization is a scatterplot with age on the x-axis and fare on the y-axis, color-coded according to survival.
`
Insert cell
Insert cell
md`
The last factor that I think can be relevant in terms of indicating who survived or not is the class that they rode in, denoted in the dataset as 'Pclass'. I wanted to get an idea of how many people were in each class and how many within each class survived. This visualization is a hexbin heatmap with class on the x-axis and survival on the y-axis`
Insert cell
Plot
.hexagon(titanic, Plot.hexbin({fill: "count"}, {x: "Pclass", y: "Survived", symbol: "square"}))
.plot({color: {legend: true}})
Insert cell
md`
To me, there are three insights to be gained from these visualizations. \n
The first insight is that gender is an absolute indicator of whether someone survivated the Titanic tragedy. According to the first visualization, 100 percent of the survivors were female, which 100 percent of the survivors were male. \n
The second insight is fare being a possible indicator of survival. Judging from the points in the second visualization, there does not seem to be a relationship between age and fare. In addition, age does not seem to be related to survival as well. However, as you move up the y-axis, there seem to be more points that are red. This means that many of the passengers with a higher fare price survived. \n
The third insight is that first class passengers were more likely to survive than second and third class passeners. This can be seen in the third visualization, the hexbin heatmap. I originally wanted to implement something like a bar chart for the purpose of this visualization, but the assignment requires three different visualizations. I settled on the hexbin heatmap because, although it is not the prettiest as there is a lot of empty space in the visualization, a heatmap captures the information I want and allows me to draw insights from it. Among third class passengers, one can observe that a significantly higher number of them did not survive the tragedy compared to those in third class that did. Among second class passengers, little to none of the passengers survived. However, among first class passengers, only a slightly larger number of them did not survive. Admittedly, the data is a little bit skewed, since it is clear that most of the passengers were in third class. However, this visualization still gives insight on how the class can be used as an indicator of survival. If we are given that a passenger is in second or third class, we would predict that they did not surive. If the given passenger is in first class, then the chance of them surviving is roughly equal to the chance of them not surviving.
`
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