Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have loaded data from a CSV file which i want to plot in a BarChart but i only wish to plot 0:100 instead of the entire dataset. Is there a way to set a range for the data?

So far i am just plotting everything:

data = Import["/Users/matek/NetworkTest/without_use_in_and_out.csv", "Table"]

    BarChart[data, ChartLegends -> {"TX", "RX"}],
    ImageSize -> 600


share|improve this question
How about PlotRange? – Teake Nutma Jul 6 '13 at 13:46
@TeakeNutma, my dataset is very big and it would be more suiteable if i could reduce it so the plotting is executed much faster. Else i need to manually manipulate the file, which is quite tedious. – JavaCake Jul 6 '13 at 13:50
Ok, assuming your dataset is of the form data = {{tx_1, ..., tx_n}, {rx_1, ...., rx_n}} with n > 100, you could do dataTrimmed = Take[#,100]& /@ data and plot that. – Teake Nutma Jul 6 '13 at 13:58
@TeakeNutma, i get following error Take::take: Cannot take positions 1 through 100 in {0 0}. >> – JavaCake Jul 6 '13 at 14:12
Looking at the sample data you provided, you might want to try: data[[1;;100]] (see Documentation Center for Span) (or see Transpose and then use @TeakeNutma's idea) – Pinguin Dirk Jul 6 '13 at 14:20

OK, quick example: Compare the first BarChart with the second one where I only used the first 5 elements of data

data = {{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}, {13, 14}};
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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