Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Overlay graphics in Stata / Export graphic with transparent background?

    I have 2 graphics (attached, .gph and .png versions of each) that I created with a user-written command (gsa) in Stata 17. They stem from the same estimation, but unfortunately GSA can only plot 10 markers at a time -- so if I have like 50 markers to plot, I have to make 5 graphs. But, what I really want (for publication) is 1 graph. Since they all stem from the same estimation.

    Attached are 2 examples of those graphs - everything on the graphic (e.g., the blue lines and dots, the range) is identical except for the placement of the gray markers at the bottom left.

    (1) Is there some way to lay these 2 graphics perfectly over top of one another in Stata, to make 1 graphic with all the markers? I have made the background color "None," so if there WAS a way to overlay 2 graphics in Stata, I think you would see both sets markers.

    (2) Alternatively, is there some way to export these .gph files such that they have no background / a transparent background in the exported version? If I could do this, I could overlay the graphics in some other program, e.g. Word. But when I export to .png as you can see, or .pdf, etc. there is a blue background. Whereas I need a transparent background, to be able to overlay them.

    Thanks,
    Leah
    Attached Files
    Last edited by Leah Bevis; 25 May 2022, 16:06.

  • #2
    The blue backdrop is presumably a side-effect of using the default scheme s2color, so the easiest way out of that I know is to use a different scheme, say s1color.

    gsa is a community-contributed command: from where? Sorry, but I have never used it. I don't understand the comment about 10 markers. On the face of it you are showing many more than that.

    .gph files tell Stata how to draw graphs, but trying to combine them otherwise is not something I've seen discussed. On the face of it you have a scatter plot with a curve and (easy to advise but may be hard to implement) the problem seems better tackled upstream than downstream, that is by taking the points and the curves and combining them directly.

    Comment


    • #3
      To add markers to a existing plot you could use the graph editor or -addplot- (ssc), but it may be simpler to plot again modifying the plot command adding "the missing" scatteri code.
      Code:
      graph describe
      will return info on your gph including the command used to plot data. -gsa- (ssc) seems to save all variables needed to plot the data again. Thus, you can plot data using the code left by graph describe in macro r(command). And, the twoway command code from one of your graphs can be modified adding the extra (scatteri ...) from your other plots to include all markers.
      Last edited by Bjarte Aagnes; 29 May 2022, 10:16.

      Comment

      Working...
      X