rggplot2

Plotting actual words as the bars in R


I have a list of text:

1996 Steven Harper - Immunopathogenesis of IgA nephropathy

1997 Nigel Brunskill - Pathogenic implications of proteinuria

1998 Albert Ong - Polycystic kidney disease

1999 David Kluth - Inflammatory mechanisms of glomerular injury

2000 Alice Allen - Pathogenesis of IgA nephropathy

2001 Coralie Bingham - Definition of the Renal Cysts and Diabetes Syndrome

2002 Sally Feather - Genetic basis of foetal malformations of the kidney and urinary tract

2003 Helen Lachman - Amyloidosis

2004 Jeremy Duffield - The role of macrophages in renal inflammation

2005 Anna Richards - Atypical HUS

2006 Menna Clatworthy - Immune inhibition

2007 John Sayer - Molecular genetics of nephronophthisis

2008 Bryan Conway - Finding genes for diabetic kidney disease

2009 David Kavanagh - The pathogenesis of haemolytic uraemic syndrome

2010 Andy Salmon - Regulation of glomerular permeability

2011 Daniel Gale - Gene hunting in the Renal Unit

2012 Amy Jayne McKnight - Unravelling heritable complexities for CKD

2013 Andrew Hall - Power cuts in the proximal tubule: mitochondria, antiretrovirals & the renal Fanconi syndrome

2014 Thomas Hiemstra - Waste not. The business of urine exosomes

2015 James Fotheringham - Long breaks and disappearing PD catheters: lessons from linking UK Renal Registry data

2016 Eoin Mckinney - Better off sick and tired: T cell exhaustion and outcome in autoimmune disease

2017 Edwin Wong - Complement-mediated renal disease

2018 Pippa Bailey - Understanding socioeconomic inequity in living-donor kidney transplantation

2019 Alex Hamilton - The psychosocial health of young adults on renal replacement therapy

2020 Matthew Graham-Brown (rolled over to UKKW 2021 due to the pandemic)

2021

2022 Jennifer Lees - CKD, cardiovascular disease and cancer: the scenic route

2023 Melanie Chan - Genomic insights into urinary tract malformations: moving beyond monogenic inheritance

2024 Benjamin Stewart - Mapping immunity in the human kidney with single cell genomics

I would like to plot the names of each talk with their length on the y-axis and the year on the x-axis in R. Simple enough but I would like the bars to be made up of the words themselves, a bit like thisenter image description here.

Is this possible in R?


Solution

  • We do not need {ggplot2} for this. Modify

    plot(x=X$Year, y=seq_along(X$Title), type='n', ylab='', xlab='', 
         axes=FALSE, main='List of Topics')
    text(x=X$Year, y=rep(1, nrow(X)), labels=X$Title, cex=.7,
         srt=90, adj=c(0, 0), font=2)
    axis(1, at=X$Year, las=2, col=NA, cex.axis=.7, pos=1, font=2)
    

    according to your needs.

    LOT

    X = structure(list(Year = c(1996L, 1997L, 1998L, 1999L, 2000L, 2001L, 
    2002L, 2003L, 2004L, 2005L, 2006L, 2007L, 2008L, 2009L, 2010L, 
    2011L, 2012L, 2013L, 2014L, 2015L, 2016L, 2017L, 2018L, 2019L, 
    2020L, 2022L, 2023L, 2024L), Name = c("Steven Harper", "Nigel Brunskill", 
    "Albert Ong", "David Kluth", "Alice Allen", "Coralie Bingham", 
    "Sally Feather", "Helen Lachman", "Jeremy Duffield", "Anna Richards", 
    "Menna Clatworthy", "John Sayer", "Bryan Conway", "David Kavanagh", 
    "Andy Salmon", "Daniel Gale", "Amy Jayne McKnight", "Andrew Hall", 
    "Thomas Hiemstra", "James Fotheringham", "Eoin Mckinney", "Edwin Wong", 
    "Pippa Bailey", "Alex Hamilton", "Matthew Graham-Brown", "Jennifer Lees", 
    "Melanie Chan", "Benjamin Stewart"), Title = c("Immunopathogenesis of IgA nephropathy", 
    "Pathogenic implications of proteinuria", "Polycystic kidney disease", 
    "Inflammatory mechanisms of glomerular injury", "Pathogenesis of IgA nephropathy", 
    "Definition of the Renal Cysts and Diabetes Syndrome", "Genetic basis of foetal malformations of the kidney and urinary tract", 
    "Amyloidosis", "The role of macrophages in renal inflammation", 
    "Atypical HUS", "Immune inhibition", "Molecular genetics of nephronophthisis", 
    "Finding genes for diabetic kidney disease", "The pathogenesis of haemolytic uraemic syndrome", 
    "Regulation of glomerular permeability", "Gene hunting in the Renal Unit", 
    "Unravelling heritable complexities for CKD", "Power cuts in the proximal tubule: mitochondria, antiretrovirals & the renal Fanconi syndrome", 
    "Waste not. The business of urine exosomes", "Long breaks and disappearing PD catheters: lessons from linking UK Renal Registry data", 
    "Better off sick and tired: T cell exhaustion and outcome in autoimmune disease", 
    "Complement-mediated renal disease", "Understanding socioeconomic inequity in living-donor kidney transplantation", 
    "The psychosocial health of young adults on renal replacement therapy", 
    "Rolled over to UKKW 2021 due to the pandemic", "CKD, cardiovascular disease and cancer: the scenic route", 
    "Genomic insights into urinary tract malformations: moving beyond monogenic inheritance", 
    "Mapping immunity in the human kidney with single cell genomics"
    )), class = "data.frame", row.names = c(NA, -28L))