0

I generated the following simple plot in Matlab:

Date=720000:730000
y=Date
plot(Date,y)
y=log(Date)
plot(Date,y)
datetick('x','yyyy')
matlab2tikz('test.tex')

which converts the date serial numbers into Years. I embedded this graphic into a Latex Document with the tikz package

\documentclass[]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{figure}
\centering
\input{primitives/test.tex}
\end{figure}
\end{document}

The resulting output plots the years correctly (1970-2000) but it also includes a 10^5 on the x-axis. The Matlab file produces the correct plot without the disturbing 10^5. How can I avoid this?

  • I don't know how that matlab feature works, but if it's generating a .tex file, the 10^5 is probably there somewhere, you can edit the test.tex file, look for that number and delete it. – MyUserIsThis May 31 '15 at 17:35
  • Thank you for your fast response. The 10^5 is not stated explicitly in the test.tex file. Instead, matlab2tikz exports the unconverted vector Dates and converts it in the test.tex file via xticklabels. Therefore, somehow, LateX seems to generate an x axis with the variables of Dates which are quite huge, then it converts it into the numbers 1970-2000 but the 10^5 is not removed. – Stefan Voigt May 31 '15 at 17:40
  • I'm writing my answer – MyUserIsThis May 31 '15 at 17:47
  • Look here: http://tex.stackexchange.com/questions/29926/how-to-prevent-pgfplots-from-using-the-10n-notation-for-axis-ticks

    I tried adding the options scaled ticks=false, tick label style={/pgf/number format/fixed}, to the axis environment, and it removed the 10^5

    – MyUserIsThis May 31 '15 at 17:48
  • @MyUserIsThis: Thank you for your help, it works for me but without the term tick label style={/pgf/number format/fixed}. If I add this, I get an error. – Stefan Voigt Jun 01 '15 at 07:53

1 Answers1

2

You have to add the option scaled ticks = false to the axis environment in the test.tex file to remove that number, this worked for me:

\begin{axis}[%
scaled ticks=false, 
tick label style={/pgf/number format/fixed},
width=4.133333in,
height=3.26in,
at={(0.693333in,0.44in)},
xmin=719529,
xmax=730486,
xtick={719529,721355,723181,725008,726834,728660,730486},
xticklabels={{1970},{1975},{1980},{1985},{1990},{1995},{2000}},
ymin=13.486,
ymax=13.502
]

producing the right image without the 10^5.

MyUserIsThis
  • 1,201