jackman.stanford.edu/blog
• 113th U.S. Senate
• ideal point estimates pdf csv 7/31/14
• scatterplot against 2012 Obama vote share pdf
• roll call object: RData
• 113th U.S. House
• ideal point estimates svg pdf csv 8/4/14
• scatterplot vs Obama vote share svg pdf
• roll call object: RData
• Bayesian Analysis for the Social Sciences Wiley; Amazon; errata as of 5/23/13

## Monday August 18, 2014

Filed under: computing,R,statistics,type — jackman @ 6:00 am

One of the very exciting and promising developments from RStudio is the rmarkdown/shiny/ggvis combination of tools.

We’re on the verge of static graphs and presentations being as old-fashioned as overhead transparencies.

I’ve spent the last couple of days giving these tools a test spin. Lots of comments and links to examples appear below.

I came to this investigation with a specific question in mind: how can I get a good-looking scatterplot with some rollover/tooltip functionality into a presentation, with one tool or one workflow?

Soft constraints: I’d prefer to use R, at least on the data side, and I would also like customization over look and feel (e.g, slide transitions), stylistic elements like type, color, sizes and spacing.

I use either Beamer or Keynote for presentations (Beamer for teaching/stats-type talks, Keynote for more substantive, general audience talks).   I began by investigating how one might drop a d3-rendered graph into a Keynote presentation, but this seems pretty hard.   Hacking at the files produced by Keynote’s export-to-HTML function seems formidable.

I’ve also been poking at solutions that are all on the JS side of the ledger (e.g., d3 + stack), inspired by this example from Karl Broman. I’m also interested in how one might roll an interactive graphic into Prezi.

But back to the RStudio workflow, using the rmarkdown/shiny/ggvis combination.  Here is some sample output I’ve created: a standalone scatterplot and a dummy presentation.

Some observations:

• Building shiny server for OS X was pretty easy.   Nic Ducheneaut has a set of instructions that worked just fine.  One slight wrinkle is that I had to manually make a symbolic link to the pandoc executable – at /usr/local/bin/pandoc on my system – from the /usr/local/shiny-server/ext/pandoc directory.
• ggvis sits on top of vega which sits on top of d3.   It is rapidly evolving but extremely promising.   In about 15 minutes I had a learned enough shiny and ggvis to make a scatterplot with respectable tooltip functionality.  Fine-tuning graphical elements took considerably longer and a lot more code: ggvis is still young, rapidly evolving and you are warned not to use it for production yet.  I’d agree.  Trying to get finer control over graphical elements did reveal some of the alpha-ness of ggvis at this stage.  An example of what I was able to make appears here.
• ggvis rollover/tooltip behavior doesn’t seem to be as responsive/reliable/predictable as d3.   It is almost as if ggvis/vega can’t resolve individual points in dense regions of a scatterplot.   I don’t know why.  Comparison: ggvis/shiny and d3.
• Deploying/embedding ggvis/shiny in markdown is straightforward.  I found myself using the ioslides_presentation format for output.
• It seems that you’re supposed to be using Chrome’s (full-screen) presentation mode when you present, serving the pages from localhost or a (local/remote) shiny server.   My explorations revealed subtle differences between Safari and Chrome on padding, margins, etc.   That’s almost surely more to do with “web standards compliance” being a little wobbly between browsers than anything on the RStudio side.   ioslides is a Google creation, so better to stay with Chrome.
• shiny itself seems a little buggy.   RStudio’s browser sometimes just refused to start, or starts slowly.   “Open in Browser” sometimes simply refuses to work.   Until it does.   I suspect I should not have Safari as my default browser. I also suspect a conflict if you are simultaneously running an instance of shiny server locally.
• The reveal.js format looked promising, but seems to produce broken output.
• I noticed an odd quirk with widgets, which I reproduce here. For instance, this slider for bandwidth adjustment didn’t display properly out of the box.   Just one number on the right of the slider appeared on start-up (the current value), then after sliding, the minimum appears on the left, but the current value still appears on the right. Toggling Chrome into presentation mode (which will be the typical usage) seemed to fix things, as did hitting “Inspect element”. I recall being able to repeat this with different output formats, so I don’t think this is necessarily an ioslides issue.
• The previous example also reveals some text encoding weirdness, the apostrophe in “don’t” is dropped on the title slide.
• Presentations can be served from a (remote) shiny server: simply call the Markdown file index.Rmd, place that and other files in an appropriately named subdir under your shiny server’s file hierarchy, and away you go.  Indeed, RStudio has its own deployment and hosting service, shinyapps.io.
• Shiny uses bootstrap’s grid layout which I had to learn a little about to get some control over the size of the ggvis on the slide, but I was still very unsatisfied with my ability to control the size of a graph on the slide.
• I’m yet to play with tables or MathJax.
• I found customization pure agony.   Suppose you don’t want Helvetica or Open Sans on a white background.  Writing your own CSS seems the most sensible way to deal with this, but this involved tons of “Inspect Element” on the resulting HTML, tweaking the requisite CSS, re-compile, repeat…   Not fun.   Shiny graphics have their own CSS from bootstrap.  This is customizable too, at least in theory, but I was running of time and energy at that point.
• “woff”.  This was a nice gotcha, nothing to do with RStudio packages per se, but I thought I’d remind myself about this with a note here.  If you deploy your own web fonts via some custom CSS, keep in mind that shiny server runs from port 3838.   On my web server I put web fonts in a standard place where I can point back from various apps and services via CSS, typically with a fully-qualified URL.   But then you’ll run into cross-domain access issues as your web server (on port 80 or 443 etc) is being asked to serve web fonts to what appears to be a remote server (shiny server from 3838).   You’ll need to create a .htaccess file in the subdirectory containing the web fonts, granting access to the shiny-server, or else serve the web fonts out of the local directory where the application lives.  This is “an oldie but a goodie” in the webfont world, apparently.  Some details here.

If you’re happy with the out-of-the-box style defaults, then this stack of tools is just about there and evolving rapidly. And keep in mind that rmarkdown does a lot more than make presentations. For instance, I’m yet to really explore rmarkdown for producing publish-to-web papers.

If you crave fine control over layout and graphical elements, then I think it might still be a d3/js world, at least for a while longer.

I’m still left thinking that if I could drop shiny apps or d3 into Keynote (somehow), then I’d have the best of both worlds.

## Tuesday March 6, 2012

Filed under: flight nerdery,type — jackman @ 11:32 am

Awful. So we get some nicer planes on UAL from CO (738s, in seat-power in Economy Plus). But the UAL web site looked at least half-decent.

My quick sense is that they’ve imported a lot of elements from the CO site, and it looks awful, IMHO, at least compared to the old UAL site.

How many different typefaces have been jammed onto this page? And images? Even the word “United” appears in FOUR different typefaces.

Screenshot below (click to open up thumbnail), with my personal details blocked out:

## Sunday February 19, 2012

Filed under: Australian Politics,type — jackman @ 5:00 am

Perhaps the most garish web site I visit, the Sydney Morning Herald. I like their iPad app, but this has long been awful and could be getting worse.

Screen-grab, click for PNG in new window:

## Friday July 8, 2011

Filed under: type — jackman @ 4:37 pm

Latest bunch of Futura-laden design and hold-in-your-hands goodness…from the Field Notes gang at Coudal. Clickable thumbnails below…

## Thursday June 2, 2011

Filed under: Australian Politics,R,statistics,type — jackman @ 7:00 am

With Lynn Vavreck at UCLA, I ran parallel public opinion surveys in Australia and the United States, measuring attitudes on security, the fight against terrorism, the wars in Afghanistan etc, some 10 years after the 9/11 attacks.

