# Penguin Data Viz
This is an exercise based on the Observable livestream with [**Lunch in the D3 Kitchen: Penguin Dataviz**](https://observablehq.com/@observablehq/lunch-the-d3-kitchen-penguin-dataviz). It was helmed by Ian Johnson and Anjana Vakil on August 18, 2020. I built this Notebook while following along with their instructions, based on the principle that the best way to learn both Observable and D3 is by doing, so here we are. I have added some little things such as the style change to move away from the default serif font used by Observable.
# Fetch the data
We can grab the data from the github repository: penguins.csv a simplified version of the original dataset penguins_raw.csv. We are going to make use of a couple of utilities in the D3 library:
1. d3.csv -- A utility that allows us sot retrieve the csv file via the url
2. d3.autoType -- Another utility that parses the data appropriately ensuring it is placed in an array and that the various objects have the correct designations. You have to be careful with the arbitrary use, but csv formatted files are typically clean and well laid out.
3. d3.select -- Another utility that returns a selection of one or more DOM nodes.
# Drawing with SVG
When you start with data visualizations you need to start by putting something on the page and making incremental changes to the visualization, as opposed to writing out all of the code, then realising there is an error when the image or chart does not display and then struggling to find the error that is causing the problem.
To start, we will create a point/circle for every object (i.e., row) in our dataset.
[Additional information on SVG](https://developer.mozilla.org/en-US/docs/Web/SVG) - https://developer.mozilla.org/en-US/docs/Web/SVG
SVG is basically HTML, a native browser API for drawing with DOM elements. Consequently, anyway you would write HTML such as using `div` and `<p>`, so you just need to put it in an svg environment.
1. Give the svg a width and height to create the environment. Note that Observable has a built in width environment to ensure that the work you are doing plays nicely with the Observable notebook. The height will then need to be defined separately (see Appendix).
2. Canvas is an alternative for drawing certain things in the HTML environment.
3. First we draw a single circle by hand. D3 then comes in an automates the process.
4. There is a `<circle>`tag that can be used in svg with properties that can be modified, such as radius and the position on the drawing palette (the svg tags create a type of drawing environment.
5. We need to then create a render function