Message Boards Message Boards

0
|
2256 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

[Solved] How to label Point and Line in Graphics?

Posted 3 years ago

Hi, I have line segments of specific lengths emanating from the origin. As shown in the attached text, I tried without success to label the origin and the 1st line with Annotation. How to achieve this?

BhattGeom = {{PointSize[0.03], 
    Annotation[Point[{0, 0}], "Italian 215"]}, {PointSize[0.03], 
    Point[{0.6275276279546202, -0.36230324492352733}]}, {PointSize[
     0.03], Point[{0.4718741904983956, 
      0.5623577617789476}]}, {PointSize[0.03], 
    Point[{-0.4923345757544339, 0.5867414994136928}]}, {PointSize[
     0.03], Point[{-0.7257803765680755, -0.41902949578412635}]}, \
{Thickness[0.01], Dashing[{}], 
    Annotation[ 
     Line[{{0, 0}, {0.6275276279546202, -0.36230324492352733}}], 
     "1st"]}, {Thickness[0.01], Dashing[{0.08, 0.02}], 
    Line[{{0, 0}, {0.4718741904983956, 
       0.5623577617789476}}]}, {Thickness[0.01], 
    Dashing[{0.06, 0.04}], 
    Line[{{0, 0}, {-0.4923345757544339, 
       0.5867414994136928}}]}, {Thickness[0.01], 
    Dashing[{0.04, 0.06}], 
    Line[{{0, 0}, {-0.7257803765680755, -0.41902949578412635}}]}};

BG = Graphics[BhattGeom, AspectRatio -> 1, ImageSize -> 256];
Print[BG];

enter image description here

POSTED BY: Richard Frost

Annotation has a different usage. You can try Text:

Module[{it215 = {0, 0}, 
  fst = {{0, 0}, {0.6275276279546202, -0.36230324492352733}}},
 Graphics[{{PointSize[0.03], Point[it215], 
    Text["Italian 215", it215, {-1.5, 0}]}, {PointSize[0.03], 
    Point[{0.6275276279546202, -0.36230324492352733}]}, {PointSize[
     0.03], Point[{0.4718741904983956, 
      0.5623577617789476}]}, {PointSize[0.03], 
    Point[{-0.4923345757544339, 0.5867414994136928}]}, {PointSize[
     0.03], Point[{-0.7257803765680755, -0.41902949578412635}]}, \
{Thickness[0.01], Dashing[{}], Line[fst], 
    Text["1st", Mean@fst, {-1, -1}]}, {Thickness[0.01], 
    Dashing[{0.08, 0.02}], 
    Line[{{0, 0}, {0.4718741904983956, 
       0.5623577617789476}}]}, {Thickness[0.01], 
    Dashing[{0.06, 0.04}], 
    Line[{{0, 0}, {-0.4923345757544339, 
       0.5867414994136928}}]}, {Thickness[0.01], 
    Dashing[{0.04, 0.06}], 
    Line[{{0, 0}, {-0.7257803765680755, -0.41902949578412635}}]}}]]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract