Announcement

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

  • resolution problem when exporting graph as .png

    Hi everyone,

    I usually find it convenient to save Stata graphs as .png files and I used to do do this for many years now. Since a few days, I have a new notebook which creates the following problem using Stata 13. Whenever I create a simple line graph, the export file is disproportionately large in terms of resolution. Put differently, while the .gph file looks completely normal, the .png file looks as if somebody zoomed in to strongly. This problem arises already with the following MWE:
    Code:
    clear
    input price year
    1.5 2000
    1.5 2001
    1.7 2002
    1.95 2003
    1.6 2004
    1.3 2005
    1.6 2006
    1.65 2007
    end
    br
    
    twoway line price year
    graph export "C:\Users\Carlo\Desktop\test.png", as(png) replace
    Notice that I already thought about using width() and height() to alter the exported .png or the scaling parameters in twoway but nothing really helps. For convenience, I attach the (very simplistic) png file. Any ideas how to solve this?

    Best,

    Carlo

    Click image for larger version

Name:	test.png
Views:	1
Size:	9.9 KB
ID:	1424889

  • #2
    I can't replicate your problem. On my set up, the .png graph comes out just fine, looks exactly like the native .gph graph.

    I'm running Windows 7, Stata 15.1 MP2.

    Comment


    • #3
      I had foreseen that as none of my colleagues could replicate it either. Still, the problem occurs in my work as described above.. Could it be related to some graphical settings of my notebook. I am running Windows 10, Stata 13 MP.

      Comment


      • #4
        Little help to offer, except to confirm that on my system the png is also correct (Stata 15 MP).
        http://publicationslist.org/eric.melse

        Comment


        • #5
          Carlo, given the proportion of the chart you are losing, I sense it may be related to scaling for high resolution displays (added in Win 10).

          1. Try to switch it off: http://www.ficpa.org/content/News/Bi...uzzy-Text.aspx

          2. Try setting everything related to screen/fonts to 100%/normal for the time of investigation. There was a bunch of settings to make interface "more suitable for HDTVs" with unknown compatibility conditions: https://support.microsoft.com/en-us/...gh-dpi-devices

          3. Try also to connect an external monitor with some standard resolution, since the above suggests that the problem may appear differently on different screens. Try extending the desktop, placing Stata in different monitors, or try to use external monitor only, disabling the built-in.

          4. Try to run in WinXP mode and see if that helps.

          PS: The above is guesswork, but would be interesting to find out what exactly is the source of the problem.

          Best, Sergiy

          Comment


          • #6
            Thanks Sergiy, indeed that seems to be the cause of the problem. When disabling the DPI adjustment that comes along with high resolution displays and windows 10, as described above under the first link, the graph becomes normal again. Im am wondering though if Stata 15 may have an in-built fix for this issue which seems to be related to the fact that Stata 13 is not made for such displays. I will upgrade soon to test this issue.

            Comment


            • #7
              Originally posted by Carlo Parafioriti View Post
              Thanks Sergiy, indeed that seems to be the cause of the problem. When disabling the DPI adjustment that comes along with high resolution displays and windows 10, as described above under the first link, the graph becomes normal again. Im am wondering though if Stata 15 may have an in-built fix for this issue which seems to be related to the fact that Stata 13 is not made for such displays. I will upgrade soon to test this issue.
              Actually, I believe you had overridden the default behavior by checking the "Override High DPI scaling behavior" checkbox and then setting the "Scaling to be performed by:" combobox to "System (Enhanced)" from the shortcut's Compatibility tab (at least that's what we had to do to reproduce your problem here). We're not sure about the technical details behind this setting but restoring the setting to its default by unchecking the checkbox avoids the problem. You will get the same behavior if you enable that setting in Stata 15 too.
              -Chinh Nguyen

              Comment


              • #8
                Actually, I believe you had overridden the default behavior by checking the "Override High DPI scaling behavior" checkbox and then setting the "Scaling to be performed by:" combobox to "System (Enhanced)" from the shortcut's Compatibility tab (at least that's what we had to do to reproduce your problem here). We're not sure about the technical details behind this setting but restoring the setting to its default by unchecking the checkbox avoids the problem. You will get the same behavior if you enable that setting in Stata 15 too.
                Thanks Chinh, that was indeed the case. Initially I had set that option because in default fonts etc become blurry in Stata 13, which was also explained in the sources mentioned above.

                Comment

                Working...
                X