pfg axis discontinuity options
is there a way to set the length of the discontinuity in the x axis?
Here is the code I have used:
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
begin{tikzpicture}
begin{axis}[
thick,
black,%Set the color of the main axes and numbers
scale=0.389,
axis lines=left,
xmin=200,
xmax=350,
ymin=0,
ymax=3,
major tick length=1.5pt,
minor tick length=1pt,
tick align = inside,
axis x discontinuity=crunch,
legend cell align={left},
legend style={anchor=north, draw=none},
label style={font=tiny},
tick label style={font=tiny},
]
end{axis}
end{tikzpicture}
end{document}
The figure comes out like, with the discontinuity marker that occupies almost one unit.
I would like to have a shorter discontinuity marker, like the one in the picture below.
Thanks for the help!
tikz-pgf pgfplots axis
add a comment |
is there a way to set the length of the discontinuity in the x axis?
Here is the code I have used:
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
begin{tikzpicture}
begin{axis}[
thick,
black,%Set the color of the main axes and numbers
scale=0.389,
axis lines=left,
xmin=200,
xmax=350,
ymin=0,
ymax=3,
major tick length=1.5pt,
minor tick length=1pt,
tick align = inside,
axis x discontinuity=crunch,
legend cell align={left},
legend style={anchor=north, draw=none},
label style={font=tiny},
tick label style={font=tiny},
]
end{axis}
end{tikzpicture}
end{document}
The figure comes out like, with the discontinuity marker that occupies almost one unit.
I would like to have a shorter discontinuity marker, like the one in the picture below.
Thanks for the help!
tikz-pgf pgfplots axis
Please provide us with a minimal example such that others don't have to reinvent one.
– marmot
Feb 22 at 15:03
add a comment |
is there a way to set the length of the discontinuity in the x axis?
Here is the code I have used:
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
begin{tikzpicture}
begin{axis}[
thick,
black,%Set the color of the main axes and numbers
scale=0.389,
axis lines=left,
xmin=200,
xmax=350,
ymin=0,
ymax=3,
major tick length=1.5pt,
minor tick length=1pt,
tick align = inside,
axis x discontinuity=crunch,
legend cell align={left},
legend style={anchor=north, draw=none},
label style={font=tiny},
tick label style={font=tiny},
]
end{axis}
end{tikzpicture}
end{document}
The figure comes out like, with the discontinuity marker that occupies almost one unit.
I would like to have a shorter discontinuity marker, like the one in the picture below.
Thanks for the help!
tikz-pgf pgfplots axis
is there a way to set the length of the discontinuity in the x axis?
Here is the code I have used:
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
begin{tikzpicture}
begin{axis}[
thick,
black,%Set the color of the main axes and numbers
scale=0.389,
axis lines=left,
xmin=200,
xmax=350,
ymin=0,
ymax=3,
major tick length=1.5pt,
minor tick length=1pt,
tick align = inside,
axis x discontinuity=crunch,
legend cell align={left},
legend style={anchor=north, draw=none},
label style={font=tiny},
tick label style={font=tiny},
]
end{axis}
end{tikzpicture}
end{document}
The figure comes out like, with the discontinuity marker that occupies almost one unit.
I would like to have a shorter discontinuity marker, like the one in the picture below.
Thanks for the help!
tikz-pgf pgfplots axis
tikz-pgf pgfplots axis
edited Feb 22 at 15:41
sorciotto
asked Feb 22 at 14:52
sorciottosorciotto
726
726
Please provide us with a minimal example such that others don't have to reinvent one.
– marmot
Feb 22 at 15:03
add a comment |
Please provide us with a minimal example such that others don't have to reinvent one.
– marmot
Feb 22 at 15:03
Please provide us with a minimal example such that others don't have to reinvent one.
– marmot
Feb 22 at 15:03
Please provide us with a minimal example such that others don't have to reinvent one.
– marmot
Feb 22 at 15:03
add a comment |
1 Answer
1
active
oldest
votes
This is a possible solution. Whether there is a better solution, I do not know. In
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
makeatletter
defpgfplots@drawaxis@lines@preparediscont@for#1{%
ifnumcsname pgfplots@#1axisdiscontnumendcsname>0
begingroup
% this group employs several temporary dimension registers
% and is therefor scoped:
letdisstart=pgf@ya
letdisend=pgf@yb
disend=csname pgfplots@#1max@regendcsname
advancedisend by -csname pgfplots@#1min@regendcsname
disend=csname pgfplots@#1@veclengthendcsnamedisend
ifcasecsname pgfplots@#1axisdiscontnumendcsnamerelax
% has already been checked above.
or
defdiscontstyle{decoration={zigzag,segment length=8pt, amplitude=3pt}}%
advance disend by -12pt
or
defdiscontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}%
advance disend by -8pt
fi
pgfplotscoordmath{#1}{datascaletrafo get params}%
% if #1max + shift < 0pt (shift is 0 without the scaling trafo)
ifdimcsname pgfplots@#1max@regendcsname<-pgfplotsretvalb pt
% swap start and end
disstart=disend
disend=4pt
else
disstart=4pt
fi
% carry local computations outside of group:
xdefpgfplots@glob@TMPa{%
noexpanddefexpandafternoexpandcsname #1disstartendcsname{thedisstart}%
noexpanddefexpandafternoexpandcsname #1disendendcsname{thedisend}%
noexpandpgfkeysdef{/tikz/#1discont}{noexpandpgfkeysalso{discontstyle}}%
}%
endgroup
pgfplots@glob@TMPa
else
expandafterdefcsname #1disstartendcsname{0pt}%
expandafterdefcsname #1disendendcsname{0pt}%
pgfkeyslet{/tikz/#1discont}=pgfutil@empty
fi
}%
makeatother
begin{document}
begin{tikzpicture}
begin{axis}[
thick,
black,%Set the color of the main axes and numbers
scale=0.389,
axis lines=left,
xmin=200,
xmax=350,
ymin=0,
ymax=3,
major tick length=1.5pt,
minor tick length=1pt,
tick align = inside,
axis x discontinuity=crunch,
legend cell align={left},
legend style={anchor=north, draw=none},
label style={font=tiny},
tick label style={font=tiny},
]
end{axis}
end{tikzpicture}
end{document}
I changed
defdiscontstyle{decoration={zigzag,segment length=8pt, amplitude=3pt}}%
advance disend by -12pt
which was originally in pgfplots.code.tex
defdiscontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}%
advance disend by -16pt
to get
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f476178%2fpfg-axis-discontinuity-options%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is a possible solution. Whether there is a better solution, I do not know. In
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
makeatletter
defpgfplots@drawaxis@lines@preparediscont@for#1{%
ifnumcsname pgfplots@#1axisdiscontnumendcsname>0
begingroup
% this group employs several temporary dimension registers
% and is therefor scoped:
letdisstart=pgf@ya
letdisend=pgf@yb
disend=csname pgfplots@#1max@regendcsname
advancedisend by -csname pgfplots@#1min@regendcsname
disend=csname pgfplots@#1@veclengthendcsnamedisend
ifcasecsname pgfplots@#1axisdiscontnumendcsnamerelax
% has already been checked above.
or
defdiscontstyle{decoration={zigzag,segment length=8pt, amplitude=3pt}}%
advance disend by -12pt
or
defdiscontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}%
advance disend by -8pt
fi
pgfplotscoordmath{#1}{datascaletrafo get params}%
% if #1max + shift < 0pt (shift is 0 without the scaling trafo)
ifdimcsname pgfplots@#1max@regendcsname<-pgfplotsretvalb pt
% swap start and end
disstart=disend
disend=4pt
else
disstart=4pt
fi
% carry local computations outside of group:
xdefpgfplots@glob@TMPa{%
noexpanddefexpandafternoexpandcsname #1disstartendcsname{thedisstart}%
noexpanddefexpandafternoexpandcsname #1disendendcsname{thedisend}%
noexpandpgfkeysdef{/tikz/#1discont}{noexpandpgfkeysalso{discontstyle}}%
}%
endgroup
pgfplots@glob@TMPa
else
expandafterdefcsname #1disstartendcsname{0pt}%
expandafterdefcsname #1disendendcsname{0pt}%
pgfkeyslet{/tikz/#1discont}=pgfutil@empty
fi
}%
makeatother
begin{document}
begin{tikzpicture}
begin{axis}[
thick,
black,%Set the color of the main axes and numbers
scale=0.389,
axis lines=left,
xmin=200,
xmax=350,
ymin=0,
ymax=3,
major tick length=1.5pt,
minor tick length=1pt,
tick align = inside,
axis x discontinuity=crunch,
legend cell align={left},
legend style={anchor=north, draw=none},
label style={font=tiny},
tick label style={font=tiny},
]
end{axis}
end{tikzpicture}
end{document}
I changed
defdiscontstyle{decoration={zigzag,segment length=8pt, amplitude=3pt}}%
advance disend by -12pt
which was originally in pgfplots.code.tex
defdiscontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}%
advance disend by -16pt
to get
add a comment |
This is a possible solution. Whether there is a better solution, I do not know. In
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
makeatletter
defpgfplots@drawaxis@lines@preparediscont@for#1{%
ifnumcsname pgfplots@#1axisdiscontnumendcsname>0
begingroup
% this group employs several temporary dimension registers
% and is therefor scoped:
letdisstart=pgf@ya
letdisend=pgf@yb
disend=csname pgfplots@#1max@regendcsname
advancedisend by -csname pgfplots@#1min@regendcsname
disend=csname pgfplots@#1@veclengthendcsnamedisend
ifcasecsname pgfplots@#1axisdiscontnumendcsnamerelax
% has already been checked above.
or
defdiscontstyle{decoration={zigzag,segment length=8pt, amplitude=3pt}}%
advance disend by -12pt
or
defdiscontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}%
advance disend by -8pt
fi
pgfplotscoordmath{#1}{datascaletrafo get params}%
% if #1max + shift < 0pt (shift is 0 without the scaling trafo)
ifdimcsname pgfplots@#1max@regendcsname<-pgfplotsretvalb pt
% swap start and end
disstart=disend
disend=4pt
else
disstart=4pt
fi
% carry local computations outside of group:
xdefpgfplots@glob@TMPa{%
noexpanddefexpandafternoexpandcsname #1disstartendcsname{thedisstart}%
noexpanddefexpandafternoexpandcsname #1disendendcsname{thedisend}%
noexpandpgfkeysdef{/tikz/#1discont}{noexpandpgfkeysalso{discontstyle}}%
}%
endgroup
pgfplots@glob@TMPa
else
expandafterdefcsname #1disstartendcsname{0pt}%
expandafterdefcsname #1disendendcsname{0pt}%
pgfkeyslet{/tikz/#1discont}=pgfutil@empty
fi
}%
makeatother
begin{document}
begin{tikzpicture}
begin{axis}[
thick,
black,%Set the color of the main axes and numbers
scale=0.389,
axis lines=left,
xmin=200,
xmax=350,
ymin=0,
ymax=3,
major tick length=1.5pt,
minor tick length=1pt,
tick align = inside,
axis x discontinuity=crunch,
legend cell align={left},
legend style={anchor=north, draw=none},
label style={font=tiny},
tick label style={font=tiny},
]
end{axis}
end{tikzpicture}
end{document}
I changed
defdiscontstyle{decoration={zigzag,segment length=8pt, amplitude=3pt}}%
advance disend by -12pt
which was originally in pgfplots.code.tex
defdiscontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}%
advance disend by -16pt
to get
add a comment |
This is a possible solution. Whether there is a better solution, I do not know. In
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
makeatletter
defpgfplots@drawaxis@lines@preparediscont@for#1{%
ifnumcsname pgfplots@#1axisdiscontnumendcsname>0
begingroup
% this group employs several temporary dimension registers
% and is therefor scoped:
letdisstart=pgf@ya
letdisend=pgf@yb
disend=csname pgfplots@#1max@regendcsname
advancedisend by -csname pgfplots@#1min@regendcsname
disend=csname pgfplots@#1@veclengthendcsnamedisend
ifcasecsname pgfplots@#1axisdiscontnumendcsnamerelax
% has already been checked above.
or
defdiscontstyle{decoration={zigzag,segment length=8pt, amplitude=3pt}}%
advance disend by -12pt
or
defdiscontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}%
advance disend by -8pt
fi
pgfplotscoordmath{#1}{datascaletrafo get params}%
% if #1max + shift < 0pt (shift is 0 without the scaling trafo)
ifdimcsname pgfplots@#1max@regendcsname<-pgfplotsretvalb pt
% swap start and end
disstart=disend
disend=4pt
else
disstart=4pt
fi
% carry local computations outside of group:
xdefpgfplots@glob@TMPa{%
noexpanddefexpandafternoexpandcsname #1disstartendcsname{thedisstart}%
noexpanddefexpandafternoexpandcsname #1disendendcsname{thedisend}%
noexpandpgfkeysdef{/tikz/#1discont}{noexpandpgfkeysalso{discontstyle}}%
}%
endgroup
pgfplots@glob@TMPa
else
expandafterdefcsname #1disstartendcsname{0pt}%
expandafterdefcsname #1disendendcsname{0pt}%
pgfkeyslet{/tikz/#1discont}=pgfutil@empty
fi
}%
makeatother
begin{document}
begin{tikzpicture}
begin{axis}[
thick,
black,%Set the color of the main axes and numbers
scale=0.389,
axis lines=left,
xmin=200,
xmax=350,
ymin=0,
ymax=3,
major tick length=1.5pt,
minor tick length=1pt,
tick align = inside,
axis x discontinuity=crunch,
legend cell align={left},
legend style={anchor=north, draw=none},
label style={font=tiny},
tick label style={font=tiny},
]
end{axis}
end{tikzpicture}
end{document}
I changed
defdiscontstyle{decoration={zigzag,segment length=8pt, amplitude=3pt}}%
advance disend by -12pt
which was originally in pgfplots.code.tex
defdiscontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}%
advance disend by -16pt
to get
This is a possible solution. Whether there is a better solution, I do not know. In
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
makeatletter
defpgfplots@drawaxis@lines@preparediscont@for#1{%
ifnumcsname pgfplots@#1axisdiscontnumendcsname>0
begingroup
% this group employs several temporary dimension registers
% and is therefor scoped:
letdisstart=pgf@ya
letdisend=pgf@yb
disend=csname pgfplots@#1max@regendcsname
advancedisend by -csname pgfplots@#1min@regendcsname
disend=csname pgfplots@#1@veclengthendcsnamedisend
ifcasecsname pgfplots@#1axisdiscontnumendcsnamerelax
% has already been checked above.
or
defdiscontstyle{decoration={zigzag,segment length=8pt, amplitude=3pt}}%
advance disend by -12pt
or
defdiscontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}%
advance disend by -8pt
fi
pgfplotscoordmath{#1}{datascaletrafo get params}%
% if #1max + shift < 0pt (shift is 0 without the scaling trafo)
ifdimcsname pgfplots@#1max@regendcsname<-pgfplotsretvalb pt
% swap start and end
disstart=disend
disend=4pt
else
disstart=4pt
fi
% carry local computations outside of group:
xdefpgfplots@glob@TMPa{%
noexpanddefexpandafternoexpandcsname #1disstartendcsname{thedisstart}%
noexpanddefexpandafternoexpandcsname #1disendendcsname{thedisend}%
noexpandpgfkeysdef{/tikz/#1discont}{noexpandpgfkeysalso{discontstyle}}%
}%
endgroup
pgfplots@glob@TMPa
else
expandafterdefcsname #1disstartendcsname{0pt}%
expandafterdefcsname #1disendendcsname{0pt}%
pgfkeyslet{/tikz/#1discont}=pgfutil@empty
fi
}%
makeatother
begin{document}
begin{tikzpicture}
begin{axis}[
thick,
black,%Set the color of the main axes and numbers
scale=0.389,
axis lines=left,
xmin=200,
xmax=350,
ymin=0,
ymax=3,
major tick length=1.5pt,
minor tick length=1pt,
tick align = inside,
axis x discontinuity=crunch,
legend cell align={left},
legend style={anchor=north, draw=none},
label style={font=tiny},
tick label style={font=tiny},
]
end{axis}
end{tikzpicture}
end{document}
I changed
defdiscontstyle{decoration={zigzag,segment length=8pt, amplitude=3pt}}%
advance disend by -12pt
which was originally in pgfplots.code.tex
defdiscontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}%
advance disend by -16pt
to get
answered Feb 22 at 15:43
marmotmarmot
105k4125237
105k4125237
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f476178%2fpfg-axis-discontinuity-options%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please provide us with a minimal example such that others don't have to reinvent one.
– marmot
Feb 22 at 15:03