Gadfly - error if shape count more than 15

Gadfly shows error if plot has more than 15 shapes (limit!). See code below.

using Gadfly

x = [0.025, 0.028, 0.035, 0.036, 0.037, 0.039, 0.039, 0.041, 0.041, 0.041, 0.042, 0.043, 0.045, 0.047, 0.049, 0.051, 0.053, 0.053, 0.055, 0.056, 0.057, 0.057, 0.059, 0.063, 0.063, 0.067, 0.067, 0.069, 0.07, 0.072, 0.073, 0.075, 0.076, 0.076, 0.078, 0.082, 0.083, 0.083, 0.084, 0.085, 0.085, 0.086, 0.09, 0.092, 0.092, 0.093, 0.095, 0.095, 0.096, 0.103, 0.103,
0.104, 0.104, 0.105, 0.105, 0.106, 0.107, 0.107, 0.108, 0.109, 0.11, 0.117, 0.119, 0.119, 0.12, 0.126, 0.133, 0.133, 0.135, 0.135, 0.135, 0.137, 0.138, 0.141, 0.144, 0.144, 0.145, 0.145, 0.146, 0.146, 0.149, 0.151, 0.155, 0.155, 0.159, 0.162, 0.162, 0.163, 0.164, 0.167, 0.17, 0.171, 0.172, 0.179, 0.181, 0.187, 0.187, 0.188, 0.188, 0.201, 0.204, 0.204, 0.205, 0.208, 0.208, 0.213, 0.214, 0.214, 0.218, 0.221, 0.222, 0.23, 0.231, 0.238, 0.239, 0.245, 0.245, 0.25, 0.256, 0.256, 0.258, 0.262, 0.262, 0.263, 0.264, 0.267, 0.269, 0.273, 0.273, 0.276, 0.279, 0.288, 0.292, 0.296, 0.296, 0.297, 0.298, 0.301, 0.322, 0.324, 0.328, 0.332, 0.336, 0.341, 0.347, 0.354, 0.357, 0.365, 0.376]
y = [0.018, 4.0, 0.288, 0.157, 0.037, 0.163, 0.06499999, 1.0, 0.09199999, 0.203, 0.26, 0.028, 0.243, 4.0, 2.0, 0.852, 58.0, 4.0, 0.023, 2.48, 4.0, 3.0, 14.0, 37.3, 0.121, 2.0, 12.0,
4.0, 19.0, 4.0, 0.038, 1.0, 2.0, 0.146, 0.061, 0.127, 2.0, 203.0, 2.0, 2.0, 0.278, 2.0, 0.229, 2.0, 0.3, 4.0, 4.0, 0.146, 289.0001, 4.0, 2.0, 2.0, 0.163, 1.0, 0.266, 4.0, 3.0, 1.0, 9.0, 3.0, 0.171, 1.0, 0.264, 10.0, 0.374, 1.0, 2.0, 2.0, 25.0, 2.0, 0.582, 2.0, 15.0, 2.0, 2.0, 3.0, 2.0, 2.0, 2.0, 1.93, 9.0, 2.0, 19.0, 0.684, 4.0, 2.0, 2.0, 2.0, 19.0, 2.0, 6.0, 2.0, 5.0, 2.0, 4.0, 1351.0, 3.0, 2.0, 4.0, 4.0, 12.0, 9.0, 6.0, 6.0, 6.0, 1291.0, 5.0, 79.00001, 28.0, 7.0, 5.0, 60.0, 16.0, 15.0, 14.0, 49.0, 9.0, 19.0, 26.0, 35.0, 79.00001, 26.0, 4.0, 192.0, 79.00001, 26.0, 35.0, 148.0, 31.0, 46.99999, 79.00001, 456.0, 88.0, 21.0, 149.0, 31.0, 465.0001, 19.0, 81.00001, 48.0, 139.0, 938.9999, 303.0, 214.0, 440.9999, 168.0, 367.0, 196.0, 437.9999]
c18 = ["A","A","A","A","B","B","B","B","B","C","C","C","C","C","D","D","D","D","E","E","E","E","F","F","F","F","G", "G","G","G","H","H","H","H","H","I","I","I","I","J","J","J","J","K","K","K","K","L","L","L","L","M","M","M",
"N","N","N","N","O","O","O","O","O","P","P","P","P","P","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q", "Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q", "Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q",
"Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q","Q"]

l2 = layer(x=x, y=y, shape=c18, Geom.point)

# Plot#1
plot(l2,
    Scale.y_log10,
)

Error message.

BoundsError: attempt to access 15-element Array{Function,1} at index [16]
getindex(::Array{Function,1}, ::Int64) at array.jl:788
render(::Gadfly.Geom.PointGeometry, ::Theme, ::Gadfly.Aesthetics) at point.jl:71
render(::Gadfly.Geom.PointGeometry, ::Theme, ::Gadfly.Aesthetics, ::Array{Gadfly.Aesthetics,1}, ::Array{Gadfly.Data,1}, ::Dict{Symbol,Gadfly.ScaleElement}) at geometry.jl:45
(::Gadfly.var"#108#109"{Dict{Symbol,Gadfly.ScaleElement}})(::Tuple{Layer,Gadfly.Aesthetics,Array{Gadfly.Aesthetics,1},Array{Gadfly.Data,1},Theme}) at none:0
iterate at generator.jl:47 [inlined]
collect(::Base.Generator{Base.Iterators.Zip{Tuple{Array{Layer,1},Array{Gadfly.Aesthetics,1},Array{Array{Gadfly.Aesthetics,1},1},Array{Array{Gadfly.Data,1},1},Array{Theme,1}}},Gadfly.var"#108#109"{Dict{Symbol,Gadfly.ScaleElement}}}) at array.jl:665
render_prepared(::Plot, ::Gadfly.Coord.Cartesian, ::Gadfly.Aesthetics, ::Array{Gadfly.Aesthetics,1}, ::Array{Array{Gadfly.StatisticElement,1},1}, ::Array{Array{Gadfly.Aesthetics,1},1}, ::Array{Array{Gadfly.Data,1},1}, ::Dict{Symbol,Gadfly.ScaleElement}, ::Array{Gadfly.GuideElement,1}; table_only::Bool, dynamic::Bool) at Gadfly.jl:824
render_prepared(::Plot, ::Gadfly.Coord.Cartesian, ::Gadfly.Aesthetics, ::Array{Gadfly.Aesthetics,1}, ::Array{Array{Gadfly.StatisticElement,1},1}, ::Array{Array{Gadfly.Aesthetics,1},1}, ::Array{Array{Gadfly.Data,1},1}, ::Dict{Symbol,Gadfly.ScaleElement}, ::Array{Gadfly.GuideElement,1}) at Gadfly.jl:813
render(::Plot) at Gadfly.jl:759
draw at Gadfly.jl:864 [inlined]
show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::MIME{Symbol("application/prs.juno.plotpane+html")}, ::Plot) at Gadfly.jl:971
show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::String, ::Plot) at multimedia.jl:109
displayinplotpane(::Plot) at showdisplay.jl:51
displayandrender(::Plot) at showdisplay.jl:131
(::Atom.var"#201#205")() at eval.jl:177
#invokelatest#1 at essentials.jl:712 [inlined]
invokelatest at essentials.jl:711 [inlined]
(::Atom.var"#200#204"{String,String})() at eval.jl:176
withpath(::Atom.var"#200#204"{String,String}, ::String) at utils.jl:30
withpath(::Function, ::String) at eval.jl:9
#199 at eval.jl:161 [inlined]
with_logstate(::Atom.var"#199#203"{String,String}, ::Base.CoreLogging.LogState) at logging.jl:398
with_logger at logging.jl:505 [inlined]
#198 at eval.jl:160 [inlined]
hideprompt(::Atom.var"#198#202"{String,String}) at repl.jl:140
macro expansion at dynamic.jl:24 [inlined]
evalall(::String, ::Nothing, ::String) at eval.jl:150
macro expansion at eval.jl:39 [inlined]
(::Atom.var"#172#173")() at task.jl:358

This error can be better handled to allow easier problem tracing. Took me a while to find this limits.

The Theme fields can be listed by doing dump(Theme, maxdepth=1) or Theme().point_shapes.
There’s also a discrete scale table in the Tutorial.

Gadfly is built on the graphics package Compose.jl, so point_shapes can be extended using Compose forms. Gadfly expects a 3 arg function, but the Compose shapes are more complex:

using Compose, Gadfly
shapes1 = [f(x,y,r)=star(x,y,r, [i], [0.3]) for i = 2:10]
shapes2 = [f(x,y,r)=xgon(x,y,r, [i], [0.3]) for i = 2:10]
shapes3 = [f(x,y,r)=ngon(x,y,r, i) for i = 2:10]
plot(x=1:27, y=rand(27), shape=1:27, 
    Theme(point_size=5pt, point_shapes=[shapes1; shapes2; shapes3],
    discrete_highlight_color=identity, default_color="orange")
)

shape03