Full report here (generated with Sweave, xelatex, etc).

## Sunday April 17, 2011

Filed under: type — jackman @ 8:18 pm

I can’t resist this stuff.

## Tuesday April 12, 2011

Filed under: flight nerdery,type — jackman @ 3:00 pm

And the new, new post-merger United logo has been on the company’s web site for a while now, and is starting to appear on fleet livery as well.

It looks way better than the first proposal, which used the Continental typeface for the word “United”, which looked just plain bad.

This newer effort — slabby, sans-serif, all caps — does convey the authority and purposefulness implicit in the word “United”, and is less radical a departure from previous United logos. My best guess (below) as to the typeface is Trade Gothic Extended, heavied up and with some extra kerning (and I added a hint of drop shadow).

## Monday April 11, 2011

Filed under: flight nerdery,type — jackman @ 3:00 pm

A UAL employee at RDU told me that with the Continental merger and logo change, that they had been given the last batch of boarding pass envelopes etc (of course, another hypothesis is that they are going to do away with this stuff altogether).

She handed me the boarding pass envelope (scanned above) and told me to hang on to it, “You won’t be seeing anymore of these…”

## Friday November 12, 2010

Filed under: type — jackman @ 10:26 pm

From Ed Tufte, of whom I am insanely jealous…

I’m auctioning my library of rare books, which includes most all of the statistical graphics and epidemiology classics at Christie’s in New York on December 2. This includes Minard maps, nearly all the Playfairs, and all the books used in my 4 books about analytical thinking and design.

Here’s the electronic link to the catalog:

http://www.christies.com/calendar/index.aspx?month=12&year=2010&scids=13

and then click on “ecatalogue”.

Tufte then goes on to give his account of the auction:

Great books foster, transmit, and preserve forever knowledge. The books in my research library were always meant to be used: read, skimmed, read aloud, exhibited, photographed, shared, treasured. And thus my library, which I thought of as The Museum of Cognitive Art, participated intensely in my research, scholarship, writing, teaching, design. For 30 years, the everyday presence of these wonderful books in my life was inspiring and challenging.

I sought to write, design, and publish books worthy of my research library: The Visual Display of Quantitative Information (1983, 2001), Envisioning Information (1990), Visual Explanations (1997), and Beautiful Evidence (2006).

The collection articulated my interests and needs in making my books abut analytical thinking, seeing, showing: high science (Galileo, Huygens, Newton, Lambert), high art (Dürer, Dufy, Picasso, Ernst, Derain, Albers), practical science (history of perspective, dance notation, magic, aviation, and landscape architecture especially Repton), the history of statistical graphics (nearly all of William Playfair’s books, Marey, Minard), epidemiology (Graunt, John Snow), mapping (Halley, Minard), illustrated books (fish, birds, and whatever), and the classics of book design (Hypnerotomachia, Byrnes’ color Euclid, Eric Gill, Bruce Rogers, John Henry Nash, and books published by Giovanni Mardersteig’s Officina Bodoni press). Their time past became my time present and time future.

This diverse and quirky collection found a certain unity in my own books. The relation between my work and the research library is described in several catalog entries.

With this auction, my research library will turn into open-space land (in perpetuity) for making and exhibiting my landscape sculpture and into a museum and gallery, ET Modern, in New York’s Chelsea art district.

Of course, there’s another book (Seeing Around, 2013?) underway as well. There always is.

Edward Tufte

## Thursday October 7, 2010

Filed under: type — jackman @ 11:54 pm

The new Gap logo. Freaking ridiculous. I am sure they tested the shit out of it, but bold Helvetica…? In 2010?

Join Apple Ipad/iPhone (which has actually switched to Helvetica Neue), American Airlines, American Apparel, IRS forms, Target, Crate and Barrel, YouGov (which I think is actually Arial) etc etc, making a bland brand all that more so…

Next Page »