0
$\begingroup$

I have the following data. Now, I not only wish to plot a specific row of the data, but also a subset of the columns in the chosen row. I can work out the first part, but plotting a specific part of the columns I cannot.

data = {{{1, 10, 100}, {2, 20, 200}, {3, 30, 300}}}

My attempt for row 2 is:

ListLinePlot[data[[1 ;; 1, 2]]]
$\endgroup$
  • 1
    $\begingroup$ try ListLinePlot[data[[1,2, {2,3}]]] to plot row 2 and columns 2 and 3. $\endgroup$ – kglr May 29 at 11:14
  • $\begingroup$ What if I needed columns c through c+n? $\endgroup$ – user120911 May 29 at 11:48
  • 1
    $\begingroup$ use ListLinePlot[data[[1,2,c;;c+n}]]] $\endgroup$ – kglr May 29 at 11:53
  • 1
    $\begingroup$ Here's the manual on how to extract rows and columns. $\endgroup$ – Roman May 29 at 12:03
  • $\begingroup$ It was the curly brackets that got me. I tried {c;;c+n}. By the way, your comment still has a curly bracket. The solution, of course, works when that is removed. $\endgroup$ – user120911 May 29 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.