0

在 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?还是将整数转换为形状的好方法?

4

1 回答 1

2

使用整数作为 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
于 2019-03-20T01:50:22.350 回答