1
$\begingroup$

I'd like to overlay a scientific form number on a ListPlot at a particular position.

Simply using Text[ToString@value, {xpos,ypos}] separates the exponent from the number and increases the font size. I found several posts about exponential notation for axes labels etc but I've not found one for this. I think one way would be to somehow convert the ScientificForm object into a Graphics object, then I could place it anywhere.

I think this must be a duplicate question as it seems so fundamental but I'm clearly searching for the wrong expressions!

$\endgroup$
  • 1
    $\begingroup$ Note that an Inset does not need to be a Graphics. $\endgroup$ – Oleksandr R. Aug 10 '15 at 17:58
  • 2
    $\begingroup$ Possible duplicate? $\endgroup$ – march Aug 10 '15 at 17:58
  • $\begingroup$ Thank you MarcoB! Inset is exactly what I needed. Inset[value,Scaled[{xpos,ypos}]]; $\endgroup$ – DrBubbles Aug 10 '15 at 18:05
  • $\begingroup$ As an example, you could use Epilog -> Inset[Style[ScientificForm[N@value], Red, FontSize -> 14], Scaled[{xpos, ypos}]] to have control over the color, font size, positions, etc. of the text you want overlaid. $\endgroup$ – MarcoB Aug 10 '15 at 18:06
  • 1
    $\begingroup$ @march. That's not a good coding example. The use of string operations in generating the label is totally unnecessary. One can just use Row. $\endgroup$ – m_goldberg Aug 11 '15 at 1:35
1
$\begingroup$

You can use the Text graphics primitive to place a ScientificForm expression anywhere in a graphics pane without resorting to string conversion. For example,

Graphics[{
  Circle[], 
  Text[Style[ScientificForm[N[Pi 1*^10], 8], 14, Bold, Red], Scaled @ {.5, .9}]}]

produces

circle

I didn't bother to introduce Epilog here, but Text expression like this one are perfectly acceptable in a list of graphic primitives given to Epilog.

$\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.