1
$\begingroup$

I am trying to plot the following figures but I cannot get the date range that I would like to have. I would like to have a date range like 1960,1970,1980....2020

exter={{22.2478, 22.2613, 22.2361, 22.2683, 22.3835, 22.5375, 22.4802, 
         22.5564, 22.5688, 22.5644, 22.6113, 22.6104, 22.6985, 22.6889, 
         22.7512, 22.7282, 22.7886, 22.7418, 22.7474, 22.7167, 22.7466, 
         22.8064, 22.7779, 22.758, 22.7547, 22.7707, 22.7779, 22.8043, 
         22.8652, 22.8549, 22.8501, 22.8497, 22.8323, 22.898, 22.8078, 
         22.8364, 22.8967, 22.9342, 22.9303, 22.9757, 23.014, 23.0658, 
         23.1099, 23.177, 23.245, 23.3148, 23.3909, 23.4711, 23.546, 23.6342,
         23.7322, 23.7863, 23.8596, 23.9089, 23.9548, 23.9836, 24.0191, 
         Log[""]}, 
        {21.9362, 21.9975, 22.0117, 22.0723, 22.0611, 22.1091, 
         22.1242, 22.2045, 22.2241, 22.3412, 22.5447, 22.6301, 22.7101, 
         22.7358, 22.8, 22.7805, 22.7851, 22.714, 22.6866, 22.719, 22.8537, 
         22.9718, 22.9978, 23.0135, 22.9942, 23.0614, 23.0821, 23.0936, 
         23.1664, 23.2171, 23.2846, 23.3385, 23.244, 23.2544, 23.3428, 
         23.3444, 23.4429, 23.4694, 23.4978, 23.4896, 23.4586, 23.4729, 
         23.3797, 23.1934, 23.1336, 23.0748, 23.0396, 23.0024, 22.8079, 
         22.9214, 23.0399, 23.1836, 23.3214, 23.3752, 23.3963, 23.413, 
         23.4192}}

My code so far is:

DateListPlot[exter, {1960}, Frame -> True, 
    PlotStyle -> {{Thick, Blue}, {Dashed, Red}}, 
    PlotRange -> All, Joined -> True, 
    FrameLabel -> {"Years", "Log GDP"}, 
    LabelStyle -> Directive[Black, Bold], 
    ImageSize -> 450, AspectRatio -> 0.75, 
    ImageMargins -> 60]

enter image description here

$\endgroup$
1
  • $\begingroup$ THE CODE DateListPlot[exter, {1960}, Frame -> True, PlotStyle -> {{Thick, Blue}, {Dashed, Red}}, PlotRange -> All, Joined -> True, FrameLabel -> {"Years", "Log GDP"}, LabelStyle -> Directive[Black, Bold], ImageSize -> 450, AspectRatio -> 0.75, ImageMargins -> 60] $\endgroup$
    – Jamy
    Commented Jun 1, 2018 at 3:17

1 Answer 1

2
$\begingroup$

I think you're just missing one or two bits:

  1. The date spec {1960} starts in 1960 and goes through today. You can use {{1960}, {2020}} to go all the way to 2020.

  2. You can specify the ticks to show using something like:

    FrameTicks -> {{Automatic, Automatic}, {Table[{y}, {y, 1960, 2020, 10}], None}}

Those frame ticks will be minimal, just labeling the decades on the bottom frame edge. You can add minor ticks on the bottom edge and unlabeled ticks on the top edge with a bit more code.

$\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.