Message Boards Message Boards

GROUPS:

Does Callout work in Graphics?

Posted 5 months ago
897 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 5 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

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

Posted 5 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.

That's a creative solution!

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