ylim with negative floating point number
Clash Royale CLAN TAG#URR8PPP
up vote
7
down vote
favorite
Could someone explain me why the following code compile perfectly :
documentclassarticle
usepackagepgfplots
pgfplotssetcompat=1.14
pgfplotsset/pgf/number format/.cd, 1000 sep=, assume math mode=true
begindocument
begintikzpicture
beginaxis[%
width=4cm,
height=4cm,
ymin=-0.5,
ymax=0,
]
addplot [forget plot]
table[row sep=crcr]%
5 -0.000535\
;
endaxis
endtikzpicture
enddocument
while if I want
ymin=-0.1,
it does not compile anymore. Error message :
Missing $ inserted.
Clues for a possible answer :
if the math mode is removed, the compilation is possible in both cases. But I dont want to remove it.
if I have
ymin=-0.1
andymax=0.5
, it compiles too ...
Well ... I dont understand.
tikz-pgf math-mode floating-point
add a comment |Â
up vote
7
down vote
favorite
Could someone explain me why the following code compile perfectly :
documentclassarticle
usepackagepgfplots
pgfplotssetcompat=1.14
pgfplotsset/pgf/number format/.cd, 1000 sep=, assume math mode=true
begindocument
begintikzpicture
beginaxis[%
width=4cm,
height=4cm,
ymin=-0.5,
ymax=0,
]
addplot [forget plot]
table[row sep=crcr]%
5 -0.000535\
;
endaxis
endtikzpicture
enddocument
while if I want
ymin=-0.1,
it does not compile anymore. Error message :
Missing $ inserted.
Clues for a possible answer :
if the math mode is removed, the compilation is possible in both cases. But I dont want to remove it.
if I have
ymin=-0.1
andymax=0.5
, it compiles too ...
Well ... I dont understand.
tikz-pgf math-mode floating-point
1
Why do you needassume math mode
?
– BambOo
Aug 8 at 10:04
im using it elsewhere on my document ;-) maybe i can remove it and adapt the document, but this is not the point here :-(
– Viv
Aug 8 at 10:27
See my answer below
– BambOo
Aug 8 at 10:32
1
Addingyticklabels=
to the axis options seems to remove the error. This seems related to the automatic computation of ticks or ticklabels in this situation.
– BambOo
Aug 8 at 11:17
add a comment |Â
up vote
7
down vote
favorite
up vote
7
down vote
favorite
Could someone explain me why the following code compile perfectly :
documentclassarticle
usepackagepgfplots
pgfplotssetcompat=1.14
pgfplotsset/pgf/number format/.cd, 1000 sep=, assume math mode=true
begindocument
begintikzpicture
beginaxis[%
width=4cm,
height=4cm,
ymin=-0.5,
ymax=0,
]
addplot [forget plot]
table[row sep=crcr]%
5 -0.000535\
;
endaxis
endtikzpicture
enddocument
while if I want
ymin=-0.1,
it does not compile anymore. Error message :
Missing $ inserted.
Clues for a possible answer :
if the math mode is removed, the compilation is possible in both cases. But I dont want to remove it.
if I have
ymin=-0.1
andymax=0.5
, it compiles too ...
Well ... I dont understand.
tikz-pgf math-mode floating-point
Could someone explain me why the following code compile perfectly :
documentclassarticle
usepackagepgfplots
pgfplotssetcompat=1.14
pgfplotsset/pgf/number format/.cd, 1000 sep=, assume math mode=true
begindocument
begintikzpicture
beginaxis[%
width=4cm,
height=4cm,
ymin=-0.5,
ymax=0,
]
addplot [forget plot]
table[row sep=crcr]%
5 -0.000535\
;
endaxis
endtikzpicture
enddocument
while if I want
ymin=-0.1,
it does not compile anymore. Error message :
Missing $ inserted.
Clues for a possible answer :
if the math mode is removed, the compilation is possible in both cases. But I dont want to remove it.
if I have
ymin=-0.1
andymax=0.5
, it compiles too ...
Well ... I dont understand.
tikz-pgf math-mode floating-point
edited Aug 8 at 9:58


Raaja
1,4571522
1,4571522
asked Aug 8 at 9:54


Viv
386
386
1
Why do you needassume math mode
?
– BambOo
Aug 8 at 10:04
im using it elsewhere on my document ;-) maybe i can remove it and adapt the document, but this is not the point here :-(
– Viv
Aug 8 at 10:27
See my answer below
– BambOo
Aug 8 at 10:32
1
Addingyticklabels=
to the axis options seems to remove the error. This seems related to the automatic computation of ticks or ticklabels in this situation.
– BambOo
Aug 8 at 11:17
add a comment |Â
1
Why do you needassume math mode
?
– BambOo
Aug 8 at 10:04
im using it elsewhere on my document ;-) maybe i can remove it and adapt the document, but this is not the point here :-(
– Viv
Aug 8 at 10:27
See my answer below
– BambOo
Aug 8 at 10:32
1
Addingyticklabels=
to the axis options seems to remove the error. This seems related to the automatic computation of ticks or ticklabels in this situation.
– BambOo
Aug 8 at 11:17
1
1
Why do you need
assume math mode
?– BambOo
Aug 8 at 10:04
Why do you need
assume math mode
?– BambOo
Aug 8 at 10:04
im using it elsewhere on my document ;-) maybe i can remove it and adapt the document, but this is not the point here :-(
– Viv
Aug 8 at 10:27
im using it elsewhere on my document ;-) maybe i can remove it and adapt the document, but this is not the point here :-(
– Viv
Aug 8 at 10:27
See my answer below
– BambOo
Aug 8 at 10:32
See my answer below
– BambOo
Aug 8 at 10:32
1
1
Adding
yticklabels=
to the axis options seems to remove the error. This seems related to the automatic computation of ticks or ticklabels in this situation.– BambOo
Aug 8 at 11:17
Adding
yticklabels=
to the axis options seems to remove the error. This seems related to the automatic computation of ticks or ticklabels in this situation.– BambOo
Aug 8 at 11:17
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
accepted
Your attempt fails, because PGFPlots changes the way the ytick
s/yticklabels
are drawn when you change ymin
to -0.1
(see left plot). And this of course cannot be drawn in text mode, because in text mode neither cdot
nor ^
are known/can be interpreted.
To circumvent this problem you can change the number format of the yticklabels
"back" to fixed
(see right plot). (Optionally you can move the yticklabel style
part to the preamble as well.)
% used PGFPlots v1.16
documentclass[border=5pt]standalone
usepackagepgfplots
pgfplotsset
/pgf/number format/.cd,
1000 sep=,
assume math mode=true,
begindocument
% dummy plot to show where the problem is coming from
begintikzpicture
beginaxis[
width=4cm,
height=4cm,
ymin=-0.1,
ymax=0,
% don't assume math mode
/pgf/number format/assume math mode=false,
]
addplot table
5 -0.000535
;
endaxis
endtikzpicture
% plot showing how to circumvent the problem
begintikzpicture
beginaxis[
width=4cm,
height=4cm,
ymin=-0.1,
ymax=0,
% change number format to `fixed'
yticklabel style=
/pgf/number format/fixed,
% % (optionally change the `precision' to your needs)
% /pgf/number format/precision=2,
,
]
addplot table
5 -0.000535
;
endaxis
endtikzpicture
enddocument
Exactly what i was waiting for as explanation ! Thank you very much
– Viv
Aug 14 at 8:24
add a comment |Â
up vote
2
down vote
If you do not need assume math mode=true
for this specific tikzpicture
, you can pass /pgf/number format/assume math mode=false
to the axis
environment options or to the tikzpicture
environment options to avoid the error.
another good solution in deed ! But i fact i spent one our to understand that the problem was coming from the math mode, i dont really understrand why it behaves like that ...
– Viv
Aug 8 at 10:35
Maybe more advanded users as @marmot could answer that more precisely, but try to plot something almost empty may be the reason...
– BambOo
Aug 8 at 10:39
I dont think this is the reason because the problem appeared with a huge figure ;-)
– Viv
Aug 8 at 11:05
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
Your attempt fails, because PGFPlots changes the way the ytick
s/yticklabels
are drawn when you change ymin
to -0.1
(see left plot). And this of course cannot be drawn in text mode, because in text mode neither cdot
nor ^
are known/can be interpreted.
To circumvent this problem you can change the number format of the yticklabels
"back" to fixed
(see right plot). (Optionally you can move the yticklabel style
part to the preamble as well.)
% used PGFPlots v1.16
documentclass[border=5pt]standalone
usepackagepgfplots
pgfplotsset
/pgf/number format/.cd,
1000 sep=,
assume math mode=true,
begindocument
% dummy plot to show where the problem is coming from
begintikzpicture
beginaxis[
width=4cm,
height=4cm,
ymin=-0.1,
ymax=0,
% don't assume math mode
/pgf/number format/assume math mode=false,
]
addplot table
5 -0.000535
;
endaxis
endtikzpicture
% plot showing how to circumvent the problem
begintikzpicture
beginaxis[
width=4cm,
height=4cm,
ymin=-0.1,
ymax=0,
% change number format to `fixed'
yticklabel style=
/pgf/number format/fixed,
% % (optionally change the `precision' to your needs)
% /pgf/number format/precision=2,
,
]
addplot table
5 -0.000535
;
endaxis
endtikzpicture
enddocument
Exactly what i was waiting for as explanation ! Thank you very much
– Viv
Aug 14 at 8:24
add a comment |Â
up vote
3
down vote
accepted
Your attempt fails, because PGFPlots changes the way the ytick
s/yticklabels
are drawn when you change ymin
to -0.1
(see left plot). And this of course cannot be drawn in text mode, because in text mode neither cdot
nor ^
are known/can be interpreted.
To circumvent this problem you can change the number format of the yticklabels
"back" to fixed
(see right plot). (Optionally you can move the yticklabel style
part to the preamble as well.)
% used PGFPlots v1.16
documentclass[border=5pt]standalone
usepackagepgfplots
pgfplotsset
/pgf/number format/.cd,
1000 sep=,
assume math mode=true,
begindocument
% dummy plot to show where the problem is coming from
begintikzpicture
beginaxis[
width=4cm,
height=4cm,
ymin=-0.1,
ymax=0,
% don't assume math mode
/pgf/number format/assume math mode=false,
]
addplot table
5 -0.000535
;
endaxis
endtikzpicture
% plot showing how to circumvent the problem
begintikzpicture
beginaxis[
width=4cm,
height=4cm,
ymin=-0.1,
ymax=0,
% change number format to `fixed'
yticklabel style=
/pgf/number format/fixed,
% % (optionally change the `precision' to your needs)
% /pgf/number format/precision=2,
,
]
addplot table
5 -0.000535
;
endaxis
endtikzpicture
enddocument
Exactly what i was waiting for as explanation ! Thank you very much
– Viv
Aug 14 at 8:24
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
Your attempt fails, because PGFPlots changes the way the ytick
s/yticklabels
are drawn when you change ymin
to -0.1
(see left plot). And this of course cannot be drawn in text mode, because in text mode neither cdot
nor ^
are known/can be interpreted.
To circumvent this problem you can change the number format of the yticklabels
"back" to fixed
(see right plot). (Optionally you can move the yticklabel style
part to the preamble as well.)
% used PGFPlots v1.16
documentclass[border=5pt]standalone
usepackagepgfplots
pgfplotsset
/pgf/number format/.cd,
1000 sep=,
assume math mode=true,
begindocument
% dummy plot to show where the problem is coming from
begintikzpicture
beginaxis[
width=4cm,
height=4cm,
ymin=-0.1,
ymax=0,
% don't assume math mode
/pgf/number format/assume math mode=false,
]
addplot table
5 -0.000535
;
endaxis
endtikzpicture
% plot showing how to circumvent the problem
begintikzpicture
beginaxis[
width=4cm,
height=4cm,
ymin=-0.1,
ymax=0,
% change number format to `fixed'
yticklabel style=
/pgf/number format/fixed,
% % (optionally change the `precision' to your needs)
% /pgf/number format/precision=2,
,
]
addplot table
5 -0.000535
;
endaxis
endtikzpicture
enddocument
Your attempt fails, because PGFPlots changes the way the ytick
s/yticklabels
are drawn when you change ymin
to -0.1
(see left plot). And this of course cannot be drawn in text mode, because in text mode neither cdot
nor ^
are known/can be interpreted.
To circumvent this problem you can change the number format of the yticklabels
"back" to fixed
(see right plot). (Optionally you can move the yticklabel style
part to the preamble as well.)
% used PGFPlots v1.16
documentclass[border=5pt]standalone
usepackagepgfplots
pgfplotsset
/pgf/number format/.cd,
1000 sep=,
assume math mode=true,
begindocument
% dummy plot to show where the problem is coming from
begintikzpicture
beginaxis[
width=4cm,
height=4cm,
ymin=-0.1,
ymax=0,
% don't assume math mode
/pgf/number format/assume math mode=false,
]
addplot table
5 -0.000535
;
endaxis
endtikzpicture
% plot showing how to circumvent the problem
begintikzpicture
beginaxis[
width=4cm,
height=4cm,
ymin=-0.1,
ymax=0,
% change number format to `fixed'
yticklabel style=
/pgf/number format/fixed,
% % (optionally change the `precision' to your needs)
% /pgf/number format/precision=2,
,
]
addplot table
5 -0.000535
;
endaxis
endtikzpicture
enddocument
edited Aug 13 at 15:12
answered Aug 13 at 15:04
Stefan Pinnow
18.7k83169
18.7k83169
Exactly what i was waiting for as explanation ! Thank you very much
– Viv
Aug 14 at 8:24
add a comment |Â
Exactly what i was waiting for as explanation ! Thank you very much
– Viv
Aug 14 at 8:24
Exactly what i was waiting for as explanation ! Thank you very much
– Viv
Aug 14 at 8:24
Exactly what i was waiting for as explanation ! Thank you very much
– Viv
Aug 14 at 8:24
add a comment |Â
up vote
2
down vote
If you do not need assume math mode=true
for this specific tikzpicture
, you can pass /pgf/number format/assume math mode=false
to the axis
environment options or to the tikzpicture
environment options to avoid the error.
another good solution in deed ! But i fact i spent one our to understand that the problem was coming from the math mode, i dont really understrand why it behaves like that ...
– Viv
Aug 8 at 10:35
Maybe more advanded users as @marmot could answer that more precisely, but try to plot something almost empty may be the reason...
– BambOo
Aug 8 at 10:39
I dont think this is the reason because the problem appeared with a huge figure ;-)
– Viv
Aug 8 at 11:05
add a comment |Â
up vote
2
down vote
If you do not need assume math mode=true
for this specific tikzpicture
, you can pass /pgf/number format/assume math mode=false
to the axis
environment options or to the tikzpicture
environment options to avoid the error.
another good solution in deed ! But i fact i spent one our to understand that the problem was coming from the math mode, i dont really understrand why it behaves like that ...
– Viv
Aug 8 at 10:35
Maybe more advanded users as @marmot could answer that more precisely, but try to plot something almost empty may be the reason...
– BambOo
Aug 8 at 10:39
I dont think this is the reason because the problem appeared with a huge figure ;-)
– Viv
Aug 8 at 11:05
add a comment |Â
up vote
2
down vote
up vote
2
down vote
If you do not need assume math mode=true
for this specific tikzpicture
, you can pass /pgf/number format/assume math mode=false
to the axis
environment options or to the tikzpicture
environment options to avoid the error.
If you do not need assume math mode=true
for this specific tikzpicture
, you can pass /pgf/number format/assume math mode=false
to the axis
environment options or to the tikzpicture
environment options to avoid the error.
answered Aug 8 at 10:32


