Announcement

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

  • svg graph export respect line wrapping

    I like to illustrate my feature request that svg graph export should be able to respect the line wrapping of strings (see https://www.statalist.org/forums/for...21#post1771621).

    In the following example I am using -labsplit- from Asjad Naqvis' package -graphfunctions- either available from SSC or Github (https://github.com/asjadnaqvi/stata-graphfunctions).

    Code:
    cwf default
    cap frame drop auto
    frame create auto
    cwf auto
    
    sysuse auto
    
    labsplit make, wrap(1) gen(makesplit)
    
    twoway scatter weight price || ///
    scatter weight price if inrange(price,10000,15000), mlabel(makesplit) || ///
    , text(5000 3000 "Any two" "lines text") name(sc_w_p_split, replace) //
    
    graph export scatter_weight_price_split.svg, as(svg) replace name(sc_w_p_split)
    In the resulting -svg- graph the line wrapping of the text-option is respected but not the line wrapping from the variable. In the svg-code it looks different:

    Code:
     <textx="2456.69"y="1469.62"style="font-family:'Arial';font-size:79.94px;fill:#8CB110">Volvo
      260</text>
      <textx="944.46"y="149.25"style="font-family:'Arial';font-size:99.99px;fill:#000000"text-anchor="middle">Any two</text>
      <textx="944.46"y="249.25"style="font-family:'Arial';font-size:99.99px;fill:#000000"text-anchor="middle">lines text</text>

    Or can I avoid the use of wrapped strings from variables?
    Otherwise I have to give up my idea to switch to svg graphs...

  • #2
    I have got feedback from Stata Technical Support. At the moment it is difficult to achieve this kind of line wrapping in -svg- because the svg-standard used in Stata (svg 1.1) does not allow this. There are some more restrictions under the hood... like Stata does not officially support this kind of label wrapping itself...

    Comment

    Working...
    X