{"id":1238,"date":"2022-10-11T13:38:42","date_gmt":"2022-10-11T17:38:42","guid":{"rendered":"https:\/\/blog.uvm.edu\/tbplante\/?p=1238"},"modified":"2022-12-14T16:34:00","modified_gmt":"2022-12-14T21:34:00","slug":"appending-merging-combining-two-stata-figures-images-with-imagemagick","status":"publish","type":"post","link":"https:\/\/blog.uvm.edu\/tbplante\/2022\/10\/11\/appending-merging-combining-two-stata-figures-images-with-imagemagick\/","title":{"rendered":"Appending\/merging\/combining Stata figures\/images with ImageMagick"},"content":{"rendered":"\n<p>Sometimes you want to combine two figures in Stata but the &#8211;graph combine&#8211; command isn&#8217;t doing it for you for whatever reason. I&#8217;ve run into this when I&#8217;ve already merged several figures (abcd), and want to combine that with another merged figure (1234): <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;a]\n&#091;b]\n&#091;c]\n&#091;d]\n...run graph combine then graph export in Stata and get:\n&#091;abcd].png\n\n&#091;1]\n&#091;2]\n&#091;3]\n&#091;4]\n...graph combine and graph export to get:\n&#091;1234].png<\/code><\/pre>\n\n\n\n<p>But what I want is one image that looks like this, stacking one on top of the other:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;abcd\n 1234].png<\/code><\/pre>\n\n\n\n<p>My previous workflow was to open up <a rel=\"noreferrer noopener\" href=\"https:\/\/www.gimp.org\/\" target=\"_blank\">GIMP<\/a> and manually combine them together. It turns out <a rel=\"noreferrer noopener\" href=\"https:\/\/imagemagick.org\/script\/download.php\" target=\"_blank\">ImageMagick<\/a> allows you to do this from the command line, so you can embed a couple of lines of code in your Stata do file to combine images together quickly. You can read details on the append command <a rel=\"noreferrer noopener\" href=\"https:\/\/imagemagick.org\/script\/command-line-options.php#append\" target=\"_blank\">here<\/a> (and also the related smush command <a rel=\"noreferrer noopener\" href=\"https:\/\/imagemagick.org\/script\/command-line-options.php#smush\" target=\"_blank\">here<\/a>). <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Getting started with Imagemagick &amp; Stata, and example on how to combine\/merge\/append images<\/h2>\n\n\n\n<p><strong><em>Note: I am doing this on Windows. The process might be slightly different for Mac or *nix.<\/em><\/strong><\/p>\n\n\n\n<p><strong><em>Also note: The examples here use PNG files since they are smaller than TIFF files. You might opt to use TIFF files since they are uncompressed and won&#8217;t introduce compression artifact with multiple manipulations. Journals will probably want TIFF files anyway so perhaps do that from the start.<\/em><\/strong><\/p>\n\n\n\n<p><strong><em>Also also not<\/em><\/strong><em><strong>e: Imagemagick doesn&#8217;t like extra spaces in code. If your code doesn&#8217;t run as expected, check that you don&#8217;t have extra spaces in your code.<\/strong> <strong>And also make sure you are also running the &#8220;local pwd=c(pwd)&#8221; command along with your other lines of code all at once.<\/strong><\/em> <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 1<\/strong>: Download and install <a rel=\"noreferrer noopener\" href=\"https:\/\/imagemagick.org\/script\/download.php\" target=\"_blank\">ImageMagick<\/a>. Make sure to check the box next to &#8220;Add application directory to your system path&#8221;. This allows you to call ImageMagick from the command line so you can use it in Stata. <\/li>\n\n\n\n<li><strong>Step 2<\/strong>: From a do file, make some figures and use &#8211;graph export&#8211; to save them in your working directory as a common filetype (e.g., PNG, JPG, SVG). Let&#8217;s assume you have one figure called abcd.png and another called 1234.png.\n<ul class=\"wp-block-list\">\n<li>Note: Type -pwd- to see where your working directory is.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Step 3<\/strong>: In your do file below the code that makes your two figures, call ImageMagick from the shell (&#8220;!&#8221; is the Stata command to call the shell), list out the names of the figures you want to combine, say you want to combine them, then tell it the name of the combined filetype.\n<ul class=\"wp-block-list\">\n<li>To simplify the code, we&#8217;ll also grab the present working directory and put it before the filename as a local macro. Since this uses local macros, you need to run all lines at once from a do file and not one-by-one in Stata. <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Combining figures using convert -append<\/h3>\n\n\n\n<p>Here&#8217;s some code that will vertically append a file &#8220;abcd.png&#8221; to &#8220;1234.png&#8221; and save as &#8220;abcd1234.png&#8221;: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>local pwd = c(pwd) \/\/ pluck stata's working directory\n\/\/\n!magick \/\/\/\nconvert \/\/\/\n\"`pwd'\/abcd.png\" \/\/\/\n\"`pwd'\/1234.png\" \/\/\/\n-append \/\/\/\n\"`pwd'\/abcd1234.png\"<\/code><\/pre>\n\n\n\n<p>Note that if you want to combine them horizontally instead of vertically, you&#8217;d use &#8220;+append&#8221; instead.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Combining figures using mosaic<\/h3>\n\n\n\n<p>Alternatively, you can use the <strong>mosaic <\/strong>command, and specify &#8220;concatenate&#8221; to do the same thing, specifying they are tiled in a 1&#215;2 tiling (read about the mosaic command <a rel=\"noreferrer noopener\" href=\"https:\/\/sinestesia.co\/blog\/tutorials\/quick-n-easy-mosaics-with-imagemagick\/\" target=\"_blank\">here<\/a>). Note that adding -label &#8220;&#8221; before each figure name keeps any generated labels from appearing under each figure in the final mosaic:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>local pwd = c(pwd) \/\/ pluck stata's working directory\n\/\/\n!magick \/\/\/\nmontage \/\/\/\n-label \"\" \"`pwd'\/abcd.png\" \/\/\/\n-label \"\" \"`pwd'\/1234.png\" \/\/\/\n-mode Concatenate -tile 1x2 \/\/\/\n\"`pwd'\/abcd1234.png\"<\/code><\/pre>\n\n\n\n<p>Or you can use the mosaic command to stick together all of the original figures as 4&#215;2 tiling:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>local pwd = c(pwd) \/\/ pluck stata's working directory\n\/\/ \n!magick \/\/\/\nmontage \/\/\/\n-label \"\" \"`pwd'\/a.png\" \/\/\/\n-label \"\" \"`pwd'\/b.png\" \/\/\/\n-label \"\" \"`pwd'\/c.png\" \/\/\/\n-label \"\" \"`pwd'\/d.png\" \/\/\/\n-label \"\" \"`pwd'\/1.png\" \/\/\/\n-label \"\" \"`pwd'\/2.png\" \/\/\/\n-label \"\" \"`pwd'\/3.png\" \/\/\/\n-label \"\" \"`pwd'\/4.png\" \/\/\/\n-mode Concatenate -tile 4x2 \/\/\/\n\"`pwd'\/abcd1234.png\"<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Adding text\/annotation to your image<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Adding text label on the figure itself with Convert -annotate<\/h3>\n\n\n\n<p>You can also add some labels right on your figure with the &#8220;convert -annotate&#8221; command (details <a rel=\"noreferrer noopener\" href=\"https:\/\/karttur.github.io\/setup-theme-blog\/blog\/add-text-to-image\/\" target=\"_blank\">here<\/a>). Here we are adding a label &#8220;A)&#8221; and &#8220;B)&#8221; to the top left corner of each figure, or &#8220;Northwest&#8221; as defined by gravity (can use other cardinal directions too). You can move things up or down from the Northwest point if needed by changing the +0+0 (that&#8217;s +x+y) offset. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sysuse auto, clear\n\nset scheme s1mono \/\/ I like this scheme\ntwoway scatter mpg rep78\ngraph export 1234.png, width(1000) replace\n\ntwoway scatter rep78 mpg\ngraph export abcd.png, width(1000) replace \n\nlocal pwd = c(pwd) \/\/ pluck stata's working directory\n\/\/\n!magick \/\/\/\nconvert \/\/\/\n\"`pwd'\/abcd.png\" -gravity Northwest -pointsize 30 -annotate +10+0 \"A)\" \/\/\/\n\"`pwd'\/abcd_labeled.png\"\n\/\/\n!magick \/\/\/\nconvert \/\/\/\n\"`pwd'\/1234.png\" -gravity Northwest -pointsize 30 -annotate +10+0 \"B)\" \/\/\/\n\"`pwd'\/1234_labeled.png\"\n\/\/\n!magick \/\/\/\n\"`pwd'\/abcd_labeled.png\" \/\/\/\n\"`pwd'\/1234_labeled.png\" \/\/\/\n-append \/\/\/\n\"`pwd'\/abcd1234_labeled.png\"<\/code><\/pre>\n\n\n\n<p>Here&#8217;s the resulting figure:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/image-2.png\" alt=\"\" class=\"wp-image-1243\" width=\"332\" height=\"490\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/image-2.png 617w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/image-2-203x300.png 203w\" sizes=\"auto, (max-width: 332px) 100vw, 332px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Adding text above your figure with convert -label, then combining figures with mosaic<\/h3>\n\n\n\n<p>This will add a label above your image, instead of <em>on <\/em>your image like convert -annotate. Here, the background is yellow so you can see it. Details are <a rel=\"noreferrer noopener\" href=\"https:\/\/linuxhint.com\/imagemagick-adding-text-image\/\" target=\"_blank\">here<\/a>. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd_labeled2.png\" alt=\"\" class=\"wp-image-1258\" width=\"356\" height=\"271\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd_labeled2.png 1000w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd_labeled2-300x229.png 300w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd_labeled2-768x586.png 768w\" sizes=\"auto, (max-width: 356px) 100vw, 356px\" \/><\/figure>\n\n\n\n<p>This can be followed by a mosaic command so you can get a figure like this (with white label now).  <\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd1234_labeled_montage-2-656x1024.png\" alt=\"\" class=\"wp-image-1261\" width=\"327\" height=\"511\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd1234_labeled_montage-2-656x1024.png 656w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd1234_labeled_montage-2-192x300.png 192w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd1234_labeled_montage-2-768x1200.png 768w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd1234_labeled_montage-2-983x1536.png 983w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd1234_labeled_montage-2.png 1000w\" sizes=\"auto, (max-width: 327px) 100vw, 327px\" \/><\/figure>\n\n\n\n<p>Note that Imagemagick will try to append the labels that you generated in prior lines (&#8220;A) Figure Name&#8221; and &#8220;B) Figure Name&#8221;) under each image before combining unless you specify -label &#8220;&#8221;. Code to make the above figures:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sysuse auto, clear\n\nset scheme s1mono \/\/ I like this scheme\ntwoway scatter mpg rep78\ngraph export 1234.png, width(1000) replace\n\ntwoway scatter rep78 mpg\ngraph export abcd.png, width(1000) replace \n\nlocal pwd = c(pwd) \/\/ pluck stata's working directory\n\/\/ label\n!magick \/\/\/\nconvert \/\/\/\n\"`pwd'\/abcd.png\" -background white -pointsize 30 label:\"A) Figure Name\" +swap -gravity West -append \/\/\/\n\"`pwd'\/abcd_labeled.png\"\n\/\/\n!magick \/\/\/\nconvert \/\/\/\n\"`pwd'\/1234.png\" -background white -pointsize 30 label:\"B) Figure Name\" +swap -gravity West -append \/\/\/\n\"`pwd'\/1234_labeled.png\"\n\/\/ combine as a montage\n!magick \/\/\/\nmontage \/\/\/\n-label \"\" \"`pwd'\/abcd_labeled.png\" \/\/\/\n-label \"\" \"`pwd'\/1234_labeled.png\" \/\/\/\n-mode Concatenate -tile 1x2 \/\/\/\n\"`pwd'\/abcd1234_labeled_montage.png\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Generating an image with text then sticking that on top of your figures<\/h3>\n\n\n\n<p>ImageMagick will allow you to make an image that&#8217;s just text, which you can then stack on top of your figures using the montage feature. Just make sure to set the text width to be the same width as your figure, 1000 pixels here. You will stack them like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;abcd_label &lt;-newly generated image of just text\nabcd\n1234_label &lt;-newly generated image of just text\n1234]<\/code><\/pre>\n\n\n\n<p>And you&#8217;ll get something like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd1234_labeled_montage-3-641x1024.png\" alt=\"\" class=\"wp-image-1277\" width=\"358\" height=\"572\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd1234_labeled_montage-3-641x1024.png 641w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd1234_labeled_montage-3-188x300.png 188w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd1234_labeled_montage-3-768x1227.png 768w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd1234_labeled_montage-3-961x1536.png 961w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd1234_labeled_montage-3.png 1000w\" sizes=\"auto, (max-width: 358px) 100vw, 358px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>sysuse auto, clear\n\nset scheme s1mono \/\/ I like this scheme\ntwoway scatter rep78 mpg\ngraph export abcd.png, width(1000) replace \n\ntwoway scatter mpg rep78\ngraph export 1234.png, width(1000) replace\n\nlocal pwd = c(pwd) \/\/ pluck stata's working directory\n\/\/ make two separate text labels that you will later combine with your\n\/\/ abcd and 1234 figures using montage\n\/\/ \n\/\/ first make the labels\n\/\/ note: the caption option will use word wrap if it's too wide. \n\/\/ This is 1000 pixels wide to match the other figures. \n\/\/\n!magick \/\/\/\nconvert \/\/\/\n-background none -size 1000x -fill black -font ariel -pointsize 30 caption:\"A) Figure Name\" \/\/\/\n\"`pwd'\/abcdlabel.png\"\n\/\/\n!magick \/\/\/\nconvert \/\/\/\n-background none -size 1000x -fill black -font ariel -pointsize 30 caption:\"B) Figure Name\" \/\/\/\n\"`pwd'\/1234label.png\"\n\/\/now use montage to put those labels on top of your other ones. \n\/\/combine as a montage\n\/\/\n!magick \/\/\/\nmontage \/\/\/\n-label \"\" \"`pwd'\/abcdlabel.png\" \/\/\/\n-label \"\" \"`pwd'\/abcd.png\" \/\/\/\n-label \"\" \"`pwd'\/1234label.png\" \/\/\/\n-label \"\" \"`pwd'\/1234.png\" \/\/\/\n-mode Concatenate -tile 1x4 \/\/\/\n\"`pwd'\/abcd1234_labeled_montage.png\"<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Other useful functions of Imagemagick<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Convert and -Trim<\/h3>\n\n\n\n<p>Trimming removes all of the extra border around your figure. The border is defined as whatever color the pixel in the corner is. So if you have a figure that looks like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd.png\" alt=\"\" class=\"wp-image-1256\" width=\"326\" height=\"236\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd.png 1000w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd-300x218.png 300w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd-768x558.png 768w\" sizes=\"auto, (max-width: 326px) 100vw, 326px\" \/><\/figure>\n\n\n\n<p>Trimming will remove the small amount of blue space outside of your labels and around the figure, so you get this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd_trim.png\" alt=\"\" class=\"wp-image-1257\" width=\"320\" height=\"228\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd_trim.png 942w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd_trim-300x214.png 300w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/abcd_trim-768x548.png 768w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/figure>\n\n\n\n<p>Code to do this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sysuse auto, clear\nset scheme s2color \/\/ stata's default scheme\ntwoway scatter rep78 mpg\ngraph export abcd.png, width(1000) replace \n\/\/\nlocal pwd = c(pwd) \/\/ pluck stata's working directory\n\/\/\n!magick \/\/\/\nconvert \/\/\/\n\"`pwd'\/abcd.png\" -trim \/\/\/\n\"`pwd'\/abcd_trim.png\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Replicating Stata&#8217;s Graph Combine feature<\/h3>\n\n\n\n<p>I&#8217;m not quite sure why you&#8217;d want to do this, but you can combine several figures without axis labels and use one overall label like specifying <em>l1label <\/em>and <em>b1label <\/em>in &#8211;graph combine&#8211;. This code makes 4 separate figures without labels then merges them together then generates text to go on the left side vertically and on the bottom horizontally. You get this figure in the end:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/1234_labeled-1024x203.png\" alt=\"\" class=\"wp-image-1268\" width=\"498\" height=\"98\" srcset=\"https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/1234_labeled-1024x203.png 1024w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/1234_labeled-300x59.png 300w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/1234_labeled-768x152.png 768w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/1234_labeled-1536x304.png 1536w, https:\/\/blog.uvm.edu\/tbplante\/files\/2022\/10\/1234_labeled-2048x406.png 2048w\" sizes=\"auto, (max-width: 498px) 100vw, 498px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>sysuse auto, clear\nset scheme s1mono \/\/ I like this scheme\n\/\/\n\/\/ Make 4 figures without labels\ntwoway scatter mpg weight if rep78==1 \/\/\/\n, \/\/\/\nxti(\"\") \/\/\/\nyti(\"\")\n\/\/\ngraph export 1.png, width(1000) replace\n\/\/\ntwoway scatter mpg weight if rep78==2 \/\/\/\n, \/\/\/\nxti(\"\") \/\/\/\nyti(\"\")\n\/\/\ngraph export 2.png, width(1000) replace\n\/\/\ntwoway scatter mpg weight if rep78==3 \/\/\/\n, \/\/\/\nxti(\"\") \/\/\/\nyti(\"\")\n\/\/\ngraph export 3.png, width(1000) replace\n\/\/\ntwoway scatter mpg weight if rep78==4 \/\/\/\n, \/\/\/\nxti(\"\") \/\/\/\nyti(\"\")\n\/\/\ngraph export 4.png, width(1000) replace\n\/\/ \nlocal pwd = c(pwd) \/\/ pluck stata's working directory\n\/\/ now merge the 4 figures horizontally:\n!magick \/\/\/\nmontage \/\/\/\n-label \"\" \"`pwd'\/1.png\" \/\/\/\n-label \"\" \"`pwd'\/2.png\" \/\/\/\n-label \"\" \"`pwd'\/3.png\" \/\/\/\n-label \"\" \"`pwd'\/4.png\" \/\/\/\n-mode Concatenate -tile 4x1 \/\/\/\n\"`pwd'\/1234_noaxislabel.png\"\n\/\/ now make a side label as a text block:\n\/\/\n!magick \/\/\/\nconvert \/\/\/\n-pointsize 50 label:\"Side Label!\" -rotate -90 \/\/\/\n\"`pwd'\/1234sidelabel.png\"\n\/\/\n\/\/ ditto bottom label: \n\/\/\n!magick \/\/\/\nconvert \/\/\/\n-pointsize 50 label:\"Bottom Label!\" -rotate -0 \/\/\/\n\"`pwd'\/1234bottomlabel.png\"\n\/\/\n\/\/ now combine them together:\n!magick convert \\( \"`pwd'\/1234sidelabel.png\" \"`pwd'\/1234_noaxislabel.png\" -gravity Center +append \\) \\( \"`pwd'\/1234bottomlabel.png\" \\) -append 1234_labeled.png<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes you want to combine two figures in Stata but the &#8211;graph combine&#8211; command isn&#8217;t doing it for you for whatever reason. I&#8217;ve run into this when I&#8217;ve already merged several figures (abcd), and want to combine that with another merged figure (1234): But what I want is one image that looks like this, stacking &hellip; <a href=\"https:\/\/blog.uvm.edu\/tbplante\/2022\/10\/11\/appending-merging-combining-two-stata-figures-images-with-imagemagick\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Appending\/merging\/combining Stata figures\/images with ImageMagick<\/span><\/a><\/p>\n","protected":false},"author":4473,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[703423,703422,703425,703409,247,703426,102693,502556],"class_list":["post-1238","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-appending","tag-combining","tag-figure","tag-graph-combine","tag-image","tag-imagemagick","tag-merging","tag-stata"],"_links":{"self":[{"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/posts\/1238","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/users\/4473"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/comments?post=1238"}],"version-history":[{"count":20,"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/posts\/1238\/revisions"}],"predecessor-version":[{"id":1364,"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/posts\/1238\/revisions\/1364"}],"wp:attachment":[{"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/media?parent=1238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/categories?post=1238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.uvm.edu\/tbplante\/wp-json\/wp\/v2\/tags?post=1238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}