0
$\begingroup$

I have the following vector:

tn = {0.521084, 0.114895, 0.114895, 0.114895, 0.114895, 0.521084, 0.114895,
0.114895}

I would like to try a ListStepPlot such that tn[[1]] has a blue plotmarker, tn[[2;;5]] have red plotmarkers, tn[[6]] has a green plotmarker and, finally, tn[[7;;8]] have orange plotmarkers. How can I do this?

$\endgroup$
0
$\begingroup$

Changed answer to meet the meaning of the question.

First, divide oroginal list to sublists corresponding colors:

points = MapIndexed[{First@#2, #1} &, tn]

Now we can plot with different plot markers:

ListPlot[{{points[[1]]}, points[[2 ;; 5]], {points[[6]]},
points[[7 ;; 8]]}, PlotMarkers -> {Blue, Red, Green, Orange}]

enter image description here

The shapes and sizes of markers can also be adjusted: Style[\[FilledCircle], Blue, 20] instead of Blue etc.

$\endgroup$
  • $\begingroup$ Soory, I would like to have different plotmarkers... $\endgroup$ – Gae P Sep 13 at 9:45
  • 1
    $\begingroup$ @GaeP, I've edited answer. Does it now meet your request? $\endgroup$ – Alx Sep 13 at 23:57
3
$\begingroup$
tn = {0.521084, 0.114895, 0.114895, 0.114895, 0.114895, 0.521084, 0.114895, 0.114895};
colors = {Blue, Red, Red, Red, Red, Green, Orange, Orange};
ListStepPlot[tn, Ticks -> {{#, #, {0.02, 0}, colors[[#]]} & /@ Range[8], Automatic}]

enter image description here

$\endgroup$

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.