scieee AI-readable full text Open interactive document viewer

Data Visualisation – Data Days Autumn 2025

Dybwad, Christine; Mashchak, Andrew; Winterseth, Torstein

Full text

DATA VISUALISATION Christine Dybwad, PhD Andrew Mashchak Torstein Winterseth Foto: UiT Norges arktiske universitet UiT Data Days, Autumn 2025 Data Visualisation – Today’s goal Give you some tips and tools to help improve your skills InfluxData Data Visualisation WHAT IS DATA VISUALISATION? CHOOSE A CHART VISUALISATION TOOLS Visual representation of data that helps the user understand the data and the message Transformation of data in a systematic & logical way into visual items The visualisation should permit users to understand, grasp and interpret the message conveyed by the data What is Data Visualisation? Intersection of art and science https://en.uit.no/om/uitital What does this table tell you? www.macrotrends.net date Per 100K Population Annual % Change 31/12/1990 1.1081 31/12/1991 1.1732 5.87 31/12/1992 1.0731 - 8.53 31/12/1993 0.8812 - 17.88 31/12/1994 0.7609 - 13.65 31/12/1995 0.9635 26.63 31/12/1996 0.9814 1.86 31/12/1997 0.8626 - 12.11 31/12/1998 0.8575 - 0.59 31/12/1999 0.7396 - 13.75 31/12/2000 1.0688 44.51 31/12/2001 0.8197 - 23.31 31/12/2002 1.0136 23.65 31/12/2004 0.7839 - 22.66 31/12/2005 0.7137 - 8.96 31/12/2006 0.708 - 0.8 31/12/2007 0.637 - 10.03 31/12/2008 0.713 11.93 31/12/2009 0.6005 - 15.78 31/12/2010 0.5931 - 1.23 31/12/2011 2.2408 277.81 31/12/2012 0.5379 - 76 31/12/2013 0.9054 68.32 31/12/2014 0.5644 - 37.66 31/12/2015 0.4624 - 18.07 31/12/2016 0.5156 11.51 31/12/2017 0.5306 2.91 31/12/2018 0.4706 - 11.31 31/12/2019 0.5235 11.24 31/12/2020 0.5762 10.07 31/12/2021 0.5367 - 6.86 What is the average homicide rate/100K people? Annual Homicides in Norway Is there an overall increase or decrease over time? Are there any outliers? Plot the data to get the story www.macrotrends.net date Per 100K Population Annual % Change 31/12/1990 1.1081 31/12/1991 1.1732 5.87 31/12/1992 1.0731 - 8.53 31/12/1993 0.8812 - 17.88 31/12/1994 0.7609 - 13.65 31/12/1995 0.9635 26.63 31/12/1996 0.9814 1.86 31/12/1997 0.8626 - 12.11 31/12/1998 0.8575 - 0.59 31/12/1999 0.7396 - 13.75 31/12/2000 1.0688 44.51 31/12/2001 0.8197 - 23.31 31/12/2002 1.0136 23.65 31/12/2004 0.7839 - 22.66 31/12/2005 0.7137 - 8.96 31/12/2006 0.708 - 0.8 31/12/2007 0.637 - 10.03 31/12/2008 0.713 11.93 31/12/2009 0.6005 - 15.78 31/12/2010 0.5931 - 1.23 31/12/2011 2.2408 277.81 31/12/2012 0.5379 - 76 31/12/2013 0.9054 68.32 31/12/2014 0.5644 - 37.66 31/12/2015 0.4624 - 18.07 31/12/2016 0.5156 11.51 31/12/2017 0.5306 2.91 31/12/2018 0.4706 - 11.31 31/12/2019 0.5235 11.24 31/12/2020 0.5762 10.07 31/12/2021 0.5367 - 6.86 Annual Homicides in Norway Nominal Ordinal Grouped on the basis similar characteristics into separate categories or labels e.g. Blood type, nationality, movie genres, postcode Catagories are defined by a natural or predetermined order e.g. grades, clothing size, military ranks, spiciness Warby Parker eye colour Understand your data type: Qualitative UK grading system Textural Qualitative Unstructured human data Comments Abstracts Transcript of speech Understand your data type: Quantitative Interval Ratio Measured along a scale that is equidistant between values and no null value. The absolute difference between any two values is meaningful e.g. temperature, latlong, pH Interval data with an absolute “0” value. Both the absolute and relative difference bewteen two ratio values is meaningful e.g. weight, age, concentrations USGS Choose a chart https://flourish.studio/ Spatial Map data patterns using overlay, distortion The quantitative value of a variable is mapped using colour into specific regions, which are discrete polygonal shapes that altogether form the entire map https://www.reddit.com/r/MapPorn/comments/173al5t/annual_hours_worked_in_europe/ CHOROPLETH MAP Data Visualisation Principles to remember I Be Trustworthy Don’t obscure your data – avoid excessive filtering, do not remove data without just cause Have integrity: do not promise conclusions above what your data can answer Do not misrepresent your data – use charts appropriately, annotate clearly and label all chart elements Wakefield et al. (1998) The Lancet New Scientist MMR in Japan MMR vaccine causes autism! New Scientist MMR in Japan Wakefield et al. (1998) The Lancet Vaccine misinformation Principles to remember II Be accessible Are you showing relevant information at the relevant level to your target audience? Is your representation understandable? Avoid confusing audience with too much or too little information. Think Clarity not Simplicity Can it be understood in a short amount of time? Washington Post Measles outbreaks vs. vaccination Heat map instead of a more conventional bar chart Principles to remember III Be elegant Is your visualisation appealing without sacrificing content? Avoid arbitrary information and design. Be thorough – ensure all details are taken care of. Pride yourself on precision and attention to detail. It will not go unnoticed. Substance over style…… (maybe a little style) Do mass exinctions correlate with massive volcanic episodes? Principle of Proportional Ink The shaded areas are therefore a true representation of the quantitative values being visualiszed https://callingbullshit.org/tools/tools_proportional_ink.html https://clauswilke.com/dataviz/proportional-ink.html The principle of proportional ink: The sizes of shaded areas in a visualization need to be directly proportional to the data values they represent. Data Visualisation VISUALISATION TOOLS Excel Powerpoint →basic charts, limited design Google Sheets Tools for Data Visualisation Python or R→powerful, but a learning curve ...and many more... Online tools →Great, NOT for sensitive data https://flourish.studio/ https://venngage.com/ Graphing apps →Great, but can be pricy https://www.graphpad.com/ https://www.originlab.com/ https://grafiti.com/ Data Visualisation tools in and •Base R + lattice – Old school oFast, basic, manual, terse •ggplot2 - Modern standard oStructured, powerful, different oLarge number of extensions •Plotly - Interaction-focused oDirect, cross-platform, fast •leaflet - interactive maps •https://r-graph-gallery.com/ •matplotlib – Old school oVerbose, annoying, powerful •plotnine – ggplot2 for python •seaborn - Modern & Concise oDirect, concept-oriented •Plotly - Interaction-focused oDirect, cross-platform, fast •Altair – Declarative & interactive oBuilt on Vega-lite grammar •https://python-graph-gallery.com/ Data Visualisation tools in Base R •Fast and good for quick, simple plots oscatterplot, histogram, line, boxplot •Some plots and options are confusing •Inconsistent ways to do things •Not interactive •Built with: oplot(type="…") or specialized function (e.g. hist(), boxplot()) ▪Labels as function parameters oAdd more visualization functions (points(), lines(), etc...) Data Visualisation tools in plot(mtcars$wt, mtcars$mpg) Data Visualisation tools in plot(mtcars$wt, mtcars$mpg, xlab = "weight (g)", ylab = "miles per gallon (mi/gal)", xlim = c(0, 7), ylim = c(0, 50), bty = "l", las = 1, cex.axis = 0.8, tcl = -0.2, pch = 16, col = "dodgerblue1", cex = 0.9) abline(lm(mpg ~ wt, data=mtcars), lty=2) Data Visualisation tools in Data Visualisation tools in ggplot2 •R's most common plotting library •Different way of thinking about plots •Based on a grammar of graphics: 1.Data -> Visual trait mapping (aes) 2.Geometric form (geom) 3.Scale – continuous, categorical 4.Coordinate – linear, log, polar •Not interactive (use ggplot2+plotly) •Many, many extensions (150+) Data Visualisation tools in ggplot(data=mtcars, aes(x = wt, y = mpg)) + geom_point() Data Visualisation tools in ggplot(data=mtcars, aes(x = wt, y = mpg)) + geom_point(col="dodgerblue1", size = 2.5, shape = 16) + geom_smooth(method = "lm", linetype = "dashed", color="black", se=FALSE) + coord_cartesian(ylim = c(0, 50), xlim = c(0, 7), expand = FALSE) + labs(y = "weight (g)", x = "miles per gallon (mi/gal)") + theme_classic() Data Visualisation tools in Data Visualisation tools in Data Visualisation tools in Python matplotlib •Original python plotting library •Powerful, but can be very verbose •Not much happens automatically •Weird data format needs: numpy •Can be manipulated programmatically Data Visualisation tools in Python x = np.arange(len(species)) # the label locations width = 0.25 # the width of the bars multiplier = 0 fig, ax = plt.subplots(layout='constrained') for attribute, measurement in penguin_means.items(): offset = width * multiplier rects = ax.bar(x + offset, measurement, width, label=attribute) ax.bar_label(rects, padding=3) multiplier += 1 # Add some text for labels, title and custom x-axis tick labels, etc. ax.set_ylabel('Length (mm)') ax.set_title('Penguin attributes by species') ax.set_xticks(x + width, species) ax.legend(loc='upper left', ncols=3) ax.set_ylim(0, 250) plt.show() Data Visualisation tools in Python Data Visualisation tools in Python https://coderefinery.github.io/data-visualization-python/ seaborn •built on top of matplotlib •Declarative approach •Very clean, makes sensible choices Data Visualisation tools in Python (sns .violinplot(data=df, x="species", y="body_mass_g", hue="sex", split=True, inner="quart") .set(xlabel="Species", ylabel="Body Mass (g)")) Data Visualisation tools in Python https://coderefinery.github.io/data-visualization-python/ Altair •Declarative •Interactive •Built using: oChart (holds everything & data) oMark (the plot type) oEncoding (Data -> graphical trait) oData Transformations oLayering (with equivalent axes) •Multiple ways to change settings oconfigure_mark() oEncoding parameters Data Visualisation tools in Python https://coderefinery.github.io/data-visualization-python/ chart = (alt.Chart(df) .mark_circle(opacity=0.8) .encode( x=alt.X("life_expectancy:Q", title="Life Expectancy", scale=alt.Scale(zero=False)), y=alt.Y("gdp_per_capita:Q", title="GDP/Capita (log10)", scale=alt.Scale(type="log", base=10)), size=alt.Size("population:Q", scale=alt.Scale(range=[30, 1000]), legend=None), color=alt.Color("continent:N", title="Continent"), )) Data Visualisation tools in Python https://coderefinery.github.io/data-visualization-python/ text = ( alt.Chart(df) .mark_text(align="left", dx=7, dy=0, fontSize=12) .encode( x="life_expectancy:Q", y="gdp_per_capita:Q", text="country:N", color=alt.value("black"), )) (chart + text).properties( width=600, height=400, title="Life Expectancy vs GDP/capita (Made up data)")