Title: | Just Plot for Fun |
---|---|
Description: | Explore the world of R graphics with fun and interesting plot functions! Use make_LED() to create dynamic LED screens, draw interconnected rings with Olympic_rings(), and make festive Chinese couplets with chunlian(). Unleash your creativity and turn data into exciting visuals! |
Authors: | Chen Peng [aut, cre] |
Maintainer: | Chen Peng <[email protected]> |
License: | GPL-3 |
Version: | 0.1.2 |
Built: | 2025-02-12 04:11:30 UTC |
Source: | https://github.com/asa12138/plot4fun |
Draw a Chunlian (Spring Festival couplet) using ggplot2
chunlian( words = NULL, bg_size = 20, bg_shape = 22, bg_fill = "red2", text_size = 10, text_params = list(), font_file = NULL, download_dir = "plot4fun_temp" )
chunlian( words = NULL, bg_size = 20, bg_shape = 22, bg_fill = "red2", text_size = 10, text_params = list(), font_file = NULL, download_dir = "plot4fun_temp" )
words |
A character vector containing three strings for the three lines of the couplet |
bg_size |
Size of the points in geom_point, 20 |
bg_shape |
Shape of the points in geom_point (21~25), 22 or 23 are very good. |
bg_fill |
Fill color of the points in geom_point |
text_size |
Size of the text in geom_text, 10 |
text_params |
parameters parse to geom_text |
font_file |
font file, e.g XX.ttf, XX.ttc |
download_dir |
download_dir for font_file |
A ggplot object representing the Chunlian
Plot clock
clock( x = format(Sys.time(), "%H:%M"), time_label = as.roman(1:12), rotate_text = FALSE, text_color = "black", bg_color = "white", pointer_color = "black" )
clock( x = format(Sys.time(), "%H:%M"), time_label = as.roman(1:12), rotate_text = FALSE, text_color = "black", bg_color = "white", pointer_color = "black" )
x |
time, defalut: format(Sys.time(), "%H:%M"), e.g. 12:30 |
time_label |
time_label, default: as.roman(1:12) |
rotate_text |
rotate_text, FALSE |
text_color |
text_color, "black" |
bg_color |
bg_color, "white" |
pointer_color |
pointer_color, "black" |
ggplot
https://allancameron.github.io/geomtextpath/
clock()
clock()
convert a character to 01 matrix
convert_chr_to_matrix( char, size = 32, font_file = NULL, picture_dir = tempdir() )
convert_chr_to_matrix( char, size = 32, font_file = NULL, picture_dir = tempdir() )
char |
a character |
size |
32 |
font_file |
font_file |
picture_dir |
where to save the temporary picture |
chr_mat
convert_chr_to_matrix("A")
convert_chr_to_matrix("A")
convert a imgage to 01 matrix
convert_img_to_matrix(image_file, size = 32, breaks = 2)
convert_img_to_matrix(image_file, size = 32, breaks = 2)
image_file |
image_file |
size |
32 |
breaks |
breaks, default 2 |
chr_mat
Plot a DNA double helix
DNA_plot( col_DNA = "#377EB8", col_ATCG = c("#7FC97F", "#FB8072", "#FFFFB3", "#A6CEE3"), DNA_length = 2 )
DNA_plot( col_DNA = "#377EB8", col_ATCG = c("#7FC97F", "#FB8072", "#FFFFB3", "#A6CEE3"), DNA_length = 2 )
col_DNA |
col_DNA, "#377EB8" |
col_ATCG |
col_ATCG, c("#7FC97F","#FB8072","#FFFFB3","#A6CEE3") |
DNA_length |
DNA_length, 2 |
ggplot
https://github.com/SherryDong/create_plot_by_R_base
DNA_plot()
DNA_plot()
Give you a rose
give_you_a_rose(color = "red3", mode = "plot3D")
give_you_a_rose(color = "red3", mode = "plot3D")
color |
"skyblue3" |
mode |
"plot3D" or "plotly" |
plot
https://mp.weixin.qq.com/s/W-BYPR3UXL120XWpTmN3rA
Life Game Simulation
life_game( save_file = NULL, size = 20, time = 20, fps = 0.75, colors = c("black", "green4"), ... )
life_game( save_file = NULL, size = 20, time = 20, fps = 0.75, colors = c("black", "green4"), ... )
save_file |
gif filename |
size |
size of the world |
time |
how many times the life game continue. |
fps |
fps, 0.75 |
colors |
c("green4", "black") |
... |
add |
a gif file
https://zhuanlan.zhihu.com/p/136727731
if (interactive()) life_game()
if (interactive()) life_game()
make a LED screen
make_LED( chars = "SOS!", save_file = NULL, LED_width = NULL, speed = 32, fps = 10, colors = c("grey", "red2"), LED_height = 32, image_scale = 10, ... )
make_LED( chars = "SOS!", save_file = NULL, LED_width = NULL, speed = 32, fps = 10, colors = c("grey", "red2"), LED_height = 32, image_scale = 10, ... )
chars |
chars |
save_file |
save_file |
LED_width |
LED_width |
speed |
pixel speed, default 32 |
fps |
frame per second, 10 |
colors |
c("grey","red2") |
LED_height |
LED_height, 64 |
image_scale |
image scale, 10 |
... |
add |
gif file
if (interactive()) make_LED("SOS!")
if (interactive()) make_LED("SOS!")
Draw a Moon_cake (Mid- Autumn Festival) using ggplot2
Moon_cake(cake_color = "orange", cake_fill = "white", stuffing = "五仁")
Moon_cake(cake_color = "orange", cake_fill = "white", stuffing = "五仁")
cake_color |
Color of the cake, default is "orange" |
cake_fill |
Fill color of the cake, default is "white" |
stuffing |
Stuffing of the cake |
ggplot
Word cloud plot
my_wordcloud( str_vector, ignore_words = "Unclassified|uncultured|Ambiguous|Unknown|unknown|metagenome|Unassig", topN = 50 )
my_wordcloud( str_vector, ignore_words = "Unclassified|uncultured|Ambiguous|Unknown|unknown|metagenome|Unassig", topN = 50 )
str_vector |
string vector |
ignore_words |
ignore_words |
topN |
topN, 50 |
a htmlwidget
data(otutab, package = "pcutils") if (requireNamespace("wordcloud2")) { my_wordcloud(taxonomy$Genus) }
data(otutab, package = "pcutils") if (requireNamespace("wordcloud2")) { my_wordcloud(taxonomy$Genus) }
Plot the Olympic rings
Olympic_rings()
Olympic_rings()
ggplot
Olympic_rings()
Olympic_rings()
Plot a pixel image
pixel_plot(image, size = 32, geom = c("point", "tile"), geom_param = list())
pixel_plot(image, size = 32, geom = c("point", "tile"), geom_param = list())
image |
image path |
size |
plot size, default: 32 |
geom |
point or tile, default: "point" |
geom_param |
geom_param, default: list(size = 4) |
ggplot
Plot a chr_mat
## S3 method for class 'chr_mat' plot(x, colors = c("grey", "red2"), random = FALSE, ...)
## S3 method for class 'chr_mat' plot(x, colors = c("grey", "red2"), random = FALSE, ...)
x |
chr_mat object |
colors |
c("grey","red2") |
random |
add random |
... |
add |
plot
Plot a github style calendar
show_github_calendar(usr = "asa12138", color = NULL, save_file = NULL, ...)
show_github_calendar(usr = "asa12138", color = NULL, save_file = NULL, ...)
usr |
github username |
color |
color, NULL |
save_file |
save_file, NULL |
... |
add |
a svg file