3

I have a 3D isosurface in matlab that I need to attach to a LaTeX file and im saving it with -depsc. To my knowledge, I can either save it with -painters, which produces a pure vector file or -opengl which rasters the whole figure. My problem is the vector file is too large (~100MB), but I need the axes and fonts to be vectorial so I can replace them in LaTeX via psfrag. Is there a way in MATLAB to raster the 3D objects but keep the axis and fonts as vector graphics?

Thanks in advance,

obchardon
  • 10,614
  • 1
  • 17
  • 33
Menc
  • 51
  • 2
  • 1
    100MB figure file seems large. I'd be surprised if you can actually see a lot of the data points on the plot with a normal resolution screen. One idea would be to downsample you plot so that their are fewer points being saved. Without an actual example in your question it's hard to elaborate on this suggestion... – Wolfie Mar 21 '18 at 15:34
  • @Wolfie vector file formats get often that big, specially when they need to represent non-vector information – Ander Biguri Mar 21 '18 at 15:47
  • 1
    @AnderBiguri: PS (and consequently EPS and PDF) as well as SVG can combine raster and vector drawings. – Cris Luengo Mar 21 '18 at 15:58
  • @CrisLuengo hum, perhaps then its the matlab "save to eps" thingie, but in the past I tried to do this from MATLAB and if there was an image in the eps, the file size would go crazy, assuming because it was triying to vector-describe the pixel image – Ander Biguri Mar 21 '18 at 15:59
  • @AnderBiguri: Yes, MATLAB outputs either raster or vector, it cannot combine the two. But it's not the file format that limits it. – Cris Luengo Mar 21 '18 at 16:02
  • @CrisLuengo ah, my bad! Lesson leaned :D thanks – Ander Biguri Mar 21 '18 at 16:03
  • @Menc MATLAB has some TeX and LaTeX capabilities. Can't you do what you need directly in MATLAB and thus avoid psfrag? – Luis Mendo Mar 21 '18 at 16:06
  • 3
    Have you looked at: [vecrast](https://ch.mathworks.com/matlabcentral/fileexchange/64650-vecrast) – obchardon Mar 21 '18 at 16:33
  • Haven't tried it, but what about `export_fig` ? – Ander Biguri Mar 21 '18 at 16:54
  • @LuisMendo That was what I was doing. But still it's not the same having a raster version of the labels than actual text. – Menc Mar 22 '18 at 13:29
  • @obchardon This is exactly what I needed, thanks. – Menc Mar 22 '18 at 13:29

0 Answers0