2

Trying to draw a bar chart either horizontal or vertical using following code

\RequirePackage{fix-cm}
\documentclass[smallextended]{svjour3} 
\usepackage{tikz, pgfplots}

\definecolor{Color}{HTML}{2B83BA}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[x={(-.5,0)}]
\foreach  \l/\x/\c[count=\y] in {L1-dCache-Read-Miss/0.225701966/Color, 
    L1-iCache-Read-Miss/-0.066446811/Color, 
    L3-Cache-Read-Miss/0.036589862/Color, 
    L3-Cache-Write-Miss/0.010495496/Color}
{\node[left] at (0,\y) {\l};
    \fill[\c] (0,\y-.4) rectangle (\x,\y+.4);
    \node[right] at (\x, \y) {\x};}
\draw (-.5,0) -- (.5,0);
\foreach \x in {-.1, -.09, -.08, ..., .2}
{\draw (\x,.2) -- (\x,0) node[below] {\x};}
\draw (0,0) -- (0,4.5);
\end{tikzpicture}
\end{figure}

\end{document}

Results are not as expected because of extremely small values. Expected output is as in the attached imageenter image description here

Yogesh
  • 41
  • 1
    Use xscale and yscale to scale the tikzpicture. Or just use pgfplots barplot – nidhin Aug 18 '19 at 05:45
  • I got this error: ! LaTeX Error: File "svjour3.cls" not found. Please make your code compileable. – AndréC Aug 18 '19 at 07:16
  • @AndréC You have to use Springer document class to compile it – Yogesh Aug 18 '19 at 09:06
  • Where do we find it? – AndréC Aug 18 '19 at 09:07
  • If the problem isn't related to the class (which I think is the case here), you might as well use \documentclass{article} for the example. – Torbjørn T. Aug 18 '19 at 09:12
  • @AndréC You can find it here https://www.springer.com/gp/livingreviews/latex-templates – Yogesh Aug 18 '19 at 09:33
  • @TorbjørnT. I am preparing a manuscript for Springer. – Yogesh Aug 18 '19 at 09:33
  • Yes, but the problem you're describing is about TikZ, not the svjour class, and not any interaction between TikZ and svjour. It's likely that a solution with article will work just as well with svjour. As suggested above using pgfplots for this might be a good idea, here is one somewhat similar example: https://tex.stackexchange.com/questions/160819 – Torbjørn T. Aug 18 '19 at 09:54
  • In your graph you have inverted the role of the abscissa and ordinate. What you called \x is not an abscissa, it's actually an ordinate. And vice versa; \y is actually an abscissa. – AndréC Aug 18 '19 at 14:26

0 Answers0