3
$\begingroup$

I have a list point of data per day. I want to plot this list of points in Mathematica and so that the maximum and minimum identified by for example red point. How can I figure it out? In the following my my data are available. Thanks

ClearAll["Global`*"]
dataMT103891062day = {{{95, 5, 1}, 0.0764}, {{95, 5, 2}, 
0.0774}, {{95, 5, 3}, 0.0824}, {{95, 5, 4}, 0.0795}, {{95, 5, 5}, 
0.0887}, {{95, 5, 6}, 0.0867}, {{95, 5, 7}, 0.0794}, {{95, 5, 8}, 
0.0731}, {{95, 5, 9}, 0.0686}, {{95, 5, 10}, 
0.0797}, {{95, 5, 11}, 0.0792}, {{95, 5, 12}, 
0.0874}, {{95, 5, 13}, 0.0814}, {{95, 5, 14}, 
0.0809}, {{95, 5, 15}, 0.0775}, {{95, 5, 16}, 
0.0757}, {{95, 5, 17}, 0.0717}, {{95, 5, 18}, 
0.0811}, {{95, 5, 19}, 0.0773}, {{95, 5, 20}, 
0.0743}, {{95, 5, 21}, 0.0767}, {{95, 5, 22}, 
0.0744}, {{95, 5, 23}, 0.0787}, {{95, 5, 24}, 
0.0772}, {{95, 5, 25}, 0.0916}, {{95, 5, 26}, 
0.0801}, {{95, 5, 27}, 0.0724}, {{95, 5, 28}, 
0.0636}, {{95, 5, 29}, 0.0699}, {{95, 5, 30}, 
0.0634}, {{95, 5, 31}, 0.0695}};
DateListPlot[dataMT103891062day, PlotLegends -> "Load Coefficient"] 
$\endgroup$
1
$\begingroup$

You can use MaximalByand MinimalBy,

{max, min} = {MaximalBy[#, Last], MinimalBy[#, Last]} &@ dataMT103891062day;

Plot them using Epilogattribute.

DateListPlot[dataMT103891062day, PlotLegends -> "Load Coefficient", 
 Epilog -> {PointSize -> Medium, Red, Point@max, Point@min}]

enter image description here

To label the max and min points Labeled can be used as follows.

DateListPlot[{dataMT103891062day, Labeled[min, min, {Right}], 
  Labeled[max, max, {Right}]}, PlotLabel -> "Load Coefficient", 
 Epilog -> {PointSize -> Medium, Red, Point@max, Point@min}, ImageSize -> Medium]
$\endgroup$
  • $\begingroup$ Thanks dear Anjan Kumar. What shall I do if I want to show coordinates of the maximum and minimum points? $\endgroup$ – HS8637 Apr 10 '17 at 6:49
  • $\begingroup$ @HadiSobhani Check the edit. $\endgroup$ – Anjan Kumar Apr 10 '17 at 7:45

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.