Message Boards Message Boards

2 Replies
0 Total Likes
View groups...
Share this post:

How to add words after a disk?

Posted 9 years ago

Graphics[{{Orange, Disk[{0, 0}, .1]}, {Black, Disk[{2, 0}, .1]}}] will display two disks.

Is there a way to print "Orange" and "Black" next to the disks in a program? The disk color will come from code. Therefore, I cannot use a textbox to add the word.

Thank you very much.

POSTED BY: steve ma
2 Replies
Posted 9 years ago

Thank you

POSTED BY: steve ma
Posted 9 years ago

Something like the following?

tColor1 = Orange;
tColor2 = Blue;
  {Orange, Disk[{0, 0}, .1]},
  Text[Style["Orange", tColor1], {0.25, 0}],
  {Black, Disk[{2, 0}, .1]},
  Text[Style["Black", tColor2], {2.25, 0}]

This produces

Two discs with color

POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract