6
$\begingroup$

I have a large, complex TimelinePlot in which the callout bubbles are too large, as shown here:

Callout bubbles too large

I'm happy with the font size and layout, but the bounding panes should be reduced (vertically) by a factor of about 0.4 so that all the text is visible.

I checked all the Options on TimeLinePlot but there seem to be none that control the (relative) sizes of the callouts.

How shall I proceed?


Here's some working code just to get started. There are so few entries that there is no problem of overlaps... nevertheless you should be able to use this to (somehow!) shrink the bounding boxes.

TimelinePlot[
 {
  
  <|{Entity["Person", "LeonBattistaAlberti::nn464"] -> 
     Interval[{"1404", "1472"}],
    Entity["Person", "AlbertoGiacometti::r8nd9"] -> 
     Interval[{"1901", "1966"}],
    "Mateo di Giovanni" -> Interval[{"1430", "1495"}],
    "Duccio" -> Interval[{"1257", "1318"}],
    Entity["Person", "Titian::fd5g7"] -> Interval[{"1489", "1576"}],
    Entity["Person", "PaoloUccello::sdw3g"] -> 
     Interval[{"1397", "1475"}],
    Entity["Person", "PaoloVeronese::2b848"] -> 
     Interval[{"1528", "1588"}]
    }|>,
  
  <|{Entity["Person", "Adolphe-WilliamBouguereau::fqv94"] -> 
     Interval[{"1825", "1905"}],
    Entity["Person", "PaulCezanne::q7s73"] -> 
     Interval[{"1839", "1906"}],
    Entity["Person", "PaulSignac::22q57"] -> 
     Interval[{"1863", "1935"}],
    Entity["Person", "HenriDeToulouse-Lautrec::77k38"] -> 
     Interval[{"1864", "1901"}]
    }|>}]

As an addendum:

I found that the below accepted solution works only if the entries are of the text form "John Smith", not an Entity (as in many of the above entries). I have no idea why, but it is a relatively simple matter to convert all the Entities into simple text in quotation marks.

$\endgroup$
2
  • 1
    $\begingroup$ David, could you include example code to play with? $\endgroup$
    – MarcoB
    Commented Jun 12, 2022 at 2:22
  • $\begingroup$ @MarcoB: Sorry for the delay, but I've added simple code, as you wisely suggested. $\endgroup$ Commented Jun 13, 2022 at 17:51

1 Answer 1

7
$\begingroup$

It looks like TimelinePlot has an undocumented Method suboption called "LabelPadding".

data = {
  
  <|{Entity["Person", "LeonBattistaAlberti::nn464"] -> 
     Interval[{"1404", "1472"}],
    Entity["Person", "AlbertoGiacometti::r8nd9"] -> 
     Interval[{"1901", "1966"}],
    "Mateo di Giovanni" -> Interval[{"1430", "1495"}],
    "Duccio" -> Interval[{"1257", "1318"}],
    Entity["Person", "Titian::fd5g7"] -> Interval[{"1489", "1576"}],
    Entity["Person", "PaoloUccello::sdw3g"] -> 
     Interval[{"1397", "1475"}],
    Entity["Person", "PaoloVeronese::2b848"] -> 
     Interval[{"1528", "1588"}]
    }|>,
  
  <|{Entity["Person", "Adolphe-WilliamBouguereau::fqv94"] -> 
     Interval[{"1825", "1905"}],
    Entity["Person", "PaulCezanne::q7s73"] -> 
     Interval[{"1839", "1906"}],
    Entity["Person", "PaulSignac::22q57"] -> 
     Interval[{"1863", "1935"}],
    Entity["Person", "HenriDeToulouse-Lautrec::77k38"] -> 
     Interval[{"1864", "1901"}]
    }|>};

TimelinePlot[data]

enter image description here

TimelinePlot[data, Method -> {"LabelPadding" -> {{5, 5}, {1, 1}}}]

enter image description here


Looks like the available suboptions are

{"DefaultPlotStyle", "DynamicOutput", "DateAxisStyle", 
  "TickLengths", "LabelBackground", ChartElementFunction, 
  "LabelHighlightStyle", "LabelPadding"}
$\endgroup$
4
  • $\begingroup$ Thanks so much for finding the undocumented option. Clearly your solution provides precisely what I need... ($+1$). However, for some reason your code does not produce the desired results in Mma version 11.3. Are the undocumented options you found available in 11.3? Or is there some other error I'm making that would prevent your solution from working? $\endgroup$ Commented Jun 13, 2022 at 22:31
  • $\begingroup$ I don't have 11.3, so I can't test. Does the this provide a workaround? plot /. (FrameMargins -> w_Integer) :> (FrameMargins -> w {{1, 1}, 0.4 {1, 1}}) If not, does wrapping the call in CloudEvaluate work? $\endgroup$
    – Greg Hurst
    Commented Jun 14, 2022 at 1:47
  • $\begingroup$ I discovered this with GeneralUtilities`PrintDefinitions in the definition for Charting`iTimelinePlot. Maybe in 11.3 you could check for the appearance of "LabelPadding" there? $\endgroup$
    – Greg Hurst
    Commented Jun 14, 2022 at 1:48
  • $\begingroup$ plot /. (FrameMargins -> w_Integer) :> (FrameMargins -> w {{1, 1}, 0.4 {1, 1}}) works (THANKS!), though for some reason in v 11.3 I had to reduce 0.4 significantly (to 0.01). Good enough, though. ($\checkmark$) $\endgroup$ Commented Jun 15, 2022 at 0:37

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.