4
$\begingroup$

I have some data that spans across a whole year from January 8 to December 31, 2023:

data = Import["https://pastebin.com/raw/jCmpsS42", "Table"];

Which is shown as a discrete plot:

DateListStepPlot[Flatten[data, 1], {{2023, 1, 8}, {2023, 12, 31}}, 
 FrameTicks -> {{Automatic, 
    Automatic}, {Table[{{2023, Month[[1]], 1}, 
      Month[[2]]}, {Month, {Range[13], {"Jan", "Fev", "Mar", "Abr", 
         "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez", 
         "Jan"}}\[Transpose]}], None}}, PlotRange -> {{-3, 3}}, 
 ImageSize -> 1000, AspectRatio -> 1/10]

enter image description here

I selected only the dates for which the variable is greater than 1.654:

list = Select[
  Table[{n, Flatten[data, 1][[n]]}, {n, 1, 358}], #[[2]] > 1.654 &]

Which gives a list:

{{2, 1.92582}, {27, 1.74546}, {29, 1.85577}, {43, 1.85577}, {108, 
  1.74546}, {148, 1.72695}, {182, 1.88484}, {198, 1.99481}, {244, 
  1.7828}, {275, 1.99481}, {323, 1.72695}, {358, 1.74546}}

How can I highlight those dates in the DateListStepPlot? Something like this, but for all the twelve dates:

enter image description here

Also, how can I convert the list to the actual date/month format starting from January 8?

$\endgroup$
2
  • $\begingroup$ Please include a small portion of your data. $\endgroup$ Mar 6 at 21:21
  • $\begingroup$ @DanielHuber The data is included in the pastebin link. $\endgroup$
    – Rodrigo
    Mar 6 at 21:37

1 Answer 1

4
$\begingroup$
data = Import["https://pastebin.com/raw/jCmpsS42", "Table"];

data2 = Table[{DateObject[{2023, 1, 8 + n - 1}], data[[n, 1]]}, {n, Length[data]}];

This gives a list of the form enter image description here

gooddays = Select[data2, #[[2]] > 1.654 &]

enter image description here

DateListStepPlot[data2, PlotRange -> {{-3, 3}}, ImageSize -> 1000, 
 AspectRatio -> 1/10, Epilog -> {Red, Point /@ gooddays}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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