10

Hy Guys, I'm experiencing two problems with ticklabel formats. First, if I explicitly set scaled y ticks = true, the base ten notation still appears at every tick.

Here's the diagram:

Problem Child

Here the used code for the picture:

\begin{tikzpicture}

\begin{axis}[%
scaled y ticks = true,
width=4.52083in,
height=3.56562in,
xmin=0, xmax=0.01,
ymin=-0.0025, ymax=0,
xlabel={Time t [s]},
ylabel={TopNode Displacement [m]},
xmajorgrids,
ymajorgrids,
zmajorgrids,
legend entries={$D=0$},
legend style={nodes=right},
scaled x ticks = true,
x tick label style={
rotate=90,anchor=east,},
y tick label style={/pgf/number format/.cd,sci,precision=5}]
\addplot [
color=green,
solid,
line width=1.0pt
]
coordinates{
(0,0)(9.9173e-005,-3.01301e-005)(0.000199171,-0.000141203)(0.000299992,-0.000335604)
 ....
(0.0997007,-0.0021914)(0.0998004,-0.00218975)(0.099901,-0.00218216)(0.    
100001,-0.00216898) 
};

\end{axis}
\end{tikzpicture}

I dismissed the majority of the coordinate information, otherwise this post would be some 100 lines long.

If this should ever be solved my second question is if there is a way to set the exponent of the axis multiplier to a specific value, e.g. from 10^-3 to 10^-2?

0

2 Answers 2

18

I think

scaled ticks=base 10:3

or similar will solve both problems. You can do scaled x ticks or scaled y ticks separately, and the number after the colon is the common exponent that you're factoring out.

(Note that this is incompatible with your current y tick label style, so you will need to remove that before this works.)

2
  • 1
    And to have numbers displayed in 10^3 (instead of 10^-3) scaled ticks=base 10:-3 can be used.
    – Togh
    Dec 27, 2014 at 11:56
  • @Togh you saved the day!
    – gsamaras
    Aug 7, 2015 at 13:09
4

YES! scaled ticks=base 10:3 did the thang! But I had to remove the line y tick label style={/pgf/number format/.cd,sci,precision=5}.

The working code looks like this:

\begin{tikzpicture}

\begin{axis}[
scaled ticks=base 10:3,
width=4.52083in,
height=3.56562in,
xmin=0, xmax=0.01,
ymin=-0.0025, ymax=0,
xlabel={Time t [s]},
ylabel={TopNode Displacement [m]},
xmajorgrids,
ymajorgrids,
zmajorgrids,
legend entries={$D=0$},
legend style={nodes=right},]
\addplot [
color=green,
solid,
line width=1.0pt
]
coordinates{
...
};

\end{axis}
\end{tikzpicture}

Thank you so much.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .