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.

In an attempt to create a legend for a graph drawing, I find that Labeled only works without the position options (except for Center).

   Graph[Range[2], {
  Labeled[DirectedEdge[1, 2], "BEFORE"]}]

enter image description here

But

Graph[Range[2], {
  Labeled[DirectedEdge[1, 2], "BEFORE", Bottom]}]

enter image description here

Similarly for the other Labeled position options like Top, Left, Right.

Also, adding ImagePadding doens't help. I've tried some - but not all - Labeled's other options:

{Alignment -> {Center, Baseline}, Background -> None, 
 BaselinePosition -> Automatic, BaseStyle -> {}, 
 DefaultBaseStyle -> "Labeled", DefaultLabelStyle -> "LabeledLabel", 
 Editable -> Automatic, Frame -> None, FrameMargins -> 0, 
 FrameStyle -> Automatic, ImageMargins -> 0, ImageSize -> Automatic, 
 LabelStyle -> {}, RotateLabel -> False, RoundingRadius -> 0, 
 Selectable -> Automatic, Spacings -> Automatic, 
 SyntaxForm -> Automatic}

Known issue?

share|improve this question
    
I think that with Bottom the label falls below the plot area and thus does not show... try setting the option PlotRange to show a larger vertical area. –  becko May 11 '13 at 3:32
add comment

1 Answer 1

I do not see any advantage of using Labeled vs intended for graphs EdgeLabels. Here is an aap to demonstrate arbitrary label placement:

Manipulate[Graph[{1 \[DirectedEdge] 2}, EdgeLabels -> {1 \[DirectedEdge] 2 -> 
  Placed[Style["OVERLAP", Red, 15], {a, p}]}, 
  PlotRange -> {{-.5, 1.5}, {-.15, .15}}, EdgeShapeFunction -> esf],
  {{esf, "Arrow", "Arrowheads"}, {"Line", "Arrow"}},
  {{p, {.5, .7}, "scaled position\nin the label"}, {-2, 0}, {3, 1.5}}, 
  {{a, .5, "scaled position of\nthe label along edge"}, 0, 1}]

enter image description here

share|improve this answer
2  
that's an option but my intention is to build legends for graphs, using Row, Column, Grid. In any case, something is broken in Labeled-Graph interaction. –  alancalvitti Sep 7 '12 at 20:37
    
@alancalvitti Can you show how you intend to use Row, etc. for this? –  Vitaliy Kaurov Sep 7 '12 at 20:48
    
for example: Column[{ Column[{"OVERLAP", Graph[{Style[DirectedEdge[1, 2], Red]}, ImageSize -> 150]}, Center, -0.5], Column[{"BEFORE", Graph[{Style[DirectedEdge[1, 2], Blue]}, ImageSize -> 150]}, Center, -0.5], Column[{"AFTER", Graph[{Style[DirectedEdge[1, 2], Green]}, ImageSize -> 150]}, Center, -0.5] }] –  alancalvitti Sep 7 '12 at 20:51
    
I suppose all this can be done within Graph by specifying vertex positions, but I prefer not specifying all these small details. –  alancalvitti Sep 7 '12 at 20:52
1  
@VitaliyKaurov,+1 but cannot accept. The issue is the orthogonality of the language. Why don't all Labeled options work with Graph? –  alancalvitti Sep 8 '12 at 18:08
show 8 more comments

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.