How Do I Insert an Excel Graph into LaTeX?

  • Context: LaTeX 
  • Thread starter Thread starter Blue Kangaroo
  • Start date Start date
  • Tags Tags
    Excel Graph Latex
Click For Summary

Discussion Overview

The discussion revolves around the challenges of inserting an Excel graph into LaTeX for a physics lab report. Participants explore various methods and troubleshooting steps related to LaTeX document preparation, particularly focusing on the inclusion of graphics.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant expresses frustration with inserting a graph into LaTeX, mentioning attempts to save the graph in different formats without success.
  • Another participant suggests including the graphicx package in the preamble and compiling with pdflatex.
  • A later reply confirms that the graphicx package is included but still encounters issues, indicating reliance on a professor's template.
  • One participant recommends converting the graphics file to EPS format as a potential solution.
  • Several participants share a working example of LaTeX code that successfully includes a graph, but the original poster notes discrepancies in output despite similar code.
  • Questions are raised about the proper uploading of the image file and its format, with requests for verification of the file's existence and functionality.
  • The original poster eventually resolves the issue of uploading the file but encounters a new problem regarding the order of the graph in the document, which they later also resolve.

Areas of Agreement / Disagreement

Participants generally agree on the necessity of the graphicx package and the importance of correctly uploading files. However, there are unresolved issues regarding the specific steps to ensure proper graph insertion and ordering within the document.

Contextual Notes

Limitations include potential misunderstandings about file formats, the specific LaTeX environment being used (sharelatex), and the need for proper file management within the project directory.

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,178
  • upload_2018-2-10_22-43-13.png
    upload_2018-2-10_22-43-13.png
    14.9 KB · Views: 1,070
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: 779
  • snip1.PNG
    snip1.PNG
    1.7 KB · Views: 770
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 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
3
Views
5K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 2 ·
Replies
2
Views
5K