You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I seem to have found a minor bug when using geom_line with a grouping variable for colour that has >15 categories - the lines all join up to become one continuous line:
% grouping variable for colour
col =1:16;
% create 2D arrays
x = repmat(1:10,16,1);
y = [];
for i =1:length(col)
y(i,:) = col(i)*(x(1,:).^2) + col(i)*100;
end% create 1D column arrays
x2 = reshape(x',[],1);
y2 = reshape(y',[],1);
col2 = reshape(repmat(col,10,1),[],1);
% draw glitchy figure
g1 = gramm('x', x2, 'y', y2, 'color', col2);
g1.geom_line();
figure()
g1.draw();
The bug goes away when the number of categories is <16. With this number of categories it also plots the colors as discrete in the legend, while they are continous in all other cases. The latter is not an issue in my specific example/application, but I'm not sure how it handles when the categories are not numeric and >16.
Yes I did chose 15 as a cutoff value for switching between color as categories and colors as continuous values, the thinking being that it's around that number of groups that the colors become indissociable anyway. I do agree it's a bit arbitrary. An other way to solve the issue and keep more than 15 categories (apart from what you found), is to provide a categorical variable or a cell of strings to specify the color (i.e. something non numeric), it should work correctly.
I do agree that even all that said, your first figure is quite unexpected, I'll try to look if it's an easy fix.
Hi Pier,
Thank you for a wonderful toolbox!
I seem to have found a minor bug when using geom_line with a grouping variable for colour that has >15 categories - the lines all join up to become one continuous line:
The bug goes away when the number of categories is <16. With this number of categories it also plots the colors as discrete in the legend, while they are continous in all other cases. The latter is not an issue in my specific example/application, but I'm not sure how it handles when the categories are not numeric and >16.
I can work around the problem using 'group':
Or by having the input data as 2D arrays rather than column vectors:
The last two both produce the same image:
However, it seems like a bit of a strange cutoff value? Has this been done for a particular reason or is it a genuine bug?
Cheers
The text was updated successfully, but these errors were encountered: