I've asked a similar question before, but this time I have a slightly more complicated issue. I have a list of lists, and I want to show a few of the lines in the list.

The following code will plot code 36 lines:

Show[ListLinePlot[allbeeposition[[1 ;; 36]]]]

Instead, how could I show only a few lines, then skip a few more, and then show another group of lines? For example: plot the first 3 lines, then skip 3, then plot the next 3, then skip 3 etc (on the same graph).

  • 1
    $\begingroup$ A possible hint at a solution: alist = Range[30]; blist = Flatten[#, 1] &@Partition[alist, 3][[1 ;; -1 ;; 2]]; and NumberLinePlot[{alist, blist}] $\endgroup$
    – Syed
    Commented May 9, 2022 at 10:12
  • $\begingroup$ To manipulate lists see the tutorial on Lists $\endgroup$
    – Bob Hanlon
    Commented May 9, 2022 at 12:24

1 Answer 1


Thanks Syed, use Flatten and Partition solved the problem.

For my case I used the code:

blist= Flatten[alist[[fromHere ;; upToHere]]];                            
blist= Partition[blist,numbersIwant,numbersIwant+numberToSkip];            
blist= Flatten[blist];                                                     
blist= Partition[blist,returnPartitionSizeOFalist]

and with numbers for example:

blist= Flatten[alist[[1 ;; 36]]];                            
blist= Partition[blist,3*8,6*8];            
blist= Flatten[blist];                                                     
blist= Partition[blist,8]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.