0

How can I use \tikz to resize (scale) .eps-format picture (graph) without text and numbers inside it being resized?

PS. I have already been exposed to the same below Qs, but have problem implementing it for my case as I have .eps file and not sure what is the best option. Can anyone modify code below to work accordingly? Thanks.

Correctly scaling a tikzpicture

How to use \resizebox but not resize text (tikzpicture)

Scale tikz figure to a percentage of \textwidth

My Code needing to be changed for \tikz:

\documentclass[conference]{IEEEtran}
\usepackage{siunitx}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{array}
\usepackage{makecell, booktabs, multirow}

\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{tikzscale}
\usepackage{epstopdf}
\DeclareGraphicsExtensions{.eps}


\begin{document}
\begin{figure}[h]
\begin{center}\vspace{-0.4 cm}
{\resizebox{0.52\textwidth}{0.21\textwidth}{{\includegraphics*{Fig_11.eps}}}\vspace{-0.1 cm}
\midskip \footnotesize{\verb+      +(a)}\vspace{-0.6 cm}
\label{fig:Fig_11}
\end{center}}
\end{figure}

\end{document}

The figure also has x- and y-axis and legend.

  • You can use the eps file without the axes and pgfplots can generate the whole thing for you. See the manual for \addplot graphics part – percusse Oct 3 '15 at 16:37
  • I'm looking forward to a better answer... – Hans Oct 3 '15 at 17:34
  • @David Carlisle: I think I have found the solution to my above post here by using the matlab2tikz package as described here: matlab2tikz explained. Do you agree with this? – Hans Oct 4 '15 at 2:21
2

In general this is not possible, it depends on the form of the letters in the EPS file. If they are already drawn as paths rather than as character data (this used to be fairly common, perhaps less so now) then it would be very hard to change as there is no easy way to distinguish the letters.

If it is simple text you may be able to edit the EPS to change the text size and position or (simpler) use the psfrag package to replace the text by latex-typeset equivalents.

Or failing that you can scale the image and the over-print it with white boxes to hide the text then over-print latex-typeset text over that.

None of these is particularly convenient, and if possible, best to go back to the original application that made the EPS and generate one at the desired size.

I don't think tikz has any features related to this problem.

  • the original figure is a MATLAB figure, which I converted it to eps format to preserve its pixels. I can convert matlab fig. to another format if you think it is possible in another format to utilize \tikz? – Hans Oct 3 '15 at 16:13
  • @Hans I don't see how tikz is any way related. But in matlab you have a lot of control over the formatting so you should be able to generate an image that does not need to be resized, with text of the size you need. – David Carlisle Oct 3 '15 at 16:28
  • How David? could you give an example pls. – Hans Oct 3 '15 at 16:32
  • 1
    @Hans It's off topic here, purely a matlab question but for example mathworks.com/matlabcentral/answers/… – David Carlisle Oct 3 '15 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.