1
$\begingroup$

I would like to place a sphere next to a table of text in a GraphicsRow. I am not using a GraphicsGrid because I only need one row.

My text table is truncated by the GraphicRow. I only see a few columns of my table of text.

borderSeg = {{-40, -120},{10,-80}};
linkSeg = {{-20, -120},{-30,-100}};


borderGCVector = { (Sin[borderSeg[[1,1]]° - borderSeg[[2,1]]°] Sin[(borderSeg[[1,2]]°+borderSeg[[2,2]]°)/2] Cos[(borderSeg[[1,2]]°- borderSeg[[2,2]]°)/2])-
                       (Sin[borderSeg[[1,1]]° + borderSeg[[2,1]]°] Cos[(borderSeg[[1,2]]°+borderSeg[[2,2]]°)/2] Sin[(borderSeg[[1,2]]°- borderSeg[[2,2]]°)/2]),
                       (Sin[borderSeg[[1,1]]° - borderSeg[[2,1]]°] Cos[(borderSeg[[1,2]]°+borderSeg[[2,2]]°)/2] Cos[(borderSeg[[1,2]]°- borderSeg[[2,2]]°)/2])+
                       ( Sin[borderSeg[[1,1]]° + borderSeg[[2,1]]°] Sin[(borderSeg[[1,2]]°+borderSeg[[2,2]]°)/2] Sin[(borderSeg[[1,2]]°- borderSeg[[2,2]]°)/2]),
                        (Cos[borderSeg[[1,1]]°] Cos[borderSeg[[2,1]]°] Sin[(borderSeg[[1,2]]°- borderSeg[[2,2]]°)/2])};

linkGCVector = { (Sin[linkSeg[[1,1]]° - linkSeg[[2,1]]°] Sin[(linkSeg[[1,2]]°+linkSeg[[2,2]]°)/2] Cos[(linkSeg[[1,2]]°- linkSeg[[2,2]]°)/2])-
                       (Sin[linkSeg[[1,1]]° + linkSeg[[2,1]]°] Cos[(linkSeg[[1,2]]°+linkSeg[[2,2]]°)/2] Sin[(linkSeg[[1,2]]°- linkSeg[[2,2]]°)/2]),
                       (Sin[linkSeg[[1,1]]° - linkSeg[[2,1]]°] Cos[(linkSeg[[1,2]]°+linkSeg[[2,2]]°)/2] Cos[(linkSeg[[1,2]]°- linkSeg[[2,2]]°)/2])+
                        (Sin[linkSeg[[1,1]]° + linkSeg[[2,1]]°] Sin[(linkSeg[[1,2]]°+linkSeg[[2,2]]°)/2] Sin[(linkSeg[[1,2]]°- linkSeg[[2,2]]°)/2]),
                        (Cos[linkSeg[[1,1]]°] Cos[linkSeg[[2,1]]°] Sin[(linkSeg[[1,2]]°- linkSeg[[2,2]]°)/2])};

CGVectors = {borderGCVector, linkGCVector};
GraphicsRow[
        {
             (* Simple graphic to show cross products *)
             Graphics3D[ {{Opacity[0.05],Sphere[{0,0,0}]},
                          {Dashed, Line[{{0,0,0},{1,0,0}}]},
                          {Dashed, Line[{{0,0,0},{0,1,0}}]},
                          {Dashed, Line[{{0,0,0},{0,0,1}}]},
                          Arrow[{{1,0,0},{1.3,0,0}}],
                           Arrow[{{0,1,0},{0,1.3,0}}],
                           Arrow[{{0,0,1},{0,0,1.3}}],
                          Text[Style["x",Blue, Italic,12],{1.4,0,0}],
                          Text[Style["y",Blue, Italic,12],{0,1.4,0}],
                          Text[Style["z",Blue, Italic,12],{0,0,1.4}],
                         Arrow[{{0,0,0},#}]& /@ CGVectors},Boxed->False],
             (* Table of values computed in Mathematica and values computed by C# methods *)
             Text[Grid[ {{"","Border Normal", "Link Normal","Border Normal", "Link Normal"},
                         {"", "Mathematica", "Mathematica", "C#", "C#"},
                         {"x", N[borderGCVector[[1]]], N[linkGCVector[[1]]],"0.738606","-0.115201"},
                         {"y", N[borderGCVector[[2]]], N[linkGCVector[[2]]],"-0.043412","-0.183489"},
                         {"z", N[borderGCVector[[3]]], N[linkGCVector[[3]]],"-0.258022",""}},
                          ItemSize->12
                         Frame->All, FrameStyle->LightGray, ItemStyle->{{1->{FontSlant->Italic}},{1->{FontFamily->"Arial",FontSize->9}}}]]
        }
    ]

Is there a way to set the size of a column in a GraphicRow?

$\endgroup$
  • 1
    $\begingroup$ Suggestion: use Grid and (if necessary) option ItemSize even though you have only one row of two items. $\endgroup$ – m_goldberg Mar 2 '17 at 14:40
  • $\begingroup$ Please provide definitions for borderGCVector and linkGCVector. Your code doesn't run without them. $\endgroup$ – MarcoB Mar 2 '17 at 15:11
  • $\begingroup$ Vector definitions have been added. $\endgroup$ – Doug Kimzey Mar 2 '17 at 15:28
  • $\begingroup$ In the Grid, is there a way to specify that the two items are on a single row instead of a vertical column? $\endgroup$ – Doug Kimzey Mar 2 '17 at 15:29
1
$\begingroup$

If you insist on using GraphicsRow, you can manipulate the size of an element by using spanning elements next to it.

GraphicsRow[{Graphics3D[...],Text[Grid[...]], SpanFromLeft, SpanFromLeft}]

Alternatively, as m_goldberg suggests above, use Gridand double curly brackets {{item1, item2}} or a simple Row

EDIT

Actually, there is a typo in your code in the text table -- missing comma after ItemSize->12. If you insert it, the table gets bigger and you have to add few more spanning elements, but then the overall graphics size is limiting you, so you have to adjust it by using ImageSize -> {700, 100}.

$\endgroup$
  • $\begingroup$ Thanks for the catch! Used Grid with double braces - did the trick $\endgroup$ – Doug Kimzey Mar 2 '17 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.