Mathematica is a great tool but when it comes to layout generation is quite poorly intuitive: I would love that exporting to images and SVGs could be more friendly and compliant with graphic design mindset.
I created a graph object and labeled a vertex with a chart, and want to automate composed layouts.
I know Graphics
object is not an Image
object and a Graph
object is not automatically converted to a Graphics
object.
I used Show
command for the purpose.
However cannot figure out how to scale the final composition so as to have the exact measures in pixels and resolution, as it would be in photoshop or other computer graphics software.
Let's take this Column
object that represent a composed layout.
v1 = Column[{
Text[Style[sector[i], FontSize -> 22]],
Show[sgSectorProfessions[i], ImageSize -> 300], (* here I convert a Graph Object into a Graphics and set the image size, I thought 300 px but it is not *)
SwatchLegend[
Values[KeyTake[labelsColors, getPowers[i]]], getPowers[i],
LegendLayout -> "Row"
]},
Center
, ItemSize -> {Automatic, {1, 3} , Automatic} (* here tried to tell proportions of cells in the columns, but no effect *)
, Dividers -> Center];
And now I try to export it:
Export["v1_sector_" <> ToString[i] <> ".png", v1,
ImageResolution -> 300, ImageResize -> {300, 300}] (* here I try to get 300 x 300 px image, or Automatic x 300px would also be ok, but not working *)
In SVG
, it keeps the proportions.
In png
, layout is not consistent and the proportions look different; also, the size of the automated images have all slightly different dimensions: e.g. 1250 x 1004, 1266 x 1502, etc.
Instead, I would have expected / would like to have all images to have these sizes: column width : Automatic column height : 300px image resolution: 300dpi (or 72dpi but with crispy fonts and edges)
What am I missing to produce a consistent layout in automated data-visualizations, possibly similar to scripts for Photoshop / Illustrator ?