Announcement

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

  • spmap (SSC), problem with vector graphics

    Colleagues,

    I'm working on simple set of maps using Pisati's spmap (SSC). I am interested in obtaining graphs in high resolution and consequently I'm trying to export graphs to vector formats. Unfortunately the results are far from satisfactory. As illustrated in the attached pictures, the maps are not readable. I am familiar with exporting graphs to TIF format but I would rather avoid doing that due to the size of generated files. Consequently, I want to ask if there are any workarounds concerned with exporting vector graphics?
    Kind regards,
    Konrad
    Version: Stata/IC 13.1

  • #2
    Have you any reason to point at spmap specifically?

    Comment


    • #3
      As a matter of fact yes, the problems usually occur when exporting maps. However, on a few occassions I came across similar problems when exporting rather complex graphs involving number of elements. The rule of thumb is that relatively simple graphs tend to export to vectors perfectly fine, more complex graphs (maps in particular) are often not exported properly with missing elements presents. I should add that I'm using Stata/IC 13.1 on Windows 7.
      Kind regards,
      Konrad
      Version: Stata/IC 13.1

      Comment


      • #4
        Konrad,

        I think what Nick is asking is whether spmap is really to blame, or whether it is Stata graphing more generally. Your answer seems to suggest that this is a problem with Stata graphing, particular with graphs involving a lot of complex elements. Accordingly, the question should be directed at Stata's graphing routines, not at spmap.

        I would add that it might be helpful to be more specific about exactly what you did and why you think the results are unacceptable. If there are other examples of similar problems involving programs other than spmap, that may be helpful for narrowing down the problem.

        Finally, what happens when you try to export as TIFF? How much larger are the files? Are they better quality? Generally speaking, you get what you pay for when it comes to graphics; i.e., the smaller the file the worse the resolution. Moreover, vector graphics are only going to save you space if you have a relatively small number of line segments. If you have a large number of very small segments, you probably don't save anything over bitmap graphics.

        Regards,
        Joe

        Comment


        • #5
          Joe/Nick,

          apologies for not being sufficiently precise. With respect to the spmap I used the following syntax to generate a map consisting of approximately 100shapefiles. The average TIF files are sizes of a few MB. TIF files are presentable and I tend to use them, it's a solution that I can live with. Having said, I would ideally export vector graphics to vector formats, this is what it was designed for. With respect to the similar errors, I encountered problems whenever exporting rather complex graphs (broadly speaking: scatter plus some lines plus legends plus labels and some colours). With respect to this post, I was simply interested whether there any alternatives to smartly export Stata graphics to vector formats without using Stata's export mechanism. For instance there is Rossman's graphexportpdf (SSC), I was simply wondering whether similar programs concerned with vector graphics are known to the Forum Members as findit didn't return satisfactory results.

          Code:
          foreach var of varlist varlist some_varlist {
             
              * Define variable to map.
              local mapvar `var'
              
              *Format variable to reduce decimal places.
              format %5.0f `mapvar'
              
              *Take the variable label to label macro.
              local mylabel : variable label `mapvar'
              
              *Draw the map.
              spmap `mapvar' if group == "Some Group" using ///
              "path to the file", ///
              id(dzid) ndfcolor(white) fcolor(RdBu) osize(thin) ///
                  ocolor(black) mosize(none) clnumber(6) ///
              legenda(on) ndlabel("No data") legstyle(2) ///
              legtitle("{bf: Rate (%)}")  ///
              legend(position(1) region(lcolor(black) margin(1 1 1 1) fcolor(white))) ///
              title("`mylabel'", size(medsmall) color(black))  ///
              name(map_`mapvar', replace) ///
              clmethod(q)    
          }
          Last edited by Konrad Zdeb; 02 Jun 2014, 07:07.
          Kind regards,
          Konrad
          Version: Stata/IC 13.1

          Comment


          • #6
            Despite the extra detail I am still struggling to see what graph file format you are using and precisely what the problem is. This thread seems to be suffering from your asking several questions at once. For example, your original photos are barely readable but in the second there is a coloured key but no colours show. Is that the problem? What "vector formats" are you talking about? I won't be the person to answer but your question still seems very unclear to me.

            Comment


            • #7
              Konrad,

              The gold standard for vector graphics output (at least on the web) seems to be (or is becoming) SVG, but I don't see any programs that can export Stata graphs in this format. Have you tried to export as either EPS or WMF? For what I understand, these may do a better job with vector graphics.

              Regards,
              Joe

              Comment


              • #8
                P.S. I did some exploring of my own using spmap with a generic US map. EPS and WMF are definitely better than PNG and TIF. For that matter, PDF is better as well. The graphexportpdf program you referred to is for Mac and Linux and just outputs using EPS and then converts to PDF. In order to use EPS you may need to convert to PDF anyway, which seems to be about the same as exporting directly to PDF.

                You don't say what format you ultimately want to use, but if you need a high quality JPG or PNG, you can export to WMF, open in Paint, and then export to JPG or PNG.

                Comment


                • #9
                  Konrad,

                  try ADePT Maps 2.0. It has recently been updated to be compatible with Stata up to version 13.1 and does its own export (to PNG only). If you need hundreds of maps, you can specify all necessary parameters in the command line, see instructions in the user's guide.

                  Best, Sergiy Radyakin

                  PS: Image below may be resized by the forum software. Just in case, here is the original.

                  Comment


                  • #10
                    Originally posted by Joe Canner View Post
                    You don't say what format you ultimately want to use, but if you need a high quality JPG or PNG, you can export to WMF, open in Paint, and then export to JPG or PNG.
                    Joe,

                    Thanks for your comments. I'm no too fussy about the format, I can use any vector graphic my goal was to avoid manufacturing bulky TIFs and produce maps that will be usable for prepress. I'm familiar with making high resolution raster graphics in Stata but it seems such a waste as vector graphics appear to be much more sensible solution, just that they don't work properly.


                    Originally posted by Sergiy Radyakin View Post
                    try ADePT Maps 2.0. It has recently been updated to be compatible with Stata up to version 13.1 and does its own export (to PNG only).
                    Sergiy,

                    Thanks very much for this suggestion,I will definitely have a look. Having said that, I'm afraid that PNG may be not enough as I've to prepare some of the materials for publication and high quality is crucial, hence all the hassle with vector graphics.
                    Kind regards,
                    Konrad
                    Version: Stata/IC 13.1

                    Comment


                    • #11
                      Konrad,

                      I have tried exporting STATA graphs (e.g. scatter plots and maps) to be saved as "*.emf" files (enhanced media format) and they look quite OK. Of course they don't behave like *.svg files which can be enlarged without losing clarity, but they look certainly much better than the examples you posted up there. Hope this helps.

                      Comment


                      • #12
                        Originally posted by Konrad Zdeb View Post
                        Colleagues,

                        I'm working on simple set of maps using Pisati's spmap (SSC). I am interested in obtaining graphs in high resolution and consequently I'm trying to export graphs to vector formats. Unfortunately the results are far from satisfactory. As illustrated in the attached pictures, the maps are not readable. I am familiar with exporting graphs to TIF format but I would rather avoid doing that due to the size of generated files. Consequently, I want to ask if there are any workarounds concerned with exporting vector graphics?
                        Why can't you use vector maps as base? I`m using this small library of this guys:
                        http://vectormap.info/free-maps-for-...s-and-mappers/

                        Comment


                        • #13
                          Originally posted by Angel Ramirez View Post

                          Why can't you use vector maps as base? I`m using this small library of this guys:
                          http://vectormap.info/free-maps-for-...s-and-mappers/
                          Thanks for showing the interest; this discussion is rather dated, but if I remember correctly at this moment in time I was working with the *.shx files as a base. Shapefiles are vector files. Since that time I started using R for generating maps and spatial analysis, mostly ggplot for visuals.
                          Kind regards,
                          Konrad
                          Version: Stata/IC 13.1

                          Comment

                          Working...
                          X