bsmall2 Learning Racket

f

Two articles ( -1 -2) about Corona Virus taught be about Infection Reproduction Numbers and Case Fatality Rates. But the graphic for one reminded me of Edward Tufte's Visual Explanations and its criticism of “pop journalism.” ( -3) The offending graphic ( -4) made me think of Howard Wainer's advice about ordering data also. Racket's sort lets us implement the advice with one-line of code.

Plain Plot for Seven Disease Reproduction Numbers

The reproduction numbers for these seven diseases are simple enough to provide good visualization practice. This might be a good case study to ease into Racket Plot coding and Data Visualization.

DrRacket Screenshot The code is below.

もっと読む…

A Theodorus spiral with plot instead of turtles. The coding went quickly because it was easy to translate into Racket the math from Python code.

Spiral Plot with Vectors

Read more...

Last week's talk about a local poet reminded me of I.A. Richards. I read that he used to put a poem on a slide up before large groups of people. William Empson may have written a poem about the slides.

Yeats King and No King slide

I like the simple slides, maybe I'll use them to contemplate poetry while staring at a screen. On the other hand commercial presentation software ( PP ) seems too flashy.

Yeats The Witch Slide

The loud colors distract from contemplation on the poem. If putting poems up on a screen can be constructive, a simple way to see simple slides may be useful.

Using DrRacket to show poems in the tradition of I.A. Richards seems appropriate. As learners of poetry and programming we want grounds to approach an “overwhelming sense of correctness” (fn:1) ... to reach a judgment that we can have confidence with.

Read more...

Plotting tables with DrRacket has been teaching me a lot. It felt wrong to go out of DrRacket and into the shell just to montage (ImageMagick) the row-based and column-based plots together. Racket features plot-pict so it seemed like the right time to start learning the pict library.(fn:1) With picts I was able to vc-append a gray separator between the two plots, and to add pip-arrows-lines to point out connections between the two views.

plot picts with connecting pip arrow lines

The plots I work with can become long images. Long picts are awkward to work with in DrRacket. I could only scale to the top, and could not check the lower part of the plot. Enclosing the pict code withpict->bitmap makes iterative development smoother. A bitmap is much easier to scroll in DrRacket.

It took a few attempts to learn how to save the pict->bitmap images to file. I was looking for a basic Scheme-like approach with open-output-file or with-output-to-file but nothing worked. The task of saving plot-pict bitmaps as png files has become my introduction to objects in Racket. You send an object a method and arguments. It didn't make sense to me until reading the ambiguous sentence I just typed. With send you don't send the very next expression somehwere, you send the following expressions to the next expression. So send's second argument (if you see send as a typical Racketfunction) is what gets the rest of the arguments.

Read more...

The visualizations might be ready to print out and think about.

After putting a table of data into R-style, “long form” lists, Racket's group-by and sort allows for creative labeling and ordering. The hours spent with R/ggplot2 got me ready for “pilfering” ideas into Racket. (fn:2)

Harada水俣病p11 Original Table

Working with this table of fisheries data made it easy to appreciate functional programming with sort. You are free to create a function that will sort, or order, the data. It's simple to adhere to Howard Wainer's rules for “table construction.”(fn:1)

Harada 水俣病p11 longform rows plot

Read more...

データ表の視覚化で何を気づくかな?「 一本釣漁業」と「囲刺網漁業」はなぜ増えたのかな? カニも54年に増えたみたい(fn:2)。それは生態系の理由か経済的な理由か? カニの天敵が減たやろうか、悪影響が出るまで餌が増えたか、 それか、 遠いところから人がカニを水俣に持って来ただろうか?

元の表は原田正純「水俣病」(岩波新書)12ページにあった。

Read more...

Working with a table full of data worthy of attention is great for keeping focus. Getting data into “long form” as is done with R might not be necessary with Racket, at least not with the simple data I work with for visualizations. The code for this visualization was getting too complex for a few days, I had to go back and get the data into a convenient form. Racket's ->plot-label *number* *digits* makes it easy to arrange for helpful labels.

(“1954” (“mullet” 54453.75 90.75625000000001)

Fishery Decline 1950 - 1956

Read more...

アンケートのデータ表を視覚化した。 データ表の視覚化の図グラフ

Read more...

English Version of Employment Data Plot

(sort labels #:key row-sum >)

In Understanding Graphs and Tables Howard Wainer advises:

Order the rows and columns in a way that makes sense. We are almost never interested in “Austria First.” Two useful ways to order the data are:

a. Size places-Put the largest first. Often we look most carefully at what is on top and less carefully further down. Put the biggest thing first! Also, ordering by some aspect of the data often reflects ordering by some hidden variable that can be inferred. b. Naturally – Time is ordered from the past to the future. Showing data in that order melds well with what the viewer might expect. This is always a good idea.

— Howard Wainer (fn:1)

Howard Wainer's advice came to mind while working with data from a book about Minamata Disease (and pollution or Damage to the Commons in general).

Ui Jun's book and bsmall2's computer

The code to visualize Jun Ui's table of employment data is an attempt to implement Howard Wainer's advice (and general ink-to-data ratio advice for data visualization) with free software: DrRacket and Racket Plot.

Screenshot of Org-mode table in html with English version plot

As always, the code and data are below.

Read more...

Getting information from a table is like extracting sunlight from a cucumber. (Farquhar & Farquhar, 1891) (fn:3)

Working with data from Minamata Disease materials seems like a worthy way to learn Racket and Data Visualization. I see graphs of chemical production from the factory that I would like to merge with the fishery depletion data. The units are Kan貫: 3.75kg or 8.6lb. If there is a need, I'll have to translate the fish names and units for an English version.

原田正純水俣病p.11 魚類別漁獲高調査表2

Hopefully the “Reproducible Research” approach will become common practice everywhere. It would be nice to have tables of data for every visualization we see, it seems like a responsible approach.

It takes a certain sort of focus and patience to create a visualization, but I think the work makes the data tables more meaningful. It's hard to keep your attention on this sort of reading. Maybe visualizations could help. Now I have to print these visualizations out and write essays for them. If the plots help create decent, useful writing they will have served a purpose.

books and laptop for data visualization

As always the code and data are below, Reproducible Research!!

Read more...