Message Boards Message Boards

GROUPS:

Does Callout work in Graphics?

Posted 3 months ago
634 Views
|
5 Replies
|
5 Total Likes
|

Do Callouts work in Graphics? If so, how would I have the values of centers appear below the ellipses in this example?

centers = {0, 28.7, 33.8, 48.0, 55.4, 71.9};
Graphics[
 Join[
  ({Black, Circle[{#, 0}, {0.1, 0.4}]} & /@ centers),
  {{Red, Inset["|", {75, 0}]}}
  ],
 ImageSize -> {640, Automatic}
 ]

enter image description here

5 Replies
Posted 3 months ago

I think they don't work in Graphics directly, but this works:

ListPlot[Callout[{#, 0}, #] & /@ centers, Axes -> False, 
 AspectRatio -> 1/6]

enter image description here

Thanks, but I must use Graphics as there are other items in this visualization.

Posted 3 months ago

Well, we can extract the graphic primitives from the ListPlot output, even though it feels a bit hackish:

Graphics[
  Join[({Black, Circle[{#, 0}, {0.1, 0.4}]} & /@ centers),
       {{Red, Inset["|", {75, 0}]}}], 
  ImageSize -> {640, Automatic},
  Prolog -> 
    ListPlot[Callout[{#, 0}, #, Below] & /@ centers, PlotMarkers -> ""][[1]],
  ImagePadding -> 10
]

callout plot

That's a creative solution!

Here I used Inset to create callouts. The application is sequence coverage of gene locations in shotgun whole genome scans. Notice some chromosomes contain gaps, resulting in non-contiguous chromosome assembly. enter image description here

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