Skip to content

Instantly share code, notes, and snippets.

View loukesio's full-sized avatar
πŸ§‘β€πŸ’»
Coding at work

Loukas Theodosiou loukesio

πŸ§‘β€πŸ’»
Coding at work
View GitHub Profile
@loukesio
loukesio / install_packages.R
Last active December 17, 2025 17:10
R Package Installation Guide - Data Visualization and Genomics Course
# ============================================================================
# R Package Installation Guide
# Data Visualization and Genomics Course
# ============================================================================
#
# This script will help you install all required R packages for the course.
#
# Prerequisites:
# - R version: 4.3.0 or higher (recommended: 4.4.0+)
# - RStudio: Latest version recommended
@loukesio
loukesio / font_test.R
Created May 4, 2025 22:36
test how different fonts look
demo_font_text <- function(
google_names,
families = tolower(gsub("\\s+", "", google_names)),
label_text = "Showtext shows text. Wow. What an insight.",
size = 13
) {
# dependencies
library(showtext)
library(ggplot2)
library(dplyr)
# Load the Rcpp library (assuming you've already loaded it earlier)
library(Rcpp)
library(showtext)
library(ggplot2)
library(ggforce)
library(ggfx)
## Loading Google fonts (https://fonts.google.com/)
font_add_google("Exo 2", "Exo")
showtext_auto()
library(ggplot2)
library(dplyr, warn.conflicts = FALSE)
tibble(species=c(rep("tiger",2),rep("elephant",2)),
type=rep(c("upregulated","downregulated"),2),
counts=c(121,117,219,234)) %>%
ggplot() +
geom_col(aes(species,counts,fill=type), position = position_dodge()) +
scale_fill_manual(values=c("#ffa345","#624185")) +
geom_text(aes(x=species, y=counts+5, label=counts, group=type), position = position_dodge(width = 0.9)) + # Here, do not forget to GROUP!
# Load required packages
library(tidyverse)
library(gridExtra)
library(showtext)
library(grid)
# Read the global temperature data from CSV file
global_temps <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-07-11/global_temps.csv')
# Add custom font and enable automatic text rendering
#
# β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—
# β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘
# β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘
# β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β• β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘
# β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘
# β•šβ•β• β•šβ•β•β•β•β•β•β•β•šβ•β• β•šβ•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β•β•šβ•β• β•šβ•β•β•β•
#
#############
colorDNASequences <- function(dna_sequences) {
# Define background colors for bases
base_backgrounds <- c(A = "\033[41m", T = "\033[42m", G = "\033[44m", C = "\033[43m") # Red, Green, Blue, Yellow background
# Iterate over each DNA sequence
for (dna_sequence in dna_sequences) {
# Convert the sequence to uppercase to handle both upper and lower case letters
sequence <- toupper(dna_sequence)
# Iterate over each base in the sequence
colorDNASequences <- function(dna_sequences) {
# Define colors for bases
base_colors <- c(A = "\033[31m", T = "\033[32m", G = "\033[34m", C = "\033[33m") # Red, Green, Blue, Yellow
gap <- " " # Tiny gap between base pairs
# Iterate over each DNA sequence
for (dna_sequence in dna_sequences) {
# Convert the sequence to uppercase to handle both upper and lower case letters
sequence <- toupper(dna_sequence)
library(showtext)
library(ggplot2)
## Loading Google fonts (https://fonts.google.com/)
font_add_google("Exo 2", "Exo")
## Automatically use showtext to render text
showtext_auto()
generate_lines_within_circle <- function(center_x, center_y, radius, num_lines) {
start_angles <- runif(num_lines, 0, 2 * pi)
library(showtext)
library(ggplot2)
library(ggforce)
library(tibble)
library(ltc)
library(showtext)
## Loading Google fonts (https://fonts.google.com/)
font_add_google("Great Vibes", "Great Vibes")