Announcement

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

  • graph combine

    hi guys!

    this is work in progress.
    what i am plotting are temperature averages.
    the black bit in the north hemisphere represents the difference from the global average, hence the black.
    my question - how could after combining the two graphs make them share the x axis, while the y axes are in continuation - so like a rectangular, divided horizontally in the middle.

    thanks,
    natalia

  • #2
    first, note that, as the FAQ, says, photos should not be used - in particular, I can barely read yours

    second, if you look at the help for graph combine (h graph combine), you will see that there are options such as "xcommon" which will do what you appear to want (however, your language is not clear to me so I could be wrong about what you want)

    Comment


    • #3
      hi rich,

      the document is a .png which according to the faqs is acceptable, but you right: attaching it as a photo was a mistake.
      basically, what I would like to achieve is a graph similar to the one the attached link is directing you to. (one in which the first and second histogram literally share the y axis - ycommon does not result in that)
      Attached Files
      Last edited by natalia malancu; 02 Aug 2015, 20:58.

      Comment


      • #4
        Here is a solution that uses gr_edit to remove the area between the three graphs. You have to experiment with different values in the fyzise() option to find a value that gives the third graph the same height as the first two graphs.
        Code:
        sysuse auto
        scatter mpg weight if foreign==0, plotregion(lcolor(black))
        graph save g1.gph, replace
        scatter mpg weight, plotregion(lcolor(black))
        graph save g2.gph, replace
        scatter mpg weight if foreign==1, plotregion(lcolor(black)) fysize(37)
        graph save g3.gph, replace
        graph combine g1.gph g2.gph g3.gph, col(1) xcommon ycommon imargin(zero)
        gr_edit plotregion1.graph1.xaxis1.draw_view.setstyle, style(no)
        gr_edit plotregion1.graph2.xaxis1.draw_view.setstyle, style(no)

        Comment


        • #5
          If the black line is a moving average or otherwise smoothed data from the colored points, consider presenting the three smooth curves (lines) on one graph, suppressing the underlying data noise. The reader may trust you that you used a standard smoothing procedure, or you can supplement this with a set of three "quality of fit" graphs in the appendix. Unless of course the choice of the smoother was an essential part of the solution. S.R.

          Comment


          • #6
            @ Friedrich > I got a sense it had to do with fy/fx and from the help file I understand that the values actually stand for % on the graph area. It is, however, an infuriating guessing game what is going on. Also, though unrelated, I wish there was a way to have a record of the syntax when fiddling directly in the editor.
            @ Sergiy > It is the smoothed data, but the preference for the graph is to include both. It's kind of a standard graph in the field - not necessarily what I would go for, but oh well : http://www.cpc.ncep.noaa.gov/product...ss_97/fig1.gif

            Comment


            • #7
              on the topic of smoothing, to my understand twoway graph line does no such thing - meaning it's just direct plotting. twoway lowess presents some smoothing options, but say one was interested in something as particular as a 13-term Gaussian filter designed to suppress variation on time scales less than 10 years, what would be the implementation path? or more generally, how would one integrate a very particular smoothing function.

              Comment


              • #8
                Originally posted by natalia malancu View Post
                I wish there was a way to have a record of the syntax when fiddling directly in the editor.
                You can record all edits with the Graph Recorder. See the section on the Graph Recorder in the help file for the Graph Editor.
                Code:
                help graph editor

                Comment


                • #9
                  Originally posted by natalia malancu View Post
                  I wish there was a way to have a record of the syntax when fiddling directly in the editor.
                  There is a way: click the record button before fiddling directly in the graph editor, then access the resulting do file which will be full of gr_edit commands. See http://www.stata.com/manuals14/g-1gr...sGraphRecorder and the Technical Note on the following page for details on where the resulting do file is stored.

                  Comment


                  • #10
                    Code:
                     
                    help tssmooth 
                    search bsmplot

                    Comment


                    • #11
                      thank you

                      Comment

                      Working...
                      X