0

In Julia, I can provide a color as an Int. For example, this works:

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) 

If I want to change the shape, I can provide the following:

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

But it seems I cannot provide marker shapes as an Int!

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

Is there any easy way to provide Int's for shapes in Plots? Or nice way to convert Ints to shapes?

Cliff AB
  • 1,160
  • 8
  • 15

1 Answers1

2

Using an integer as an index into Plots.Supported_markers might work:

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
Bill
  • 5,600
  • 15
  • 27