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. – muffin1974 May 31 '15 at 17:40
  • I'm writing my answer – MyUserIsThis May 31 '15 at 17:47
  • Look here: tex.stackexchange.com/questions/29926/… 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. – muffin1974 Jun 1 '15 at 7:53
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.

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.