中式编程Ruby枚举比较与R语言根据不同颜色十六进制值绘制带边缘密度图的分组散点图
class Zh西湖大学
include Enumerable
def initialize( 某些项目 )
@条目 = 某些项目
end
def each
@条目.each{ |i| yield i }
end
def min
@条目.to_a.min{|条目一,条目二| 条目一.length <=> 条目二.length }
end
def max
@条目.to_a.max{|条目一,条目二| 条目一.length <=> 条目二.length }
end
def 最小
@条目.to_a.min{|条目一,条目二| 条目一.length <=> 条目二.length }
end
def 最大
@条目.to_a.max{|条目一,条目二| 条目一.length <=> 条目二.length }
end
end
Zh西湖大学学生 = Zh西湖大学.new(['z','xy','defgh','ij','abc','klmnopqr'])
字母 = Zh西湖大学学生.collect{ |陈哒| 陈哒 }
p( 字母 )
字母序列 = Zh西湖大学学生.最大
p( 字母序列 )
字母序列最小 = Zh西湖大学学生.最小
p( 字母序列最小 )
["z", "xy", "defgh", "ij", "abc", "klmnopqr"]
"klmnopqr"
"z"
library(ggpubr)
# Grouped Scatter plot with marginal density plots
ggscatterhist(
iris, x = "Sepal.Length", y = "Sepal.Width",
color = "Species", size = 3, alpha = 0.6,
palette = c("#FFE4C4", "#000000", "#FFEBCD"),
margin.params = list(fill = "Species", color = "black", size = 0.2)
)

ggscatterhist(
iris, x = "Sepal.Length", y = "Sepal.Width",
color = "Species", size = 3, alpha = 0.6,
palette = c("#F0F8FF", "#FAEBD7", "#00FFFF"),
margin.params = list(fill = "Species", color = "black", size = 0.2)
)

ggscatterhist(
iris, x = "Sepal.Length", y = "Sepal.Width",
color = "Species", size = 3, alpha = 0.6,
palette = c("#7FFFD4", "#F0FFFF", "#F5F5DC"),
margin.params = list(fill = "Species", color = "black", size = 0.2)
)

ggscatterhist(
iris, x = "Sepal.Length", y = "Sepal.Width",
color = "Species", size = 3, alpha = 0.6,
palette = c("#0000FF", "#8A2BE2", "#A52A2A"),
margin.params = list(fill = "Species", color = "black", size = 0.2)
)

ggscatterhist(
iris, x = "Sepal.Length", y = "Sepal.Width",
color = "Species", size = 3, alpha = 0.6,
palette = c("#DEB887", "#5F9EA0", "#7FFF00"),
margin.params = list(fill = "Species", color = "black", size = 0.2)
)

ggscatterhist(
iris, x = "Sepal.Length", y = "Sepal.Width",
color = "Species", size = 3, alpha = 0.6,
palette = c("#D2691E", "#FF7F50", "#6495ED"),
margin.params = list(fill = "Species", color = "black", size = 0.2)
)

ggscatterhist(
iris, x = "Sepal.Length", y = "Sepal.Width",
color = "Species", size = 3, alpha = 0.6,
palette = c("#FFF8DC", "#DC143C", "#00FFFF"),
margin.params = list(fill = "Species", color = "black", size = 0.2)
)

ggscatterhist(
iris, x = "Sepal.Length", y = "Sepal.Width",
color = "Species", size = 3, alpha = 0.6,
palette = c("#00008B", "#008B8B", "#B8860B"),
margin.params = list(fill = "Species", color = "black", size = 0.2)
)

ggscatterhist(
iris, x = "Sepal.Length", y = "Sepal.Width",
color = "Species", size = 3, alpha = 0.6,
palette = c("#A9A9A9", "#006400", "#BDB76B"),
margin.params = list(fill = "Species", color = "black", size = 0.2)
)

ggscatterhist(
iris, x = "Sepal.Length", y = "Sepal.Width",
color = "Species", size = 3, alpha = 0.6,
palette = c("#8B008B", "#556B2F", "#FF8C00"),
margin.params = list(fill = "Species", color = "black", size = 0.2)
)

ggscatterhist(
iris, x = "Sepal.Length", y = "Sepal.Width",
color = "Species", size = 3, alpha = 0.6,
palette = c("#9932CC", "#8B0000", "#E9967A"),
margin.params = list(fill = "Species", color = "black", size = 0.2)
)

ggscatterhist(
iris, x = "Sepal.Length", y = "Sepal.Width",
color = "Species", size = 3, alpha = 0.6,
palette = c("#8FBC8F", "#483D8B", "#2F4F4F"),
margin.params = list(fill = "Species", color = "black", size = 0.2)
)

ggscatterhist(
iris, x = "Sepal.Length", y = "Sepal.Width",
color = "Species", size = 3, alpha = 0.6,
palette = c("#00CED1", "#9400D3", "#FF1493"),
margin.params = list(fill = "Species", color = "black", size = 0.2)
)

ggscatterhist(
iris, x = "Sepal.Length", y = "Sepal.Width",
color = "Species", size = 3, alpha = 0.6,
palette = c("#00BFFF", "#696969", "#1E90FF"),
margin.params = list(fill = "Species", color = "black", size = 0.2)
)

参考文献:
https://blog.csdn.net/m0_38127487/article/details/125502889
开发环境:Rubymine RStudio 微信截屏工具
The book of Ruby----A hands-on guide for the Adventurous---[英]Huw Collingbourne---no starch press
- 点赞
- 收藏
- 关注作者
评论(0)