Plots & Diagrams For Presentations, Papers, & Theses

By Freja Nordsiek

Presentation: http://dx.doi.org/10.6084/m9.figshare.1590009 Source: https://github.com/frejanordsiek/presentation_scientific_plots_and_diagrams

Presentation, images, and code use a CC BY 4.0 license Copyright 2015, Freja Nordsiek https://creativecommons.org/licenses/by/4.0/ Introduction

Purpose of plots and diagrams:

● Visually display information – human brain is good at visual processing ● Readable ● Unambiguous ● Present better than or support a table and/or written/verbal description

Outline of presentation:

1) Purposes, elements, and examples of plots and diagrams 2) Text, lines, symbols, color, and all that 3) Revisiting examples 4) Tips & Tricks 5) Mediums – presentations, papers, theses 6) Computer considerations – image formats and fonts 7) Software 8) Conclusion

Diagrams – Purpose

Graphical representation of something: Input ● Experiments ● Circuits ● Algorithms (flowcharts) R ● Layouts V ● Maps Output 2 R

Requirements:

● Clear ● Highlight important details ● Show ONLY relevant details, unlike pictures ● Support a description and convey quicker understanding

Diagrams – Examples

Bad Good

He-Ne Photodetectors Laser He-Ne

W Water Fiber

PDI Head

Lens

Particles Particles

Plots – Purpose

Graphical representation of data and functions:

● Showing data ● Showing functions ● Relating quantities ● Comparing datasets ● Comparing data to a function

Requirements:

● Clear ● Show the variable ranges of interest ● Highlight important details ● Show ONLY relevant information – can display too much ● Support a description and convey quicker understanding

Plots – Elements

Axes

● Scale ● Ticks ● Colorbar

Data

● Points, lines, regions ● Lines, symbols, colors, shading

Labels – Text, VERY IMPORTANT

● Axes with units ● Ticks ● Legend ● Plot title ● Annotations Plots – Elements

Title

Legend

Axis Annotation

Axis Label

Tick Tick Label Plots – Examples

Bad Good

Line Widths & Types

Width (or thickness) 0.25 pt

● Thicker lines are more visible 0.5 pt ● Too thick can obscure ● Usually measured in points 1 pt ● Point is defined as 1 / 72 inches ● Point is 0.35 mm (0.014 inches) 2 pt ● Thinner than 0.5 pt is usually unreadable ● 0.5 – 5 pt is the common range 5 pt

15 pt Types – Useful to distinguish data sets and objects

● Solid ● Dashed ● Dotted ● Dash-dotted

Symbols/Markers

Uses ● Distinguish data sets ● Distinguish different parameters ● Highlight points of interest

Important things to keep in mind ● Need enough distinction to tell apart ● Need to be big enough to discern ● Can often have separate edge and fill colors ● Can complement line type and width differences ● Can complement color differences

Plotting software typically support many kind ● Circles, squares, diamond ● Triangles in four orientations ● Stars (5-point, 6-point, etc.) ● Plus signs, X, etc. ● Higher order polygons

Color – Introduction

Light ● Composed of photons ● Has wave properties ● Has a wavelength λ and a frequency

Human have color vision ● Can distinguish wavelength ● Can distinguish mixes of wavelengths ● These are called Colors

Uses ● Distinguish data sets or objects ● Utilize color associations (e.g. blue with water)

Cautions ● Different ability to distinguis color ● Rendered on different devices differently

Color – Human Perception

Rods ● Not a major contributor to color vision ● More light sensitive

Cones ● Part of color vision ● Different color sensitivities ● Brain deduces color from cone signals ● Humans typically have three (trichromats) ● S (short), M (medium), and L (long) cones ● Affectionately called the Blue, Green, and Red cones ) y g r

e S M L n e

r a e n i l (

e s n o p s e r

e Image from Wikimedia Commons n o

e z

i By BenRG l a m r

o https://wikipedia.org/wiki/File:Cone-fundamentals-with-srgb-spectrum.svg N 400 450 500 550 600 650 700 Wavelength (nm) Color – Colorblindness

Monochromacy – very rare ● Two or all three cone types missing

Dichromacy – less common ● One cone type is missing

Anomalous trichromacy – most common ● One cone type is shifted

L (Red) and M (Green) cones are on the X chromosome ● Issues most common with single X chromosome – XY, XYY, X0 ● More rare in those with two or three X chromosomes – XX, XXY, XXX ● Most common is M (Green) cone shift – deuteranomaly

Guidelines ● Avoid using only color to distinguish data sets & objects ● Check how graphics look when printed in greyscale ● Run images through a colorblindness simulator/filter ● Be particularly careful with reds, oranges, yellows, and greens ● Red-green colorblindness is not exclusive to men (also, some have two X's) ● Just less common with two or three X chromosomes ● Some women have one X chromosome (X0, intersex, and trans gender) ● On the order of half of non-binary people have one X chromosome Color – Screens, Projectors, & Printers

Have different abilities to show color ● Additive color ● RGB – Red, Green, Blue ● Subtractive color ● CMYK – Cyan, Magenta, Yellow, blacK ● Greyscale

Screens – LCD, plasma, CRT, etc. ● What one designs diagrams and plots on ● Additive – RGB usually (a few have a Y channel with internal conversion) ● Good at a variety of colors

Projectors ● Additive – RGB ● Bad at light colors, especially yellows and greens

Printers ● Subtractive – K (greyscale), CMYK (typical color), CcMmYK ● Colors can turn out very different than on a screen or projector ● Can be hard to distinguish some light and some dark colors ● Bad at some light colors Color – Good Line & Symbol Colors

Important considerations ● Easily distinguished colors ● Dark enough to show on a projector and printer ● Light enough to distinguish from black on screens and printers

Anecdotally good colors

Name Color RGB out of 1 RGB out of 255 RGB Hex Black [0.0, 0.0, 0.0] [ 0, 0, 0] #000000 Red [1.0, 0.0, 0.0] [255, 0, 0] #FF0000 Blue [0.0, 0.0, 1.0] [ 0, 0, 255] #0000FF Dark Green [0.0, 0.7, 0.0] [ 0, 178, 0] #00B200 Magenta [1.0, 0.0, 1.0] [255, 0, 255] #FF00FF Dark Cyan [0.0, 0.7, 0.7] [ 0, 178, 178] #00B2B2 Dark Yellow [0.7, 0.7, 0.0] [178, 178, 0] #B2B200 Dark Grey [0.3, 0.3, 0.3] [ 76, 76, 76] #4C4C4C

Light Grey [0.6, 0.6, 0.6] [153, 153, 153] #999999 Text – Introduction

Used as labels ● Plots: axes, ticks, legends, titles, annotations ● Diagrams: objects, annotations 4 pt 6 pt 7 pt 8 pt 10 pt Size 12 pt ● Big enough to read even with poor vision 14 pt 16 pt ● Small enough to fit and not cover anything 18 pt ● Measured in points (pt) 20 pt ● Minimum: 6-7 pt (print), 10 pt (presentations) 24 pt ● Can mix sizes in single diagram or plot 28 pt Kind ● Weight – light, medium, & bold ● Slope – roman & italic ● Width (of characters) – variable & monospace ● Serifs – serif & sans-serif (sans)

Huge variety of fonts (typefaces) ● Papers & theses: generally medium roman variable serif

● Presentations: generally medium roman variable sans-serif Diagrams Examples Revisited

Bad Good

He-Ne Photodetectors Laser He-Ne

W Water Fiber

PDI Head

Lens

Particles Particles

Plots Examples Revisited

Bad Good

Tips & Tricks – Scales

Different axes scales ● Show different features ● Emphasize different regions ● Make different regions comparable

Linear and logarithmic ● Widely supported ● Natural for many kinds of data

Custom scales ● Not as widely supported ● Requires more work ● Can be very powerful

Words of warning ● Not everything is a powerlaw ● Sometimes helpful to show with multiple scales

Tips & Tricks – Grids

Grids can sometimes make a plot more clear.

But sometimes they cause clutter and make plots harder to read.

Grids tend to be more useful in full- page loglog plots.

Partial grids, where only a couple specific grid lines are drawn (say a horizontal line at 0 here), are a powerful intermediate option.

Tips & Tricks – Box/Frame

Left and bottom axes are usually drawn

Right and top axes sometimes drawn

Why remove an axis? ● Reduce clutter ● Accommodate an inset ● Accommodate a large legend

Problems ● Hard to determine values in plot

Different Mediums

Presentations ● Viewed on projectors ● Presentation is oral ● Fixed slide size but free to use space in any way ● Fixed time limit – limits number of slides and therefore figures ● Style is completely or almost completely up to the presenter

Papers ● Viewed in print and on screens ● Text based document ● Strong or strict page limits – limits number of figures and their sizes ● Double and triple column – quantized figure width ● Journals often limits choice of fonts, font sizes, and line width ● Journals often want specific image formats

Theses ● Viewed in print and on screens ● Text based document ● Generous page limits – can use many full-width and full-page figures ● University often limits choice of fonts, font sizes, and line widths Computers, Software, and File Formats

Plots & diagrams are made on computers.

They are made with the help of software.

They should be stored to disk for preservation.

Important computer and software considerations:

● How computers represent and display images ● How computers represent and display text ● Software used to make plots and diagrams ● How images are stored and converted

Vector & Pixel Graphics – Introduction

Two ways computers represent graphics

Pixel ● Image divided into an array of squares ● Squares are called Pixels ● Each pixel is a single solid color ● Finite resolution – pixel size (# pixels) ● Become grainy when zoomed in too much ● Resizing is often approximate ● Screens & projectors are pixel based ● Screen: 640×480 to 2560×1600 ● Projector: typically 1024×768

Vector (8, 8) ● Represented by drawing instructions ● Uses coordinate based drawing scheme (16, 2) ● Redrawn when resized or moved – rasterization (0, 0) ● Infinite resolution ● Can infinitely zoom Line Thickness = 5 pt Line Color = #000000 ● Can be arbitrarily resized exactly Fill Color = #FF0000 Vector & Pixel Graphics – Vector File Formats

Common, portable, easy to view, and/or recommended ● SVG – Scalable Vector Graphics ● General purpose originally meant for the web (in HTML 5 standard) ● EPS – Encapsulated PostScript ● Old and powerful format ● Often preferred or demanded by journals ● PDF – Portable Document Format ● Versatile format also used for documents ● Often preferred or demanded by journals

Less common, less portable, less easy to view, and/or less recommended ● WMF / EMF – Windows Metafile / Enhanced Metafile ● ODG – Open Document Graphic ● AI – Adobe Illustrator Artwork ● PPT – Microsoft PowerPoint ● XPS – XML Paper Specification

Note, it is always valid to make a graphic in a preferred format or one with better software tools and convert to other formats as needed or demanded.

Vector & Pixel Graphics – Pixel File Formats

Common, portable, easy to view, and/or recommended ● PNG – Portable Network Graphics ● Lossless compressed images ● Pervasive format ● JPG/JPEG – Joint Photographic Experts Group ● Lossy compression – good for pictures ● Often preferred or demanded by journals for pictures ● TIFF – Tagged Image File Format ● Lossless image with poor compression ● Often preferred or demanded by journals (supports CMYK)

Less common, less portable, less easy to view, and/or less recommended ● BMP – BitMaP image file ● GIF – Graphics Interchange Format ● JP2 (JPEG 2000) – Joint Photographic Experts Group 2000 ● PPM, PGM, PBM, PNM – Portable aNy Map (Pix, Gray, Bit)

Note, it is always valid to make a graphic in a preferred format or one with better software tools and convert to other formats as needed or demanded.

Vector & Pixel Graphics – Converting

When conversion is necessary ● Obtained or made graphics in one format but need them in another ● Need to change colorspace (RGB ↔ CMYK)

General conversion utilities ● Almost any hotograph/picture/image viewer or editor ● Scientific & mathematical software suites & environments ● Inkscape ● GIMP – GNU Image Manipulation Prograpm ● Adobe Suite (Acrobat, Illustrator, and Photoshop) ● Libre/Open Office Draw ● ImageMagick (convert command line utility) ● Ghostscript (gs command line utility or through other programs)

Specific conversion utilities ● EPS to PDF – epspdf, epspdftk, epstopdf, ps2pdf ● PDF to PS – pdf2ps & pdftops ● PDF to SVG – pdf2svg

Fonts

Fonts tell a computer how to draw text.

Journals and universities (or departments) often dictate choice/s.

Two general types ● Bitmap fonts (pixel based) – avoid if possible (resolution issues) ● Vector fonts – also known as outline fonts ● Scale well and work on many resolutions ● Recommended font type ● PostScript, TrueType, and OpenType fonts

Characters available ● ASCII fonts – can only represent ~128 characters ● Unicode fonts – include non-English, accented, and special characters

EMBED FONTS!!!! ● Other computers may not have the same fonts or may substitute fonts ● Solution – embed fonts into vector graphics and documents ● Supported by most vector graphic formats ● Supported by vector graphics programs (default for some) Software & Formats – Presentations

Note: EPS, SVG, and EMF/WMF vector image support is bad in some software.

Microsoft PowerPoint – PPT & PPTX and now can convert to PDF ● Most commonly used ● WYSIWYG (What You See Is What You Get) ● Image formats: EPS, PNG, JPG, TIFF, GIF, BMP, EMF/WMF, ...

Libre/Open Office Impress – ODP and converts to PDF ● Second most common ● WYSIWYG (What You See Is What You Get) ● Free Software ● Mostly compatible with Microsoft PowerPoint (can read/write its files) ● Image formats: EPS, SVG, PNG, JPG, TIFF, GIF, BMP, EMF, ...

Beamer – PDF or DVI optionally to PS or PDF ● LaTeX based (it is a package) ● Uses markup – describe how slides should look instead of WYSIWYG ● Free Software ● Image formats: {PDF, PNG, JPG} or {EPS}

Apple Keynote – KEY and converts to PDF ● WYSIWYG (What You See Is What You Get) ● Image formats: PDF, JPG, PNG, TIFF, and GIF Software & Formats – Papers & Theses

Note: EPS, SVG, and EMF/WMF vector image support is bad in some software.

LaTeX – PDF or DVI optionally to PS or PDF ● Probably the most common ● Uses markup – describe how slides should look instead of WYSIWYG ● Free Software ● Image formats: {PDF, PNG, JPG} or {EPS} ● Many packages add functionality, abilities, document formatting, etc.

Microsoft PowerPoint – DOC, DOCX, RTF and now can convert to PDF ● Next most common ● WYSIWYG (What You See Is What You Get) ● Image formats: EPS, PNG, JPG, TIFF, GIF, BMP, EMF/WMF, ...

Libre/Open Office Impress – ODF and converts to PDF ● WYSIWYG (What You See Is What You Get) ● Free Software ● Mostly compatible with Microsoft PowerPoint (can read/write its files) ● Image formats: EPS, SVG, PNG, JPG, TIFF, GIF, BMP, EMF, ... Software & Formats – Diagrams

Inkscape ● SVG based but can export to many formats ● WYSIWYG (What You See Is What You Get) ● Free software

Adobe Illustrator ● AI based but can export to many formats ● WYSIWYG (What You See Is What You Get)

Libre/Open Office Draw ● ODG based but can export to many formats ● WYSIWYG (What You See Is What You Get) ● Free Software

Asymptote ● EPS based but can produce any format ImageMagick can produce ● Programmatic drawing ● Free Software

Software & Formats – Plotting

Free Software Proprietary Software

Full environment Full environment ● GNU Octave ● MATLAB ● R ● Mathematica ● Sage ● LabView ● Maxima ● IDL ● Scilab ● Maple ● SAS Standalone ● Mathcad ● Standalone ● ParaView ● Origin ● PLplot ● Plotly

Packages/Libraries ● – Python ● MayaVi – Python ● ROOT – C++ Conclusions

Visually display information

Photodetectors Laser Requirements He-Ne ● Readable ● Water Data sets & objects distinguishable Fiber ● Highlight relevant information PDI Head ● Readable even with colorblindness ● Easy to read in print/on projector Lens ● Take medium into account Particles

Tools ● Lines ● Symbols ● Colors ● Text

Computer ● Vector vs. pixel graphics ● Fonts – embed, embed, … , embed ● Many pieces of software available