LaTeX How Do I Insert an Excel Graph into LaTeX?

  • Thread starter Thread starter Blue Kangaroo
  • Start date Start date
  • Tags Tags
    Excel Graph Latex
AI Thread Summary
Inserting an Excel graph into LaTeX can be challenging, especially for those unfamiliar with technology. The user expressed frustration after attempting to include a graph but only seeing a blank box in the output. Key suggestions included ensuring the graphicx package is included in the preamble and converting the graphics file to EPS format for compatibility. The user eventually resolved the issue by uploading the graph file correctly but faced a new challenge with the graph's placement in the document. Ultimately, they managed to fix the placement issue as well, indicating progress in their LaTeX skills.
Blue Kangaroo
Messages
41
Reaction score
1
Let me preface this by saying I am reasonably intelligent overall, but I'm a complete idiot when it comes to computers and technology. I've been trying for hours to put a graph onto LaTeX for a physics labs, but I'm getting nowhere and very frustrated. I've tried to follow guides online, but none has worked for me. I've copied the graph into Paint, the tried saving it variously as a PDF, PNG AND JPEG and gotten the same result with each -- just a plain white box with some text on the left side of the box stating the name I gave the file, such as graph.png.

Here are the lines of input I have

\begin{figure}[h]
\centering
\includegraphics[width=5in]{chart.jpg}
\caption{This figure shows the velocity vs time graph for the given data.}
\end{figure}

I can't tell what I'm doing wrong. I feel very stupid and very frustrated.

I've also tried putting both the graph and the .tex in the same folder, but that hasn't borne any fruit. Help would be very greatly appreciated.
 
Physics news on Phys.org
Did you include graphicx package in your preamble? That is, you need put a line \usepackage{graphicx} before \begin{document}
You also need to compile by using pdflatex.
 
eys_physics said:
Did you include graphicx package in your preamble? That is, you need put a line \usepackage{graphicx} before \begin{document}
You also need to compile by using pdflatex.

Yes, I do have \usepackage{graphicx} before \begin{document}. We're using sharelatex and as far as I can tell I went right off of my professor's template, yet I can't get it right. I could post all the input I have (not that much), but I'm not sure if I'm allowed to do that here.
 
Try to convert you graphics file to EPS format. It works for me.

Eugene.
 
This works on sharelatex.\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}

\title{test1}
\author{robphy}
\date{February 2018}

\begin{document}

\maketitle

\section{Introduction}

\begin{figure}[h]
\centering
\includegraphics[width=5in]{chart.jpg}
\caption{This figure shows the velocity vs time graph for the given data.}
\end{figure}

\end{document}I uploaded a chart.jpg file (a screen capture of part of the browser window).
upload_2018-2-10_22-42-57.png


Here is the output.
upload_2018-2-10_22-43-13.png
 

Attachments

  • upload_2018-2-10_22-42-57.png
    upload_2018-2-10_22-42-57.png
    10.6 KB · Views: 1,124
  • upload_2018-2-10_22-43-13.png
    upload_2018-2-10_22-43-13.png
    14.9 KB · Views: 1,039
robphy said:
This works on sharelatex.\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}

\title{test1}
\author{robphy}
\date{February 2018}

\begin{document}

\maketitle

\section{Introduction}

\begin{figure}[h]
\centering
\includegraphics[width=5in]{chart.jpg}
\caption{This figure shows the velocity vs time graph for the given data.}
\end{figure}

\end{document}I uploaded a chart.jpg file (a screen capture of part of the browser window).
View attachment 220135

Here is the output.
View attachment 220136

As far as I can tell, I have the same as you, but I'm not getting the same result. I've uploaded a picture of most of my input and a picture of what should be my graph.
 

Attachments

  • snip2.PNG
    snip2.PNG
    41.7 KB · Views: 759
  • snip1.PNG
    snip1.PNG
    1.7 KB · Views: 753
Is chart.jpg uploaded and located alongside main.tex, as shown the screen capture of my code?

Is chart.jpg actually a working jpg file?
Can you upload it here?
 
OK I solved the problem. I didn't realize I had to upload the file there. So I have that problem fixed. Now my problem is that it's putting the graph the wrong order. I wanted it to be before the conclusion, but for some reason it started the conclusion first and then place the graph the next page. Hopefully I can figure this one out on my own.
Edit: I figured that out too. Thanks for your help.
 
Last edited:

Similar threads

Replies
4
Views
2K
Replies
4
Views
3K
Replies
3
Views
2K
Replies
1
Views
2K
Replies
2
Views
3K
Replies
2
Views
3K
Replies
2
Views
4K
Replies
5
Views
4K
Replies
2
Views
5K
Replies
5
Views
5K
Back
Top