`annotation` outside permitted figure bounds

annotation doesn't permit negative position, unlike text, but I need former to position absolutely. Yet in below example, I need negative position (the text should be lower).

Is there a workaround? I suppose one could pad the figure, but I don't know how to, and it'd need to work for all view (text must remain absolutely positioned).

[X, Y, Z] = ndgrid(linspace(-8,8,40), linspace(-8,8,40), linspace(-8,8,40));
D = X.*Y.*Z;
D = D * (100 / max(D, [], 'all'));

for ii = 10:10:100
    patch(isosurface(D, ii, D), 'FaceColor', 'interp', 'LineStyle', 'none')
view([3 1 1])
annotation('textbox', [.5 0 .1 .1], 'String', 't=5', 'EdgeColor', 'none')


  • Annotations are added to an AnnotationPane class, so

    an = annotation('textbox', [.5 0 .1 .1], 'String', 't=5', 'EdgeColor', 'none');

    Gives us the annotation, and

    p = an.Parent;

    Gives us the annotation pane.

    You can edit the specific text positions for the text objects which are children of the annotation pane, although I'm not 100% sure how the textbox positions relate to the annotation positions:

    p.Children(1).Position(2) = 0;