@@ -117,21 +117,26 @@ end
117
117
end
118
118
end
119
119
120
+ # Determine if a color palette is being used so it can be passed to secondary lines
121
+ if :color_palette ∉ keys (plotattributes)
122
+ color_palette = :default
123
+ else
124
+ color_palette = plotattributes[:color_palette ]
125
+ end
126
+
120
127
# Parse different color type
121
128
if groupcolor isa Symbol || groupcolor isa RGB{Float64} || groupcolor isa RGBA{Float64}
122
129
groupcolor = [groupcolor]
123
130
end
131
+
124
132
# Check groupcolor format
125
133
if (groupcolor != = nothing && ndims (y) > 2 ) && length (groupcolor) == 1
126
134
groupcolor = repeat (groupcolor, size (y,3 )) # Use the same color for all groups
127
135
elseif (groupcolor != = nothing && ndims (y) > 2 ) && length (groupcolor) < size (y,3 )
128
136
error (" $(length (groupcolor)) colors given for a matrix with $(size (y,3 )) groups" )
129
- end
130
- # Determine if a color palette is being used so it can be passed to secondary lines
131
- if :color_palette ∉ keys (plotattributes)
132
- color_palette = :default
133
- else
134
- color_palette = plotattributes[:color_palette ]
137
+ elseif groupcolor === nothing
138
+ group_series_index = length (plotattributes[:plot_object ]) + 1
139
+ groupcolor = palette (color_palette)[group_series_index: group_series_index+ size (y,3 )]
135
140
end
136
141
137
142
if errorstyle == :plume && numsecondarylines > size (y,2 ) # Override numsecondarylines
@@ -141,17 +146,16 @@ end
141
146
for g = axes (y,3 ) # Iterate through 3rd dimension
142
147
# Compute center and distribution for each value of x
143
148
y_central, y_error = compute_error (y[:,:,g], centertype, errortype, percentiles)
149
+
144
150
if errorstyle == :ribbon
145
151
seriestype := :path
146
152
@series begin
147
153
x := x
148
154
y := y_central
149
155
ribbon := y_error
150
156
fillalpha --> .1
151
- if groupcolor != = nothing
152
- linecolor := groupcolor[g]
153
- fillcolor := groupcolor[g]
154
- end
157
+ linecolor := groupcolor[g]
158
+ fillcolor := groupcolor[g]
155
159
() # Supress implicit return
156
160
end
157
161
172
176
if secondarycolor === nothing
173
177
linecolor := :gray60
174
178
elseif secondarycolor == :matched
175
- if groupcolor != = nothing
176
- linecolor := groupcolor[g]
177
- else
178
- linecolor := palette (color_palette)[plotattributes[:plot_object ][1 ][end ][:series_index ]+ 1 ]
179
- end
179
+ linecolor := groupcolor[g]
180
180
else
181
181
linecolor := secondarycolor
182
182
end
191
191
primary := true
192
192
x := x
193
193
y := y_central
194
- if groupcolor != = nothing
195
- linecolor := groupcolor[g]
196
- end
194
+ linecolor := groupcolor[g]
197
195
()
198
196
end
199
197
213
211
x := x
214
212
y := y_sub_sample[:,i]
215
213
# Set the stick color
216
- if groupcolor === nothing && (secondarycolor === nothing || secondarycolor == :matched )
217
- linecolor := palette (color_palette)[plotattributes[:plot_object ][1 ][end ][:series_index ]+ 1 ]
218
- elseif groupcolor != = nothing && (secondarycolor == :matched || secondarycolor === nothing )
214
+ if secondarycolor === nothing || secondarycolor == :matched
219
215
linecolor := groupcolor[g]
220
216
else
221
217
linecolor := secondarycolor
@@ -227,14 +223,12 @@ end
227
223
end
228
224
229
225
# Base line
230
- seriestype := :line
226
+ seriestype := :path
231
227
@series begin
232
228
primary := true
233
229
x := x
234
230
y := y_central
235
- if groupcolor != = nothing
236
- linecolor := groupcolor[g]
237
- end
231
+ linecolor := groupcolor[g]
238
232
linewidth --> 3 # Make it stand out against the plume better
239
233
()
240
234
end
0 commit comments