![Line Graphs](https://writelatex.s3.amazonaws.com/published_ver/6251.jpeg?X-Amz-Expires=14400&X-Amz-Date=20240630T124056Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAWJBOALPNFPV7PVH5/20240630/us-east-1/s3/aws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=ab464262fba7be86d9a1a7439f5521b1687da4d7c22f1a479a39231448fc23b2)
Line Graphs
Autor
chathuri
Letzte Aktualisierung
vor 7 Jahren
Lizenz
Creative Commons CC BY 4.0
Abstrakt
LaTeX codes for line charts
![Line Graphs](https://writelatex.s3.amazonaws.com/published_ver/6251.jpeg?X-Amz-Expires=14400&X-Amz-Date=20240630T124056Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAWJBOALPNFPV7PVH5/20240630/us-east-1/s3/aws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=ab464262fba7be86d9a1a7439f5521b1687da4d7c22f1a479a39231448fc23b2)
LaTeX codes for line charts
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
%enter the data sets as follows.
\begin{filecontents}{thu2.dat}
X Time Part1 Part2
1 12.45-1.15 32 1
2 1.15-1.45 1 1
3 1.45-2.15 1 1
4 2.15-2.45 1 1
5 2.45-3.15 1 1
\end{filecontents}
\begin{filecontents}{thu3.dat}
X Time Part1 Part2
1 12.45-1.15 6 1
2 1.15-1.45 5 1
3 1.45-2.15 2 1
4 2.15-2.45 1 1
5 2.45-3.15 1 1
6 3.15-3.45 1 1
7 3.45-4.15 1 1
\end{filecontents}
\begin{document}
\begin{figure}[h!]
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
ymin=0,
x label style={at={(current axis.right of origin)},anchor=north, below=10mm},
title={\textit{\textbf{Medical Officer}}},
xlabel=Time,
ylabel=No. of Channels,
xticklabel style = {rotate=30,anchor=east},
enlargelimits = false,
xticklabels from table={thu2.dat}{Time},xtick=data]
\addplot[orange,thick,mark=square*] table [y=Part1,x=X]{thu2.dat};
\addlegendentry{Part I}
\addplot[green,thick,mark=square*] table [y= Part2,x=X]{thu2.dat};
\addlegendentry{Part II}]
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
ymin=0,
x label style={at={(current axis.right of origin)},anchor=north, below=10mm},
title={\textbf{\textit{Consultant}}},
xlabel=Time,
ylabel=No. of Channels,
xticklabel style = {rotate=30,anchor=east},
enlargelimits = false,
xticklabels from table={thu3.dat}{Time},xtick=data]
\addplot[orange,thick,mark=square*] table [y=Part1,x=X]{thu3.dat};
\addlegendentry{Part I}
\addplot[green,thick,mark=square*] table [y= Part2,x=X]{thu3.dat};
\addlegendentry{Part II}
\end{axis}
\end{tikzpicture}
\caption{Comparison between part 1 and part 2 on Thursday}
\end{figure}
\end{document}