2
$\begingroup$

In SciDraw, the following command

FigLabel[{0.2, 0.3}, "test"];

places the label "test" at x=0.2 and y=0.3 in the current plot. Now, by default the text is centered around this point. Is there a way to make it start at the given point?

The argument Position->{x,y} doesn't do anything.

$\endgroup$
3
$\begingroup$

I gave a more detailed description in this answer. Here's a summary:

To specify the alignment relative to the anchor point {x,y} in FigLabel[{x,y}, "label"], you can use either

FigLabel[Anchor[{x,y}, offset], "label"]

or

FigLabel[{x,y}, "label", TextOffset -> offset]

The offset value is similar to the third argument of Text and can take either a named specification such as Left or a scaled coordinate pair running in the range -1..1. Thus {-1,0} is equivalent to Left.

Relevant sections of the SciDraw manual:

  • 8.1.8 Text positioning
  • 7.1 Points and anchors
  • 13 Annotations
$\endgroup$
2
$\begingroup$

@Felix: The only way I've found around this is using old-school Text[].

Quiet@Get["SciDraw`"]

Define

tlg = Graphics@Text["Center", {5, 6}, {-1, 0}] (* left-j *);
trg = Graphics@Text["Center", {5, 6}, {+1, 0}] (* right-j *);

then

Figure[
 FigurePanel[{
   FigLabel[{5, 5}, "Center"],
   FigGraphics@tlg,
   FigGraphics@trg,
   FigLine[{{5, 0}, {5, 10}}],
   FigLine[{{0, 5}, {10, 5}}]
   },
  XPlotRange -> {0, 10},
  YPlotRange -> {0, 10}
  ]
 ]

ScaledLabel (FigLabel in SciDraw) has been great for Single lines. Not so for multi-line text blocks where I want proper justification.

$\endgroup$
  • $\begingroup$ Thanks, that is exactly what I needed! Just to add, to align MaTeX text, one can combine this approach with mathematica.stackexchange.com/questions/144091 to get tlg2 = Graphics[ Inset[MaTeX["\\text{Center}", Magnification -> .05], {5, 6}, {Left, Center}]];. $\endgroup$ – Felix Jul 30 '17 at 16:48
  • $\begingroup$ See my answer for a pure-SciDra way. $\endgroup$ – Szabolcs Aug 3 '17 at 9:28

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.