Mathematica Asked on July 16, 2021
I think I started to notice this issue with plots when I updated to version 12.3 a couple weeks ago but didn’t pay too much attention. Now it’s really bugging me because I have a presentation of this data coming up. (Please note I changed the code a bit for privacy but it still shows the behaviour.)
Looking at other PlotLabel
posts on SE and the docs, I’m a bit confused as to why the plot label isn’t sitting neatly above the plot as expected. I tried a couple of tweaks with ImagePadding
etc. and tried removing all the graphics options except PlotLabel
to no avail. I don’t really want to use Labelled
either since it should be working more predictably in my opinion.
Any ideas? Is there an explanation for this? Is anyone else seeing this behaviour in 12.3 with PlotLabel
?
MakeTimeSeriesGraphic[ds_] :=
Module[{tally, g, prod, dates},
prod = ds[1] // Values // First;
dates = FromDateString[#, DateFormat -> "ISODate"] & /@ (ds[All, "date"] // Normal);
tally = Tally[dates];
g = TimeSeries[tally, {dateStart, dateEnd}, MissingDataMethod -> {"Constant", 0 }];
DateListPlot[
g,
PlotTheme -> "Scientific",
GridLines -> Automatic,
PlotLabel -> Style[prod, "Subitem"],
PlotStyle -> SelectColor,
PlotRange -> All,
ImagePadding -> {{Automatic, Automatic}, {Automatic, 1}}
]
]
Block[{var},
var = Table[MakeTimeSeriesGraphic[data[i]], {i, Length@data}];
GraphicsGrid[
Partition[var, 4],
ImageSize -> 960,
Spacings -> Scaled[0.01],
Frame -> All
]
]
Thanks to user Lukas Lang's helpful comment, FrameLabel
does appear to be a predictable workaround for this issue. Using the below code returns the correct placement.
FrameLabel -> {{None, None}, {None, Style[prod, "Subitem"]}}
Answered by BBirdsell on July 16, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP