【问题标题】:Stata - Use gr_edit with name()Stata - 将 gr_edit 与 name() 一起使用
【发布时间】:2014-07-22 16:39:05
【问题描述】:

我正在研究 Stata 中的图形。我目前一直在使用gr_edit 命令来获取我在图形编辑器中更改的代码。像这样的:

histogram Car, frequency
gr_edit .plotregion1.plot1.style.editstyle area(shadestyle(color(navy))) editcopy
gr_edit .plotregion1.plot1.style.editstyle area(linestyle(color(navy))) editcopy
gr_edit .plotregion1.plot1._set_type rbarm

graph export ...

我想combine 这个直方图和另一个直方图。为此,我想以某种方式将它们都存储在内存中。我发现这样做的方法是在初始图形调用之后包含 name() 选项。但我认为如果我这样做,所有gr_edit 的东西都不会存在。是否可以将name() 函数(或类似函数)用作独立函数(而不仅仅是作为选项)以便将图形存储在内存中?

【问题讨论】:

    标签: memory graph plot save stata


    【解决方案1】:

    假设您确实需要 gr_edit 行,这可行:

    sysuse sp500, clear
    
    * first graph
    histogram volume, frequency saving(first)
    
    * second graph
    histogram volume, frequency
    
    gr_edit .plotregion1.plot1.style.editstyle area(shadestyle(color(navy))) editcopy
    gr_edit .plotregion1.plot1.style.editstyle area(linestyle(color(navy))) editcopy 
    gr_edit .plotregion1.plot1._set_type rbarm 
    
    graph save second
    
    * combined
    graph combine first.gph second.gph
    
    * erase original files
    rm first.gph 
    rm second.gph
    

    另见help tempfile

    【讨论】:

    • 谢谢。不知何故,我没有想到要保存然后删除。
    猜你喜欢
    • 2016-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-21
    • 1970-01-01
    • 1970-01-01
    • 2012-02-06
    相关资源
    最近更新 更多