plot4fun provides many interesting functions for plotting, such as make_LED, plot Olympic_rings and so on.

Installation

You can install the development version of plot4fun from GitHub with:

The HTML documentation of the latest version is available at Github page.

# install.packages("devtools")
devtools::install_github("Asa12138/plot4fun")

Find fun

plot a pixel image

pixel_plot("https://stardewvalleywiki.com/mediawiki/images/b/b2/Animals_Icon.png")

plot a clock

github contribution calendar

show_github_calendar(usr = "asa12138", color = "skyblue")

make a LED

We can use convert_chr_to_matrix to convert a character to 01 matrix, then plot it easily.

achr <- convert_chr_to_matrix("福")
plot(achr)

After that, we can try to make a dynamic LED screen:

make_LED("一起来画图!", image_scale = 2)

Olympic_rings

How to use ggplot to draw a standard Olympic rings?

Because the real Olympic rings will be nested, we need to handle the relationship between layers to display the correct graphics.

Olympic_rings() + theme_classic()

Chunlian

Spring couplets, also known as “spring paste”, “door pair”, “couplets”, is a kind of red festive elements “Nian red” posted during the New Year. It is a unique literary form in China, depicting beautiful images and expressing good wishes with neat and concise words.

chunlian(c("科研顺利", "数据分析好到爆", "文章投哪哪都要"))

plot a moon cake

Game of Life

https://conwaylife.com/wiki/Conway%27s_Game_of_Life

Conway’s Game of Life, also known as the Game of Life or simply Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.

The “game” is actually a zero-player game, meaning that its evolution is determined by its initial state, needing no input from human players. One interacts with the Game of Life by creating an initial configuration and observing how it evolves.

life_game(size = 40, time = 20, fps = 1)