在 Julia 中以 Int 形式提供标记形状

Providing markershapes as Int in Julia

在 Julia 中,我可以提供 Int 形式的颜色。例如,这有效:

Using Plots() 
# Using gr backend
gr()

x = [1,2,3]
y = [1,2,3]
cols = [1,2,3]

scatter(x,y, markercolor = cols, leg = false) 

如果我想改变形状,我可以提供以下内容:

shapes = [:hex, :circle, :hex]
scatter(x, y, markershape = shapes, markercolor = cols, leg = false)

但我似乎无法将标记形状作为 Int 提供!

shapes = [1, 2, 3]
scatter(x, y, markershape = shapes, markercolor = cols, leg = false)

有什么简单的方法可以为 Plots 中的形状提供 Int 吗?或者将整数转换为形状的好方法?

使用整数作为 Plots.Supported_markers 的索引可能有效:

julia> Plots.supported_markers()
24-element Array{Symbol,1}:
 :none
 :auto
 :circle
 :rect
 :star5
 :diamond
 :hexagon
 :cross
 :xcross
 :utriangle
 :dtriangle
 :rtriangle
 :ltriangle
 :pentagon
 :heptagon
 :octagon
 :star4
 :star6
 :star7
 :star8
 :vline
 :hline
 :+
 :x


julia> Plots.supported_markers()[6]
:diamond