Save ggplot Graphics at Intended End-use Dimensions and Resolutions for Best Results

Users of ggplot2 often run into issues with their saved graphics not having the expected resolution or font sizes.

By default, when using RStudio, ggsave() saves graphics at the last dimensions of the plot preview pane and at screen resolution. As a demo, try


ggplot(mtcars, aes(hp, mpg)) + geom_point()


Then resize the plot preview pane and ggsave() again. And again. You’ll get three very different graphics as a result. Your font sizes are likely to be different from what you expect, if you drag those saved graphics into an MS Word or PowerPoint document, since the graphic will have to resize to fit the container (page, slide, or content area).

The solution is to be explicit about what your intended end-use is. I wrote a utility function to save a given graphic with proper dimensions and resolution for a number of use cases: for use in MS Word (U.S. Letter) documents at half- and full-page sizes, both portrait and landscape; and in both standard and widescreen slide formats. The code uses a default sent of dimensions and resolutions, but you can provide your own data.frame, if needed. U.S. users will recognize 8.5-2 as letter-width less 2 inches for standard 1 inch margins and 11-2 as letter-height less the same 2 inches for margins. Half page height is then (11-2)/2.

Now, your “10pt” axis labels will actually be 10pt when you place your graphics. Always use your graphics at 100% scale, otherwise all bets are off.

Quick Notes About Citations and References in APA Style

I often see a similar set of issues related to proper citation… some of them are quite understandable, while others perplex me in their consistency. When I cite myself, below, it’s not ego; it’s to demonstrate how I would typically expect to see a citation or reference appear. And the references are fictional.

In-text Citations

  • Every in-text idea that isn’t yours must be cited. Failure to do so is theft of intellectual property, typically known as plagiarism.
  • Every in-text idea that’s taken directly from source material must be “wrapped in quotation marks and cited” (Doane, 2023).
  • If a quotation comes from a paged document (PDF, book, etc.), then “the quoted in-text citation should include a page number” (Doane, 2023 p.45).
  • In APA style, the punctuation for the sentence being cited goes AFTER the citation (Doane, 2023).
    • not punctuated like this. (Doane, 2023).
  • The label used in the in-text citation (Doane, 2023) must match the beginning of the alphabetized entry in the References section.
    • Doane, W. E. J. (2023). How to Cite to Ensure a Chain of Evidence to Support Your Claims. Penguin Press. (nb: this is fictional) 
  • Every in-text citation must lead directly to an entry in your References section.

Your References Section

  • Every entry in your References section must match an in-text citation.
  • The References section must be arranged in alphabetical order by first author’s last name (or source, if no author).
  • Multiple references from the same author in the same year may need an added letter designation: (Doane, 2023a) for example, with the letter also added to the reference entries to help your reader disambiguate.
    • Doane, W. E. J. (2023a). How to Cite to Ensure a Chain of Evidence to Support Your Claims. Penguin Press. (nb: this is fictional) 
    • Doane, W. E. J. (2023b). More Tips on How to Cite. Saratoga Press. (nb: this is fictional) 
  • Institutional authors should be spelled out (unless it’s a very common abbreviation: IBM, NASA, etc.).
  • Never list institutional authors as if they were first and last names:
    • BAD: “Machines, I.B.”
    • GOOD: “IBM” or “International Business Machines”
  • Check how to cite an organization as the author in your citation manager of choice.

Your Sources