BambOo
2,355323
2,355323
another good solution in deed ! But i fact i spent one our to understand that the problem was coming from the math mode, i dont really understrand why it behaves like that ...
– Viv
Aug 8 at 10:35
Maybe more advanded users as @marmot could answer that more precisely, but try to plot something almost empty may be the reason...
– BambOo
Aug 8 at 10:39
I dont think this is the reason because the problem appeared with a huge figure ;-)
– Viv
Aug 8 at 11:05
add a comment |Â
another good solution in deed ! But i fact i spent one our to understand that the problem was coming from the math mode, i dont really understrand why it behaves like that ...
– Viv
Aug 8 at 10:35
Maybe more advanded users as @marmot could answer that more precisely, but try to plot something almost empty may be the reason...
– BambOo
Aug 8 at 10:39
I dont think this is the reason because the problem appeared with a huge figure ;-)
– Viv
Aug 8 at 11:05
another good solution in deed ! But i fact i spent one our to understand that the problem was coming from the math mode, i dont really understrand why it behaves like that ...
– Viv
Aug 8 at 10:35
another good solution in deed ! But i fact i spent one our to understand that the problem was coming from the math mode, i dont really understrand why it behaves like that ...
– Viv
Aug 8 at 10:35
Maybe more advanded users as @marmot could answer that more precisely, but try to plot something almost empty may be the reason...
– BambOo
Aug 8 at 10:39
Maybe more advanded users as @marmot could answer that more precisely, but try to plot something almost empty may be the reason...
– BambOo
Aug 8 at 10:39
I dont think this is the reason because the problem appeared with a huge figure ;-)
– Viv
Aug 8 at 11:05
I dont think this is the reason because the problem appeared with a huge figure ;-)
– Viv
Aug 8 at 11:05
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f445118%2fylim-with-negative-floating-point-number%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Why do you need
assume math mode
?– BambOo
Aug 8 at 10:04
im using it elsewhere on my document ;-) maybe i can remove it and adapt the document, but this is not the point here :-(
– Viv
Aug 8 at 10:27
See my answer below
– BambOo
Aug 8 at 10:32
1
Adding
yticklabels=
to the axis options seems to remove the error. This seems related to the automatic computation of ticks or ticklabels in this situation.– BambOo
Aug 8 at 11:17