Announcement

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

  • graph export pdf display incorrectly in PowerPoint

    Hi all,

    Recently, I inserted some images (in pdf format) generated by Stata into PowerPoint. However, my professor claims that these images are not displaying correctly on his computer.
    Here is the process I used to reproduce the issue:

    Step 1, I use - graph export , as(pdf) - and export a graph into PDF format on my MacBook Pro (Apple M1 Pro).
    Step 2, Then I created a PPT file using MS Office 365 Power Point. I insert this pdf file as a picture. Everything is fine.
    Step 3, I send the pptx file to another machine using Windows 11.
    Step 4, Open the .PPTX file, the graph is not displaying properly.


    Code:
    version 18
    
    *** Data for the graph
    clear
    input h ano hue
    -10.5 -2.35 0
    -9.5 -2.25 0
    -8.5 -2.14 0
    -7.5 -2.01 0
    -6.5 -1.87 0
    -5.5 -1.7 0
    -4.5 -1.5 0
    -3.5 -1.25 0
    -2.5 -0.92 0
    -1.5 -0.41 0
    -0.5 0.0 0
    0.5 0.0 0
    1.5 -0.41 0
    2.5 -0.92 0
    3.5 -1.25 0
    4.5 -1.5 0
    5.5 -1.7 0
    6.5 -1.87 0
    7.5 -2.01 0
    8.5 -2.14 0
    9.5 -2.25 0
    10.5 -2.35 0
    11.5 -2.44 0
    12.5 -2.53 0
    13.5 -2.6 0
    14.5 -2.67 0
    15.5 2.74 1
    16.5 2.8 1
    17.5 2.86 1
    18.5 2.92 1
    19.5 2.97 1
    20.5 3.02 1
    21.5 3.07 1
    22.5 3.11 1
    23.5 3.16 1
    24.5 3.2 1
    25.5 3.24 1
    26.5 3.28 1
    27.5 3.31 1
    28.5 3.35 1
    29.5 3.38 1
    30.5 3.42 1
    31.5 3.45 1
    32.5 3.48 1
    33.5 3.51 1
    34.5 3.54 1
    35.5 3.57 1
    end
    
    global scheme graphregion(lc(white) lw(vthick)) ///
       plotregion(lc(black) lw(vthin) margin(0 0 0 0)) ///
       title(,size(medium)) ///
       ysc(lc(gs5) lw(thin)) ///
       xlab(-10(5)35, labs(*1.05) tlc(gs5) tlw(thin) glc(gs13) glp(solid) glw(thin) gmin gmax) ///
       ylab(#6, labs(*1.05) tlc(gs5) tlw(thin) glc(gs13) glp(solid) glw(thin) gmin gmax) ///
       xsc(lc(gs5) lw(thin))
    
    
    tw ///
       bar ano h, colorvar(hue) colordiscrete clegend(off) colorlist(navy%30 red%40) ///
       || ///
       fpfit ano h, lc(%80) lw(thick) ///
       , ///
       $scheme ///
       yline(0, lc(black) lp(solid) lw(thin)) ///
       xtitle("") ytitle("") ///
       legend(off) ///
       fxsize(100)
    
    graph export "plot/p_ano.pdf", as(pdf) replace
    The exported graph looks fine on my Macbook. I also send the PDF file to my Windows 11 machine and it looks fine.
    However, in the Windows 11 MS Office Power Point (PPTX format file), it looks like this (when the pdf is inserted):

    Click image for larger version

Name:	Screenshot 2024-07-11 093109.png
Views:	1
Size:	42.4 KB
ID:	1758425


    Only the frame of the graph is showing up. Many software are involved here, and I am not sure it is something with Stata.

    It is okay to use other formats, e.g., JPEG or PNG. But just wondering what's going on here.


    Kind regards,
    Hall

    Last edited by Xinya Hao; 10 Jul 2024, 19:43.

  • #2
    My first-pass guess is that the way you are adding the graph file to the Powerpoint is causing the file link to be added, instead of the file itself being embedded in the Powerpoint. So on your machines, the slides look fine, since the link to the original file works and Powerpoint internally accesses the file from that location. But for your professor, since the graph file itself is not on their machine, only the frame shows up and not the image itself.

    Comment


    • #3
      Originally posted by Hemanshu Kumar View Post
      My first-pass guess is that the way you are adding the graph file to the Powerpoint is causing the file link to be added, instead of the file itself being embedded in the Powerpoint. So on your machines, the slides look fine, since the link to the original file works and Powerpoint internally accesses the file from that location. But for your professor, since the graph file itself is not on their machine, only the frame shows up and not the image itself.
      A good guess. But I send the PPT file to another machine without other files (like the pdf of the graph) and it displayed correctly. So I guess it is not the "link" problem.

      Comment


      • #4
        Yes, scratch that response. I only just noticed that the axes of the graph are showing up, which would not be the case if it was a broken link. This is puzzling indeed.

        Comment


        • #5
          It will be an issue if someone can re-produce this using their machines. :-)

          Comment


          • #6
            It works fine on my PC. How do you insert the pdf to the Power Point slide?

            Comment


            • #7
              Originally posted by Frode Andre View Post
              It works fine on my PC. How do you insert the pdf to the Power Point slide?
              Have you tried generating the plot and PPT on a Mac and viewing it on your Win 11 PC?

              Comment


              • #8
                Looks like it's something related to "Inserting PDF file into WORD on Mac".
                If the graph in the pdf with software (Stata, R,...) generated graphs that have intensity below 100% (shaded area), the shaded area with not be display when you open the file on Windows.

                Comment

                Working...
                X