4
$\begingroup$

Bug introduced in 10.0.0 and persisting through 11.0.1 or later


I'm trying to use SetOptions to set the global font size for DateListPlot plots. My problem is that this is not working. Even this simple test does not change the font size:

SetOptions[DateListPlot, BaseStyle -> FontSize -> 20];
DateListPlot[{{"2010-10-10", 4.1`}, {"2010-10-17", 8}, {"2010-10-24", 
   5.6`}, {"2010-10-31", 8.6`}}, PlotLabel -> "Test"]

Is there other way to change the predefined fontsize in DateListPlot?

EDIT: I'm using Mathematica 10.0.2.0 in Linux x86 (64-bit)

$\endgroup$
  • $\begingroup$ It works here on MMA8/MacOSX. Also, try setting option for Graphics, instead of DataListPlot. $\endgroup$ – enzotib Mar 30 '15 at 15:48
  • 1
    $\begingroup$ Works fine on V9 but have the same problem as you with 10.0.2 on OS X. I also tried BaseStyle -> Directive[FontSize -> 48] and BaseStyle -> {FontSize -> 48}. Yet another V10 bug (am adding the tag). When is 10.0.3 coming out? $\endgroup$ – Mike Honeychurch Mar 30 '15 at 22:36
  • $\begingroup$ Ok, thanks. I'll try with V9. $\endgroup$ – Miguel Mar 31 '15 at 13:13
  • $\begingroup$ Still broken in 10.2. $\endgroup$ – Gustavo Delfino Oct 22 '15 at 19:06
  • $\begingroup$ Just upgraded to 10.3 and the issue is still there. Has this been reported to Wolfram? $\endgroup$ – Gustavo Delfino Oct 22 '15 at 20:31
3
$\begingroup$

This can easily be fixed by adding the missing BaseStyle -> Graphics`DateListPlotDump`basestyle to Graphics`DateListPlotDump`options

So if you either execute the code below before calling DateListPlot or put this into your init.m file, then SetOptions just works.

I am sure this will be fixed in the next release (since the fix is so easy).

What I really like about the Wolfram system is that it is so open and that you can fix quite a lot of (kernel) bugs yourself (if you are in the mood and have the time, of course). Unfortunately for the FrontEnd bugs that seems not to be true.

DownValues[Graphics`DateListPlotDump`iDateListPlot] = 
   {HoldPattern[Graphics`DateListPlotDump`iDateListPlot[Graphics`DateListPlotDump`datalist_, Graphics`DateListPlotDump`step_, 
       Graphics`DateListPlotDump`caller_, Graphics`DateListPlotDump`o___]] :> 
     Module[{Graphics`DateListPlotDump`newdata, Graphics`DateListPlotDump`datedata, Graphics`DateListPlotDump`secondsdata, 
       Graphics`DateListPlotDump`tickvals, Graphics`DateListPlotDump`frametickvals, Graphics`DateListPlotDump`pltrange, 
       Graphics`DateListPlotDump`axorigin, Graphics`DateListPlotDump`axesopt, Graphics`DateListPlotDump`frameopt, Graphics`DateListPlotDump`multilist, 
       Graphics`DateListPlotDump`ticksopt, Graphics`DateListPlotDump`frameticksopt, Graphics`DateListPlotDump`gridlineopt, 
       Graphics`DateListPlotDump`epilogopt, Graphics`DateListPlotDump`prologopt, Graphics`DateListPlotDump`dtformatopt, 
       Graphics`DateListPlotDump`prpadding, Graphics`DateListPlotDump`gridlinestyleopt, Graphics`DateListPlotDump`nonemptydata = True, 
       Graphics`DateListPlotDump`dtfun, Graphics`DateListPlotDump`datarangeopt, Graphics`DateListPlotDump`tooltipdataQ, 
       Graphics`DateListPlotDump`vectordata, Graphics`DateListPlotDump`plot, Graphics`DateListPlotDump`plotlegends, Graphics`DateListPlotDump`theme, 
       Graphics`DateListPlotDump`opts, Graphics`DateListPlotDump`flag, Graphics`DateListPlotDump`modelData, Graphics`DateListPlotDump`options, 
       Graphics`DateListPlotDump`coordinatesize, Graphics`DateListPlotDump`temporaldatalength, Graphics`DateListPlotDump`plotstyle, 
       Graphics`DateListPlotDump`plotmarkers, Graphics`DateListPlotDump`joined, Graphics`DateListPlotDump`newplotstyle, 
       Graphics`DateListPlotDump`basestyle, Graphics`DateListPlotDump`labelstyle, Graphics`DateListPlotDump`data, 
       Graphics`DateListPlotDump`targetunits, Graphics`DateListPlotDump`defaultstyle, Graphics`DateListPlotDump`premethod, 
       Graphics`DateListPlotDump`method, Graphics`DateListPlotDump`n}, Graphics`DateListPlotDump`opts = Flatten[{Graphics`DateListPlotDump`o}]; 
       Quiet[Graphics`DateListPlotDump`theme = OptionValue[{Graphics`DateListPlotDump`caller, Graphics`DateListPlotDump`iDateListPlot}, 
          Graphics`DateListPlotDump`opts, PlotTheme]]; Graphics`DateListPlotDump`theme = Charting`ResolvePlotTheme[Graphics`DateListPlotDump`theme, 
         Graphics`DateListPlotDump`caller]; Quiet[Graphics`DateListPlotDump`premethod = OptionValue[Graphics`DateListPlotDump`caller, 
          Graphics`DateListPlotDump`theme, Method]]; Graphics`DateListPlotDump`premethod = Charting`ConstructMethod[
         Graphics`DateListPlotDump`premethod]; Graphics`DateListPlotDump`theme = FilterRules[Graphics`DateListPlotDump`theme, Except[Method]]; 
       Graphics`DateListPlotDump`theme = FilterRules[Graphics`DateListPlotDump`theme, Join[Options[Graphics`DateListPlotDump`caller], 
          Options[Graphics`DateListPlotDump`iDateListPlot]]]; Graphics`DateListPlotDump`opts = Join[Graphics`DateListPlotDump`opts, 
         Graphics`DateListPlotDump`theme]; {Graphics`DateListPlotDump`pltrange, Graphics`DateListPlotDump`axorigin, 
         Graphics`DateListPlotDump`gridlineopt, Graphics`DateListPlotDump`gridlinestyleopt, Graphics`DateListPlotDump`epilogopt, 
         Graphics`DateListPlotDump`prologopt, Graphics`DateListPlotDump`frameopt, Graphics`DateListPlotDump`axesopt, 
         Graphics`DateListPlotDump`ticksopt, Graphics`DateListPlotDump`frameticksopt, Graphics`DateListPlotDump`dtformatopt, 
         Graphics`DateListPlotDump`dtfun, Graphics`DateListPlotDump`datarangeopt, Graphics`DateListPlotDump`prpadding, 
         Graphics`DateListPlotDump`plotlegends, Graphics`DateListPlotDump`plotstyle, Graphics`DateListPlotDump`plotmarkers, 
         Graphics`DateListPlotDump`joined, Graphics`DateListPlotDump`basestyle, Graphics`DateListPlotDump`labelstyle, 
         Graphics`DateListPlotDump`targetunits, Graphics`DateListPlotDump`method} = 
        Quiet[OptionValue[{Graphics`DateListPlotDump`caller, Graphics`DateListPlotDump`iDateListPlot}, Graphics`DateListPlotDump`opts, 
          {PlotRange, AxesOrigin, GridLines, GridLinesStyle, Epilog, Prolog, Frame, Axes, Ticks, FrameTicks, DateTicksFormat, DateFunction, DataRange, 
           PlotRangePadding, PlotLegends, PlotStyle, PlotMarkers, Joined, BaseStyle, LabelStyle, TargetUnits, Method}]]; 
       Graphics`DateListPlotDump`method = Charting`parseMethod[Charting`ConstructMethod[Graphics`DateListPlotDump`method], 
         Graphics`DateListPlotDump`premethod]; {Graphics`DateListPlotDump`defaultstyle} = 
        Quiet[OptionValue[{Graphics`DateListPlotDump`caller, Graphics`DateListPlotDump`iDateListPlot}, 
          Flatten[{Graphics`DateListPlotDump`method, Graphics`DateListPlotDump`opts}], {"DefaultPlotStyle"}]]; 
       If[Graphics`DateListPlotDump`ticksopt === Automatic, Graphics`DateListPlotDump`ticksopt = {Automatic}]; 
       If[Graphics`DateListPlotDump`frameticksopt === True, Graphics`DateListPlotDump`frameticksopt = {Automatic}]; 
       If[Graphics`DateListPlotDump`frameticksopt === False, Graphics`DateListPlotDump`frameticksopt = None]; 
       If[Graphics`DateListPlotDump`frameticksopt === Automatic, Graphics`DateListPlotDump`frameticksopt = {Automatic}]; 
       If[Graphics`DateListPlotDump`dtformatopt === Automatic, Graphics`DateListPlotDump`dtformatopt = {Automatic}]; 
       If[Graphics`DateListPlotDump`dtformatopt =!= {Automatic}, If[ !FreeQ[Quiet[DateString[DateList[], Graphics`DateListPlotDump`dtformatopt]], 
           DateString], Message[Graphics`DateListPlotDump`caller::notdtf, Graphics`DateListPlotDump`dtformatopt]; Return[$Failed]]]; 
           Graphics`DateListPlotDump`gridlineopt = Graphics`DateListPlotDump`gridlineopt /. {True -> Automatic, False -> None}; 
           Graphics`DateListPlotDump`epilogopt = Graphics`DateListPlotDump`epilogopt /. Charting`timeCoordRule; 
           Graphics`DateListPlotDump`prologopt = Graphics`DateListPlotDump`prologopt /. Charting`timeCoordRule; 
           If[Graphics`DateListPlotDump`axesopt === Automatic, Graphics`DateListPlotDump`axesopt = FreeQ[Graphics`DateListPlotDump`frameopt, 
              Automatic | True]]; Charting`dbPrint["======= Date Plot Parser ======="]; Graphics`DateListPlotDump`coordinatesize = {1, Infinity}; 
           Graphics`DateListPlotDump`flag = Charting`DatePlotParser[Graphics`DateListPlotDump`caller, Graphics`DateListPlotDump`modelData, 
             Graphics`DateListPlotDump`datalist, Graphics`DateListPlotDump`dtfun, Graphics`DateListPlotDump`coordinatesize, 
             "DateStep" -> Graphics`DateListPlotDump`step, "DataRange" -> Graphics`DateListPlotDump`datarangeopt, 
             "TargetUnits" -> Graphics`DateListPlotDump`targetunits]; If[Graphics`DateListPlotDump`flag === $Failed, 
        Message[Graphics`DateListPlotDump`caller::ldata, Graphics`DateListPlotDump`datalist]; Throw[$Failed, "ParseNoData"]]; 
       Graphics`DateListPlotDump`newdata = Graphics`DateListPlotDump`modelData["Values"]; Graphics`DateListPlotDump`datedata = 
        Graphics`DateListPlotDump`modelData["DatesValues"]; Graphics`DateListPlotDump`secondsdata = Graphics`DateListPlotDump`modelData[
         "SecondsData"]; Graphics`DateListPlotDump`multilist = Graphics`DateListPlotDump`modelData["MultipleListDataQ"]; 
       Graphics`DateListPlotDump`nonemptydata =  !Graphics`DateListPlotDump`modelData["EmptyDataQ"]; Graphics`DateListPlotDump`vectordata = 
        Graphics`DateListPlotDump`modelData["VectorDataQ"]; Graphics`DateListPlotDump`tooltipdataQ = Graphics`DateListPlotDump`modelData[
         "HasWrapperQ"]; Graphics`DateListPlotDump`temporaldatalength = Graphics`DateListPlotDump`modelData["TemporalDataLength"]; 
       Graphics`DateListPlotDump`targetunits = Graphics`DateListPlotDump`modelData["Units"]; Graphics`DateListPlotDump`targetunits = 
        Switch[Graphics`DateListPlotDump`targetunits, {_, _}, Graphics`DateListPlotDump`targetunits, None | Automatic, {None, None}, _, 
         {None, Graphics`DateListPlotDump`targetunits}]; If[TrueQ[Graphics`DateListPlotDump`multilist] && 
          !TrueQ[Graphics`DateListPlotDump`vectordata], Graphics`DateListPlotDump`datedata = Union[Join @@ Graphics`DateListPlotDump`datedata]]; 
       Graphics`DateListPlotDump`datedata = If[ListQ[Graphics`DateListPlotDump`datedata], If[Length[Graphics`DateListPlotDump`datedata] > 0, 
          Sort[Flatten[Graphics`DateListPlotDump`secondsdata]][[{1, -1}]], Automatic], Graphics`DateListPlotDump`datedata]; 
       Charting`dbPrint["======= ================ ======="]; Graphics`DateListPlotDump`datedata = DateList /@ Graphics`DateListPlotDump`datedata; 
       If[Length[Graphics`DateListPlotDump`datarangeopt] === 2, Graphics`DateListPlotDump`datedata = 
         Sort[(Graphics`DateListPlotDump`toProperDateList[#1 /. Graphics`DateListPlotDump`toDateListRule] & ) /@ 
           Graphics`DateListPlotDump`datarangeopt]]; Graphics`DateListPlotDump`prpadding = If[Graphics`DateListPlotDump`prpadding === Automatic, 
         If[MemberQ[{Full, All, Automatic}, Graphics`DateListPlotDump`pltrange] || (Length[Graphics`DateListPlotDump`pltrange] === 2 && 
            MemberQ[{Full, All, Automatic}, Graphics`DateListPlotDump`pltrange[[1]]]), Scaled[0.02], 0], Graphics`DateListPlotDump`prpadding]; 
       If[Visualization`Utilities`AxesQ[Graphics`DateListPlotDump`axesopt], Graphics`DateListPlotDump`axesopt = 
         Visualization`Utilities`AxesExpand[Graphics`DateListPlotDump`axesopt], Graphics`DateListPlotDump`axesopt = 
         Visualization`Utilities`AxesExpand[False]]; If[Visualization`Utilities`TicksQ[Graphics`DateListPlotDump`ticksopt], 
        Graphics`DateListPlotDump`ticksopt = Visualization`Utilities`TicksExpand[Graphics`DateListPlotDump`ticksopt], 
        Graphics`DateListPlotDump`ticksopt = Visualization`Utilities`TicksExpand[Automatic]]; Graphics`DateListPlotDump`tickvals = 
        Graphics`DateListPlotDump`ticksopt; Graphics`DateListPlotDump`tickvals[[1]] = If[Graphics`DateListPlotDump`axesopt[[1]] =!= False, 
         With[{Graphics`DateListPlotDump`t1 = Graphics`DateListPlotDump`ticksopt[[1]], Graphics`DateListPlotDump`dateformat = 
            Graphics`DateListPlotDump`dtformatopt, Graphics`DateListPlotDump`pad = Graphics`DateListPlotDump`prpadding}, 
          Charting`getDateTicks[Graphics`DateListPlotDump`t1, Graphics`DateListPlotDump`dateformat, DateList /@ {##1}, 
            Graphics`DateListPlotDump`pad] & ], False]; If[Visualization`Utilities`FrameQ[Graphics`DateListPlotDump`frameopt], 
        Graphics`DateListPlotDump`frameopt = Visualization`Utilities`FrameExpand[Graphics`DateListPlotDump`frameopt], 
        Graphics`DateListPlotDump`frameopt = Visualization`Utilities`FrameExpand[True]]; 
       If[Visualization`Utilities`FrameTicksQ[Graphics`DateListPlotDump`frameticksopt], Graphics`DateListPlotDump`frameticksopt = 
         Visualization`Utilities`FrameTicksExpand[Graphics`DateListPlotDump`frameticksopt], Graphics`DateListPlotDump`frameticksopt = 
         Visualization`Utilities`FrameTicksExpand[Automatic]]; Graphics`DateListPlotDump`frametickvals = Graphics`DateListPlotDump`frameticksopt; 
       Graphics`DateListPlotDump`frametickvals[[2,1]] = If[ !MatchQ[Graphics`DateListPlotDump`frameticksopt[[2,1]], False | None], 
         With[{Graphics`DateListPlotDump`t1 = Graphics`DateListPlotDump`frametickvals[[2,1]], Graphics`DateListPlotDump`dateformat = 
            Graphics`DateListPlotDump`dtformatopt, Graphics`DateListPlotDump`pad = Graphics`DateListPlotDump`prpadding}, 
          Charting`getDateTicks[Graphics`DateListPlotDump`t1, Graphics`DateListPlotDump`dateformat, DateList /@ {##1}, 
            Graphics`DateListPlotDump`pad] & ], None]; Graphics`DateListPlotDump`frametickvals[[2,2]] = 
        If[ !MatchQ[Graphics`DateListPlotDump`frameticksopt[[2,2]], False | None], 
         With[{Graphics`DateListPlotDump`t1 = Graphics`DateListPlotDump`frametickvals[[2,2]], Graphics`DateListPlotDump`dateformat = 
            Graphics`DateListPlotDump`dtformatopt, Graphics`DateListPlotDump`pad = Graphics`DateListPlotDump`prpadding}, 
          Charting`getDateTicks[Graphics`DateListPlotDump`t1, Graphics`DateListPlotDump`dateformat, DateList /@ {##1}, 
             Graphics`DateListPlotDump`pad] /. _String :> Spacer[{0, 0}] & ], None]; Graphics`DateListPlotDump`gridlineopt = 
        Charting`fixDateGridLines[Graphics`DateListPlotDump`gridlineopt, Graphics`DateListPlotDump`gridlinestyleopt, 
         Graphics`DateListPlotDump`frametickvals, Graphics`DateListPlotDump`tickvals]; Graphics`DateListPlotDump`axorigin = 
        Graphics`DateListPlotDump`fixAxesOrigin[Graphics`DateListPlotDump`axorigin, Graphics`DateListPlotDump`nonemptydata, 
         Graphics`DateListPlotDump`multilist, Graphics`DateListPlotDump`pltrange, Graphics`DateListPlotDump`datarangeopt, 
         Graphics`DateListPlotDump`secondsdata, Graphics`DateListPlotDump`datedata]; Graphics`DateListPlotDump`pltrange = 
        Charting`adjustDateRange[Graphics`DateListPlotDump`pltrange]; Graphics`DateListPlotDump`datarangeopt = 
        Graphics`DateListPlotDump`fixDataRange[Graphics`DateListPlotDump`datarangeopt]; Charting`dbPrint["datarangeopt: ", 
        Graphics`DateListPlotDump`datarangeopt]; Graphics`DateListPlotDump`n = Length[Graphics`DateListPlotDump`temporaldatalength]; 
       Graphics`DateListPlotDump`plotstyle = Switch[Graphics`DateListPlotDump`plotstyle, Automatic, Table[Directive[], {Graphics`DateListPlotDump`n}], 
         _List, If[Graphics`DateListPlotDump`n === 1, {Charting`ConstructDirective[Graphics`DateListPlotDump`plotstyle]}, 
          Charting`padList[Graphics`DateListPlotDump`plotstyle, Graphics`DateListPlotDump`n]], _Integer, 
         ColorData[Graphics`DateListPlotDump`plotstyle] /@ Range[Graphics`DateListPlotDump`n], _?DataPaclets`ColorData`GradientsStringQ, 
         ColorData[Graphics`DateListPlotDump`plotstyle] /@ (Range[Graphics`DateListPlotDump`n]/Graphics`DateListPlotDump`n), _, 
         Charting`padList[{Graphics`DateListPlotDump`plotstyle}, Graphics`DateListPlotDump`n]]; Graphics`DateListPlotDump`newplotstyle = 
        Flatten[MapThread[If[#2 === 1, Charting`ConstructDirectiveOrNone[#1], Charting`ConstructDirectiveOrNone /@ Charting`padList[#1, #2]] & , 
          {Graphics`DateListPlotDump`plotstyle, Graphics`DateListPlotDump`temporaldatalength}]]; Graphics`DateListPlotDump`newplotstyle = 
        Charting`customStyle[Graphics`DateListPlotDump`newplotstyle, Graphics`DateListPlotDump`defaultstyle, 
         Total[Graphics`DateListPlotDump`temporaldatalength]]; Graphics`DateListPlotDump`data = Graphics`DateListPlotDump`modelData[
         "WrappedDatedValues"]; Graphics`DateListPlotDump`data = Charting`wrapperReattach[Graphics`DateListPlotDump`data, 
         Graphics`DateListPlotDump`modelData]; Graphics`DateListPlotDump`data = Developer`ToPackedArray[N[Graphics`DateListPlotDump`data]]; 
       Graphics`DateListPlotDump`opts = FilterRules[Graphics`DateListPlotDump`opts, Options[If[Graphics`DateListPlotDump`caller === DateListLogPlot, 
           ListLogPlot, ListPlot]]]; Graphics`DateListPlotDump`options = Flatten[{BaseStyle -> Graphics`DateListPlotDump`basestyle, 
          TargetUnits -> Graphics`DateListPlotDump`targetunits, Frame -> Graphics`DateListPlotDump`frameopt, 
          FrameTicks -> Graphics`DateListPlotDump`frametickvals, Axes -> Graphics`DateListPlotDump`axesopt, 
          Ticks -> Graphics`DateListPlotDump`tickvals, PlotRange -> Graphics`DateListPlotDump`pltrange, 
          PlotStyle -> Graphics`DateListPlotDump`newplotstyle, AxesOrigin -> Graphics`DateListPlotDump`axorigin, 
          GridLines -> Graphics`DateListPlotDump`gridlineopt, Epilog -> Graphics`DateListPlotDump`epilogopt, 
          Prolog -> Graphics`DateListPlotDump`prologopt, DataRange -> Graphics`DateListPlotDump`datarangeopt, 
          Method -> Graphics`DateListPlotDump`method, PlotTheme -> None, Graphics`DateListPlotDump`opts}]; 
       If[ !Graphics`DateListPlotDump`nonemptydata, DateListPlot[Association[0 -> Null], {0}, Graphics`DateListPlotDump`options], 
        Graphics`DateListPlotDump`plot = Charting`noShow[(If[Graphics`DateListPlotDump`caller === DateListLogPlot, ListLogPlot, ListLinePlot][
             ##1] & ) @@ Join[{Graphics`DateListPlotDump`data}, Graphics`DateListPlotDump`options]]]]};
$\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.