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 am using discrete plot to plot a 1D array. But I want to plot some points specified by a span in one style (for example, in red) and the rest points in other style (e.g. in blue).

share|improve this question
What did you try? Which functions? Any sample data? – Pinguin Dirk Sep 29 '13 at 19:57
up vote 3 down vote accepted

This works pretty like you already said it. You can use Span to extract any interval of points you like. If you then plot a list of intervals with e.g. ListPlot, you can style them all differently

data = Table[{x, Sin[x]}, {x, 0, 2 Pi, .1}];
ListPlot[{data[[;; 43]], data[[44 ;;]]},
 PlotStyle -> {{Red}, {Blue}}]

Mathematica graphics

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.