I need to automatically extend or truncate a colour list to suit number of points in plottools:-point plot.
extending the list the colour sequence could be repeated or if the is too awkard just add black.
I can't figure out how to select the list of colours to put into a new list to modify.
This will be inside a plotting procedure.
![[BinaryPlace, BinarySearch, Categorize, Classify, Collect, Deal, DotProduct, Enumerate, FindMaximalElement, FindMinimalElement, FindRepetitions, Flatten, FlattenOnce, Group, Interleave, InversePermutation, Join, JoinSequence, LengthSplit, MakeUnique, Occurrences, Pad, PartialSums, Reverse, Rotate, Search, SearchAll, SelectFirst, SelectLast, Slice, Sorted, Split, Transpose, Unpermute]](/view.aspx?sf=238962_question/8f5fe9a47769da52e11f77bd5625d309.gif)
|
(1) |
> |
L:=[[1,2],[3,4],[-5,6],[-3,-2]]
|
![[[1, 2], [3, 4], [-5, 6], [-3, -2]]](/view.aspx?sf=238962_question/d80c360bddcd606d7bddee716374e1e7.gif)
|
(2) |

|
(3) |
> |
styles:=[symbol=solidcircle,colour=[red,green,blue,orange],symbolsize=12]
|
![[symbol = solidcircle, colour = [red, green, blue, orange], symbolsize = 12]](/view.aspx?sf=238962_question/c16b9c68649aa77329b3d973b449e3dd.gif)
|
(4) |
> |
plots:-display(plottools:-point(L,styles[]))
|
> |
#Need to extend or truncate the list of colours to match the number of points
#styles can be copied to styles 1,2 etc
#the extended list would be a repeatition of the colour sequence given
#would need to look for color or colour;
has(styles,colour); #how to select colour our into a seperate list?
|

|
(5) |
> |
#too few point for the colours;
L1:=[[1,2],[3,4],[-5,6]]
|
![[[1, 2], [3, 4], [-5, 6]]](/view.aspx?sf=238962_question/6ecef63e2422ef8da349b190355f103f.gif)
|
(6) |
> |
plots:-display(plottools:-point(L1,styles[]))
|
> |
#too many point for the colours;
L2:=[[1,2],[3,4],[-5,6],[-3,-2],[6-1],[0,1]]
|
![[[1, 2], [3, 4], [-5, 6], [-3, -2], [5], [0, 1]]](/view.aspx?sf=238962_question/d3013075aa3c0e7763a5d5d8e5ee7501.gif)
|
(7) |
> |
plots:-display(plottools:-point(L2,styles[]))
|
|
Download 2024-09-06_Q_Extend_or_Truncate_List_of_Colours.mw