I have 3 sub bar plots which placed vertically in line. But the 3rd one doesn´t show totally due to space limitation. Mico suggested me to use figure and subfigure environment. I have changed table subtable to figure subfigure. Now the problem is with \textwidth. I have already given a number to it, but TexMaker still tell me missing number, and it´s illegal unit of measure..
error msg: ! Missing number, treated as zero. }
l.16 \begin{subfigure}{0.9\textwidth} A number should have been here;
I inserted0'. (If you can't figure out why I needed to see a number,
weird error' in the index to The TeXbook.) ! Illegal unit of
look up
measure (pt inserted).
My script is under, here I present only one bar plot in order to shorten the script :
\documentclass{article}
\usepackage{subfigure}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{xcolor}
\usepackage{caption}
\usepackage{pgfplots}
\usepackage{tikz}
\definecolor{bblue}{HTML}{4F81BD}
\definecolor{rred}{HTML}{C0504D}
\definecolor{ggreen}{HTML}{9BBB59}
\definecolor{ppurple}{HTML}{9F4C7C}
\begin{document}
\begin{figure}
\begin{subfigure}{1\textwidth}
\centering
\begin{tikzpicture}
\begin{axis}[
width = 1*\textwidth,
height = 8cm,
enlarge y limits={upper, value=0.2},
ymin=0,
major x tick style = transparent,
ybar=2*\pgflinewidth,
bar width=20pt,
ymajorgrids = true,
ylabel = {Percentage Error in X Direction \%},
symbolic x coords={FH,UT,LT},
xtick = data,
nodes near coords,
scaled y ticks = false,
enlarge x limits=0.25,
ymin=0,
legend cell align=left,
legend style={
at={(1,1.05)},
anchor=south east,
column sep=1ex
}
]
\addplot[style={bblue,fill=bblue,mark=none]}]
coordinates {(FH, 100) (UT,100) (LT,100)};
\addplot[style={rred,fill=rred,mark=none}]
coordinates {(FH, 89) (UT,170) (LT,173)};
\legend{M,V}
\end{axis}
\end{tikzpicture}
\caption{In longitudinal Direction}
\end{subfigure}
\end{figure}
\end{document}
Thank you in advance!
Best Answer
Don't load the
subfigure
package -- it's deprecated. Instead, load thesubcaption
package. It's the same package as you loaded in your earlier query, which was aboutsubtable
environments.Since the bar charts are sufficiently large so that all three can't fit on a page, I suggest you use the
\ContinuedFloat
macro (provided by thecaption
package). Place the first twosubfigure
environments in afigure
on one page, and place one moresubfigure
, along with a\ContinuedFloat
directive, in a secondfigure
environment.