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).

  • $\begingroup$ What did you try? Which functions? Any sample data? $\endgroup$ – Pinguin Dirk Sep 29 '13 at 19:57

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


Your Answer

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

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