Announcement

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

  • Resize eps files when exporting them for use in latex

    Hello all,

    I am generating a contour plot, i have 346 times 346 observation, for a total of 119716 combinations. I am using the command "twoway contour" for which the dataset needs to look "long". So I have three varaibles: x1 (from 1 to 346) x2 (from 1 to 346) and x3 (this is the scale variable). I need to export the file in .eps so it can be compiled in latex. This is what I am doing:

    . use "D:\ContourGraphdata346.dta", clear
    . twoway contour x3 x1 x2 , level(8) ccolor(gs1 gs3 gs5 gs7 gs9 gs11 gs13 gs15 )
    . graph export "D:\ContourPlot.eps", as(eps) preview(on) replace

    The issue is my file si around 60Mb of size. The quality is amazing but it is too big.

    I have tried the options "xsize" and "Ysize" but it did not change the size of the plot.

    . twoway contour x3 x1 x2 , level(8) ccolor(gs1 gs3 gs5 gs7 gs9 gs11 gs13 gs15 ) xsize(2) ysize(2.75)
    . graph export "D:\ContourPlot.eps", as(eps) preview(on) replace

    What other options I have to resize this figure?

    Bests,

    Paulo

  • #2
    I think you're talking about excessive filesize, rather than excessively large dimensions. (The dimensions of a vector file such as EPS are [mostly] irrelevant.)

    I assume you have LaTeX installed. Converting to PDF may reduce filesize significantly. Then you may convert back to EPS if necessary. Try
    Code:
    eps2pdf ContourPlot.eps
    pdftops -eps ContourPlot_compressed.pdf

    Comment

    Working...
    X