0
$\begingroup$

everyone.

I have prepared a code in which a file of data to be called and its data will be used to make a plot. I wanted to divide the x axis, as I needed but the output is not what I need. I want to divide the x axis into 12 or 24 equal intervals. It's kind of if you help me. In the following, you can see the code and its output

Best regards.

ClearAll["Global`*"]
P = Abs[Import["https://pastebin.com/raw/VqZFMsSf", "List"]];
rec = Table[i, {i, 1, Length[P]}];
data = Transpose@{rec, P};
{maxn, minn} = {MaximalBy[#, Last], MinimalBy[#, Last]} &@data;

p1 = DateListPlot[{data, Labeled[maxn, "{{95,5,4},234.6}", {Right}]}, 
  Epilog -> {PointSize -> Medium, Red, Point@maxn}, 
Frame -> True, 
  FrameTicks -> {{Automatic, None}, {{2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24}, None}}, 
FrameLabel -> {"Day", "\!\(\*SubscriptBox[\(P\), \(total\)]\)"}]
Export["103MT880823-day.pdf", p1];
Print["The maximum is = ", Max[P]];
Print["The Minimum is = ", Min[P]];

The result

$\endgroup$
  • $\begingroup$ Where is P-5-4-95.dat, so that other people can try things out? $\endgroup$ – J. M. is away Sep 5 '17 at 4:42
  • $\begingroup$ I don't know how I can upload its file. By the way, here is its data -181 -182.9 -173.4 -165.1 -155 -152.7 -149.8 -146.5 -146.4 -145.8 -140.7 -134.6 -121.9 -114.1 -108.5 -110.2 -116 -116.6 -123.4 -136.9 -148.8 -165.1 -175.2 -179.7 -175.8 -178.4 -180.4 -167.2 -180.6 -187.5 -200.9 -194.7 -190.3 -202.5 -200.8 -211.7 -227.6 -234.6 -233.4 -216 -217.3 -202.7 -214.5 -211.8 -213.6 -209.3 -197.8 -194.8 $\endgroup$ – HS8637 Sep 5 '17 at 4:50
  • $\begingroup$ I would suggest pasting the contents of the *.dat file into Pastebin, and post the link here. $\endgroup$ – J. M. is away Sep 5 '17 at 5:00
  • $\begingroup$ Is there any option to upload a file there? $\endgroup$ – HS8637 Sep 5 '17 at 5:03
  • 1
    $\begingroup$ Try this FrameTicks setting instead: FrameTicks -> {{Automatic, None}, {{#, IntegerString[#/2]} & /@ Range[0, 48, 4], None}}. $\endgroup$ – J. M. is away Sep 5 '17 at 5:50

Your Answer

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

Browse other questions tagged or ask your own question.