1
$\begingroup$

I would like to create graphics that look like this:

g = Grid[{{"Circle"}, {Graphics[Circle[]]}, {x^2 + y^2 == r^2}}, Frame -> All]

circle with heading and equation

But when I use this code, I get a Grid item, not a Graphics item. I need a Graphics item because I want to use it as a VertexShape in a Graph call, and VertexShape requires a Graphics object, not a Grid object.

I tried using GraphicsColumn instead, since that produces a Graphics object. I tried

GraphicsColumn[{"Circle", Graphics[Circle[]], x^2 + y^2 == r^2},Frame -> All]

c = GraphicsColumn[{"Circle", Graphics[Circle[]], x^2 + y^2 == r^2}, Frame -> All]

circle with heading and equation

The three objects appear with the same height. The documentation for GraphicsColumn says "GraphicsColumn will by default make all items the same height, preserving individual aspect ratios for graphics, and leaving space if necessary." This suggests to me that there is a way to override this default behavior, but I haven't figured out how. I've tried various combinations of the ImageSize, Spacings, and ImagePadding options, but could not come up with a solution.

Can anyone help me? I'd like a way to make a Graphics object with 3 different height entries arranged in a column.

Added: Lukas' solution worked:

Graphics[{Inset[g]}]
$\endgroup$
  • 1
    $\begingroup$ You could try using Rasterize on the first expression that looks the way you want, after rasterizing it I think you should be able to use it as a vertex shape. $\endgroup$ – C. E. Dec 30 '18 at 4:15
  • 2
    $\begingroup$ Related: mathematica.stackexchange.com/questions/188514/… (maybe) $\endgroup$ – Michael E2 Dec 30 '18 at 5:33
  • 2
    $\begingroup$ People here generally like users to post code as Mathematica code instead of just images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. You may find this this meta Q&A helpful $\endgroup$ – Michael E2 Dec 30 '18 at 5:35
  • $\begingroup$ Michael, thanks for the heads up. I have edited the question to include the Mathematica code. $\endgroup$ – Stanley Rabinowitz Dec 30 '18 at 15:17
  • $\begingroup$ C.E. - I prefer not to use Rasterize, because it makes the text fuzzy. But thanks for the suggestion. $\endgroup$ – Stanley Rabinowitz Dec 30 '18 at 15:18

Your Answer

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

Browse other questions tagged or ask your own question.