2

I have a problem with y-axis of my graph produced with this code:

\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{datavisualization}
\begin{document}

\begin{figure}[htbp]
\centering
\begin{tikzpicture}
  \datavisualization [
    scientific axes=clean,
    x axis={length=0.8\textwidth, ticks=some, label={Generation}},
    y axis={length=0.56\textwidth, logarithmic, ticks={minor steps between steps}, grid, label={Costs}},
    visualize as line/.list={best,average},
    legend=north east inside,
    best   ={label in legend={text=best cost}},
    average={label in legend={text=average cost}},
    style sheet=vary dashing
  ]
  data [format=named,set=best, read from file=bestGA.csv]
  data [format=named,set=average, read from file=averageGA.csv]
  ;
\end{tikzpicture}
\caption{GA: graphical representation of costs improvement shown for the average and the best VA.}
\label{fig:GAimprovement:eb_555AICH}
\end{figure}
\end{document}

The files with data: average.csv and best.csv

The ticks and the grid are there, only the labels are missing.

What I would like is for labels to also appear at the minor ticks (i.e. 8*10^6, 9*10^6 and 1,1*10^7). I read in the documentation that the minor ticks do not have labels, but is there a workaround? I already tried ticks={at={8000000,9000000,11000000}} to brute force the ticks, but to no avail ...

2

What is needed is ticks and grid={major at={8000000.0,9000000.0,10000000.0,20000000.0}} to get the desired effect.

wanted result

However, this is hard-coded now. Does anybody know of a better solution?

  • I truly ask myself, why bother posting a question, when after a while I find the answer myself? Happens too often lately - see this question. – Pjanc Matuzl Jan 9 '17 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.