Purpose and Reasoning

  • The purpose of citing is to draw a map for your reader from the material in the body of your document, to a reference, to the original source.
    • If you claim that the U.S. National Debt is only $31 dollars, then I need to know where you got that information, so that I can fact check you and point out that you left off “trillion”. (See
  • Your job as a writer is to make it as easy as possible for your reader to believe and be persuaded by your writing.
  • As such, accurate attribution and guiding your reader to the source material you rely upon for your claims is vital to the writing process.

As an analogy to Web technology, the concept of citations are the pre-electronic version of web links: the text in the body of your document links to a reference which in turn links to a source document. Each step in that chain of evidence needs to be immediately apparent and easy to follow.

2022 Government & Public Sector R Conference

I’m excited to be speaking & hosting a workshop (November 30) at this year’s R Gov Conference (@rstatsai) along with many others on December 1-2! Join us in-person or virtually online for a fun filled event! Get your ticket now at #rstatsgov | #rstats

Conference speaker information for William Doane at R Conference: Government & Public Sector November 30 and December 1-2

Writing Beyond the Academy 1.23.15 ~ Larry McEnerney (University of Chicago Writing Program)

We’re called to think about writing better, not about following the rules of writing. Your writing must be valuable. It is when it helps readers to change what they think about the world.

Academic writing too often is not valuable. Instead, academic writing is only ever considered by those who have motivations other than seeking to change their own minds.

Remember This: The Lesson of Jan Karski

Paul Ricoeur famously said, “the duty of memory is the duty to do justice.” We are our memories, both as individuals and as a society.

I and a dear friend experienced David Strathairn’s performance of this one man show about another man at the Shakespeare Theatre Company in Washington DC, October 9, 2021. It was touching, deep, and disturbing. It speaks as much to our time as to our history.

I commend it to you: remember this.

Considering Matthew Shepard ~ Craig Hella Johnson

Matthew Shepard is one of uncountably many LGBTQ+ individuals murdered each year for having the temerity to be themselves. While the circumstances of Matthew’s last day are complicated, the perpetrators claimed at trial that their actions were in large part motivated by their hatred of Matthew simply because he was gay. On a remote stretch of pasture in Laramie, Wyoming, they stripped, beat, and tortured Matthew, tied him to a fence , and left him there to die, alone, freezing, slowly.

This is a selection from Considering Matthew Shepard by Craig Hella Johnson in which a part of Matthew’s story is told from the perspective of the fence to which he was tied.

Nod to the Resonance Women’s Chorus of Boulder, Colorado, for introducing me to this work through their performance of All of Us.

Apple’s iOS/iPadOS/WatchOS Medical ID

PSA: You should absolutely setup or update your iOS Medical ID information and select your emergency contacts right this very minute.

This feature, found in the Health app on your iPhone or iPad, makes your medical information—medications, allergies, organ donor status— available to first responders and allows calls to your emergency contacts even when your device is locked.

This could save your life. For instructions on how to setup this feature, see

Raspberry Pi 400 All-in-One Micro Computer

Here’s an interesting throwback to my early days of computing. I learned about computing and programming on a Times-Sinclair 1000 back in 1982. For a “reasonable” cost, it was a keyboard and computer all-in-one that you plugged into your TV set (for display) and audio cassette player (for data storage).

This is a nice intro to the new Raspberry Pi 400 all-in-one computer… This is 1,000 generations follow-on from the Times-Sinclair 1000. And yet, it’s so very similar: all-in-one, connect to your monitor, etc. Also, it’s the same current dollars cost: The Sinclair cost $99 in 1982 dollars and the PI 400 costs $100 in 2020 dollars for a kit that includes a hefty beginner’s guide, power supply, mouse, and video cable.

These kinds of devices allow for discovery and tinkering in a way that tightly controlled ecosystems such as the iPhone, iPad, and even Android platforms generally do not. Here’s hoping such systems inspire more generations to explore the possibilities of computing.

John Stuart Mill “On Liberty”

“The only freedom which deserves the name, is that of pursuing our own good in our own way, so long as we do not attempt to deprive others of theirs, or impede their efforts to obtain it.”

“…doing as we like, subject to such consequences as may follow: without impediment from our fellow-creatures, so long as what we do does not harm them, even though they should think our conduct foolish, perverse, or wrong.”

Spreadsheets are Just OK for Data, Bad for Data Analyses

There are plentiful examples of spreadsheet applications leading analysts astray. Believe all the scary stories. Spreadsheets can silently damage your data, converting numbers to dates or dropping leading zeros from what should be fixed-length identifier (where did the U.S. Zip Code 01002 go?).

The U.K. Lost 16,000 COVID Cases Because It Doesn’t Understand Microsoft Excel

The Reinhart-Rogoff error or how not to Excel at economics

For a set of best practices when working with data in spreadsheets, take to heart the advice offered by Data Organization in Spreadsheets. Please!

What will you improve today?