Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

How can I place a mark, like a cross-hair (to suggest "X marks the spot") and a text label associated with it, at a particular position on an image (mine in particular is Colorized)?

share|improve this question
add comment

3 Answers 3

up vote 13 down vote accepted

This is a simple way:

Show[
    Plot[Sin[x], {x, 0, 2 \[Pi]}],
    Graphics[{PointSize[Large], Red, Point[{3 \[Pi]/2, -1}],
    Black, Text["Minimum", {3 \[Pi]/2, -.8}]}]]

enter image description here

Edit

If you have an image created with Colorize you can apply the same method. In the example below img is the image you obtain by taking the first example given in the Help under Colorize.

Show[
   img,
   Graphics[{PointSize[Large], Red, Point[{20, 100}],
   White, Text["California", {30, 90}]}]]

enter image description here

share|improve this answer
    
My image is created with Colorize and this gives Raster data contains 0 values per pixel; 3 or 4 are required with ColorFunction->RGBColor, even though it displays fine without the text. –  Emre Mar 30 '12 at 18:34
add comment

Another approach:

anXtoMarkTheSpot = Graphics[{
  White,
  Line[{{0,10}, {0, -10}}], 
  Line[{{-10,0}, {10, 0}}], 
  Text[Style["the Spot",14, Bold, White, 
      TextAlignment->Left],{20,5}]}, 
  ImageSize -> 80];

treasureMap = Colorize[ExampleData[{"TestImage", "Aerial2"}]];

ImageCompose[treasureMap, anXtoMarkTheSpot, {60,40}]

treasure map

share|improve this answer
add comment

You can also use the Drawing Tools palette to annotate an image interactively. It can be invoked in three ways:

  1. Selecting Drawing Tools from the Graphics menu
  2. Using the short-cut Ctrl+D or
  3. Using the right-click context menu on a graphics object:

context menu -- drawing tools

For a detailed tutorial on the Drawing Tools palette see Interactive Graphics Palette. The following image from the tutorial summarizes the functions in the palette:

enter image description here

Usage example: palette states and before and after appearance of the image using the same image in vucko's answer:

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.