Draw Arrows outside of content-area of TikZ The 2019 Stack Overflow Developer Survey Results...
A poker game description that does not feel gimmicky
Can one be advised by a professor who is very far away?
What did it mean to "align" a radio?
Button changing it's text & action. Good or terrible?
Why hard-Brexiteers don't insist on a hard border to prevent illegal immigration after Brexit?
Which Sci-Fi work first showed weapon of galactic-scale mass destruction?
Did 3000BC Egyptians use meteoric iron weapons?
Are spiders unable to hurt humans, especially very small spiders?
Did Section 31 appear in Star Trek: The Next Generation?
When should I buy a clipper card after flying to OAK?
If I score a critical hit on an 18 or higher, what are my chances of getting a critical hit if I roll 3d20?
Is bread bad for ducks?
What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?
How to notate time signature switching consistently every measure
One word riddle: Vowel in the middle
How to support a colleague who finds meetings extremely tiring?
FPGA - DIY Programming
Apparent duplicates between Haynes service instructions and MOT
Landlord wants to switch my lease to a "Land contract" to "get back at the city"
What is the closest word meaning "respect for time / mindful"
Time travel alters history but people keep saying nothing's changed
What do hard-Brexiteers want with respect to the Irish border?
Should I use my personal e-mail address, or my workplace one, when registering to external websites for work purposes?
Delete all lines which don't have n characters before delimiter
Draw Arrows outside of content-area of TikZ
The 2019 Stack Overflow Developer Survey Results Are Inplotting two time series with boundsGrouped bar chartHow do i get the x axis on top but keep a line on the bottomHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?How to hide empty (value 0) ybars with pgfplots?Show mark labels near marks and not centered in ybar interaval graphpgfplots wrongly calculate pgfplots@data@xmin in the case of mixed plots (with and without error bar)pgfplots: percentage in matrix plotCenter the axes in the coordinate originpgfplots: modify axis after end axis / cut tikzpicture after drawing
I have a rather standard tikz plot. To clarify that low values on the y axis are actually faster/better I want to draw an additional arrow outside of the actually plotting area as shown in the attachment.
I found various ways of drawing using draw
but they all operate only within the content area of the plot - how can I draw outside of this area?
Here is a MWE of how I create my plot at the moment:
documentclass[11pt,a4paper]{article}
usepackage{pgfplots, pgfplotstable}
usepackage{tikz}
begin{document}
begin{figure}
begin{tikzpicture}[scale=0.75]
pgfplotsset{grid style={dashed,gray}}
begin{axis}[
xlabel={X},
ylabel=time,
xmin=0.8,
xmax=1.0,
ymin=1,
ymax=200,
xmajorgrids=true,
ymajorgrids=true,
]
addplot+[
black,
mark options={fill= black},
only marks,
mark size=2,
mark=square*,
]
coordinates {
(0.805, 10)
(0.85, 20)
};
end{axis}
end{tikzpicture}
end{figure}
end{document}
tikz-pgf pgfplots
add a comment |
I have a rather standard tikz plot. To clarify that low values on the y axis are actually faster/better I want to draw an additional arrow outside of the actually plotting area as shown in the attachment.
I found various ways of drawing using draw
but they all operate only within the content area of the plot - how can I draw outside of this area?
Here is a MWE of how I create my plot at the moment:
documentclass[11pt,a4paper]{article}
usepackage{pgfplots, pgfplotstable}
usepackage{tikz}
begin{document}
begin{figure}
begin{tikzpicture}[scale=0.75]
pgfplotsset{grid style={dashed,gray}}
begin{axis}[
xlabel={X},
ylabel=time,
xmin=0.8,
xmax=1.0,
ymin=1,
ymax=200,
xmajorgrids=true,
ymajorgrids=true,
]
addplot+[
black,
mark options={fill= black},
only marks,
mark size=2,
mark=square*,
]
coordinates {
(0.805, 10)
(0.85, 20)
};
end{axis}
end{tikzpicture}
end{figure}
end{document}
tikz-pgf pgfplots
2
Are you using pgfplots or is this drawn in plain tikz? Please provide a minimum working example with some data to create the plot.
– pschulz
Jan 27 '17 at 9:17
2
Standard TikZ plot, or standardpgfplots
plot? (I.e. anaxis
environment.) If the latter, addclip=false
to theaxis
options, or draw the arrow outside theaxis
environment. For that method, it might be useful to add e.g.name=myaxis
to theaxis
options, so you can access the anchors likemyaxis.outer north west
.
– Torbjørn T.
Jan 27 '17 at 9:17
I added a MWE of how I create the plot at the moment
– toobee
Jan 27 '17 at 9:51
2
@TorbjørnT. Alsoclip mode=individual
is very handy (I have it on by default in my templates). This will clip graphs but not the added things (node
s,path
s etc.)
– Rmano
Jan 27 '17 at 11:24
@Rmano Yes, I'm aware of that, but neglected to mention it in my comment..
– Torbjørn T.
Jan 27 '17 at 11:40
add a comment |
I have a rather standard tikz plot. To clarify that low values on the y axis are actually faster/better I want to draw an additional arrow outside of the actually plotting area as shown in the attachment.
I found various ways of drawing using draw
but they all operate only within the content area of the plot - how can I draw outside of this area?
Here is a MWE of how I create my plot at the moment:
documentclass[11pt,a4paper]{article}
usepackage{pgfplots, pgfplotstable}
usepackage{tikz}
begin{document}
begin{figure}
begin{tikzpicture}[scale=0.75]
pgfplotsset{grid style={dashed,gray}}
begin{axis}[
xlabel={X},
ylabel=time,
xmin=0.8,
xmax=1.0,
ymin=1,
ymax=200,
xmajorgrids=true,
ymajorgrids=true,
]
addplot+[
black,
mark options={fill= black},
only marks,
mark size=2,
mark=square*,
]
coordinates {
(0.805, 10)
(0.85, 20)
};
end{axis}
end{tikzpicture}
end{figure}
end{document}
tikz-pgf pgfplots
I have a rather standard tikz plot. To clarify that low values on the y axis are actually faster/better I want to draw an additional arrow outside of the actually plotting area as shown in the attachment.
I found various ways of drawing using draw
but they all operate only within the content area of the plot - how can I draw outside of this area?
Here is a MWE of how I create my plot at the moment:
documentclass[11pt,a4paper]{article}
usepackage{pgfplots, pgfplotstable}
usepackage{tikz}
begin{document}
begin{figure}
begin{tikzpicture}[scale=0.75]
pgfplotsset{grid style={dashed,gray}}
begin{axis}[
xlabel={X},
ylabel=time,
xmin=0.8,
xmax=1.0,
ymin=1,
ymax=200,
xmajorgrids=true,
ymajorgrids=true,
]
addplot+[
black,
mark options={fill= black},
only marks,
mark size=2,
mark=square*,
]
coordinates {
(0.805, 10)
(0.85, 20)
};
end{axis}
end{tikzpicture}
end{figure}
end{document}
tikz-pgf pgfplots
tikz-pgf pgfplots
edited Jan 27 '17 at 9:52
Torbjørn T.
158k13256445
158k13256445
asked Jan 27 '17 at 9:01
toobeetoobee
23726
23726
2
Are you using pgfplots or is this drawn in plain tikz? Please provide a minimum working example with some data to create the plot.
– pschulz
Jan 27 '17 at 9:17
2
Standard TikZ plot, or standardpgfplots
plot? (I.e. anaxis
environment.) If the latter, addclip=false
to theaxis
options, or draw the arrow outside theaxis
environment. For that method, it might be useful to add e.g.name=myaxis
to theaxis
options, so you can access the anchors likemyaxis.outer north west
.
– Torbjørn T.
Jan 27 '17 at 9:17
I added a MWE of how I create the plot at the moment
– toobee
Jan 27 '17 at 9:51
2
@TorbjørnT. Alsoclip mode=individual
is very handy (I have it on by default in my templates). This will clip graphs but not the added things (node
s,path
s etc.)
– Rmano
Jan 27 '17 at 11:24
@Rmano Yes, I'm aware of that, but neglected to mention it in my comment..
– Torbjørn T.
Jan 27 '17 at 11:40
add a comment |
2
Are you using pgfplots or is this drawn in plain tikz? Please provide a minimum working example with some data to create the plot.
– pschulz
Jan 27 '17 at 9:17
2
Standard TikZ plot, or standardpgfplots
plot? (I.e. anaxis
environment.) If the latter, addclip=false
to theaxis
options, or draw the arrow outside theaxis
environment. For that method, it might be useful to add e.g.name=myaxis
to theaxis
options, so you can access the anchors likemyaxis.outer north west
.
– Torbjørn T.
Jan 27 '17 at 9:17
I added a MWE of how I create the plot at the moment
– toobee
Jan 27 '17 at 9:51
2
@TorbjørnT. Alsoclip mode=individual
is very handy (I have it on by default in my templates). This will clip graphs but not the added things (node
s,path
s etc.)
– Rmano
Jan 27 '17 at 11:24
@Rmano Yes, I'm aware of that, but neglected to mention it in my comment..
– Torbjørn T.
Jan 27 '17 at 11:40
2
2
Are you using pgfplots or is this drawn in plain tikz? Please provide a minimum working example with some data to create the plot.
– pschulz
Jan 27 '17 at 9:17
Are you using pgfplots or is this drawn in plain tikz? Please provide a minimum working example with some data to create the plot.
– pschulz
Jan 27 '17 at 9:17
2
2
Standard TikZ plot, or standard
pgfplots
plot? (I.e. an axis
environment.) If the latter, add clip=false
to the axis
options, or draw the arrow outside the axis
environment. For that method, it might be useful to add e.g. name=myaxis
to the axis
options, so you can access the anchors like myaxis.outer north west
.– Torbjørn T.
Jan 27 '17 at 9:17
Standard TikZ plot, or standard
pgfplots
plot? (I.e. an axis
environment.) If the latter, add clip=false
to the axis
options, or draw the arrow outside the axis
environment. For that method, it might be useful to add e.g. name=myaxis
to the axis
options, so you can access the anchors like myaxis.outer north west
.– Torbjørn T.
Jan 27 '17 at 9:17
I added a MWE of how I create the plot at the moment
– toobee
Jan 27 '17 at 9:51
I added a MWE of how I create the plot at the moment
– toobee
Jan 27 '17 at 9:51
2
2
@TorbjørnT. Also
clip mode=individual
is very handy (I have it on by default in my templates). This will clip graphs but not the added things (node
s, path
s etc.)– Rmano
Jan 27 '17 at 11:24
@TorbjørnT. Also
clip mode=individual
is very handy (I have it on by default in my templates). This will clip graphs but not the added things (node
s, path
s etc.)– Rmano
Jan 27 '17 at 11:24
@Rmano Yes, I'm aware of that, but neglected to mention it in my comment..
– Torbjørn T.
Jan 27 '17 at 11:40
@Rmano Yes, I'm aware of that, but neglected to mention it in my comment..
– Torbjørn T.
Jan 27 '17 at 11:40
add a comment |
2 Answers
2
active
oldest
votes
We name
the axis
, so as to be able to access it outside the axis
environment.
Then, we draw a line between some key points of it.
The output
The code
documentclass[tikz]{standalone}
usepackage{pgfplots}
usetikzlibrary{arrows}
begin{document}
begin{tikzpicture}[scale=0.75, >=stealth']
pgfplotsset{grid style={dashed,gray}}
begin{axis}
[
name=myGraph,
xlabel={X},
ylabel=time,
xmin=0.8,
xmax=1.0,
ymin=1,
ymax=200,
xmajorgrids=true,
ymajorgrids=true,
]
addplot+
[
black,
mark options={fill= black},
only marks,
mark size=2,
mark=square*,
]
coordinates
{
(0.805, 10)
(0.85, 20)
};
end{axis}
defmyShift{-2cm}
draw [red, very thick, ->] ([xshift=myShift]myGraph.north west) -- ([xshift=myShift]myGraph.south west) node [midway, rotate=90, fill=white, yshift=2pt] {faster} ;
%draw [red, very thick, ->] (myGraph.left of north west) -- (myGraph.left of south west) node [midway, rotate=90, fill=white, yshift=2pt] {faster} ; % an alternative way
end{tikzpicture}
end{document}
Cheers,
1
I prefer your commented alternative solution, because this has the advantage that one doesn't have to adjust a "one time set"xshift
in case the (horizontal) size of anx label
or the size of theyticklabels
changes.
– Stefan Pinnow
Jan 27 '17 at 11:52
Thank you for the good advice. Should I edit the answer ?
– marsupilam
Jan 27 '17 at 12:09
That's up to you. It is your answer. Both solutions are valid and could be better depending on the situation. (Every solution has its pros and cons.) I (personally) just think that the commented answer is the one that more often would be "easier" compared to the non-commented one ;)
– Stefan Pinnow
Jan 27 '17 at 12:15
add a comment |
EDIT: Changed rel axis cs
to axis description cs
as suggested in the comments.
You can use the axis description cs
coordinate system for stuff like this:
documentclass{article}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}
[
grid style = {dashed, gray},
xlabel={X},
ylabel=time,
xmin=0.8,
xmax=1.0,
ymin=1,
ymax=200,
xmajorgrids=true,
ymajorgrids=true,
clip = false % <--- Important
]
addplot+
[
black,
mark options={fill= black},
only marks,
mark size=2,
mark=square*,
]
coordinates { (0.805, 10) (0.85, 20) };
% add annotation here:
draw[red, ->] ([xshift = -2cm] axis description cs:0, 1) -- node[left] { Faster } ([xshift = -2cm] axis description cs:0, 0);
end{axis}
end{tikzpicture}
end{document}
The point (axis description cs:0, 1)
is the upper left point, (axis description cs:0, 0)
is the lower left point. Both points are shifted by 2cm
(arbitrary, choose for your taste). Note that you have to turn off clipping in the axis
environment, otherwise all stuff drawn outside the axis will be not visible.
I always have the feeling, things like this can be solved better. In my opinion, you should always choose your units and things you want to show to reflect your point. In this case, maybe it would be possible to use the inverse of time (perhaps frequency) to plot the data? I don't know what you are showing, but keep in mind that it's better (in my opinion) to solve things not by clever technical/texnical tricks (adding a custom annotation) than by using the right visualization method.
Good point about frequency vs. (response ?) time. One could also add a title stating "lower time is faster".
– marsupilam
Jan 27 '17 at 10:20
1
I would prefer to useaxis description cs
instead ofrel axis cs
, because it is independent of axis reversals or skewed axes. To show what I mean, addx dir=reverse,
to theaxis
options and compare both results ...
– Stefan Pinnow
Jan 27 '17 at 12:22
Ah, interesting. I was always wondering about the difference of the two.
– pschulz
Jan 27 '17 at 15:55
1
You should also change the description below the figure ...
– Stefan Pinnow
Jan 27 '17 at 16:04
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%2f350692%2fdraw-arrows-outside-of-content-area-of-tikz%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
We name
the axis
, so as to be able to access it outside the axis
environment.
Then, we draw a line between some key points of it.
The output
The code
documentclass[tikz]{standalone}
usepackage{pgfplots}
usetikzlibrary{arrows}
begin{document}
begin{tikzpicture}[scale=0.75, >=stealth']
pgfplotsset{grid style={dashed,gray}}
begin{axis}
[
name=myGraph,
xlabel={X},
ylabel=time,
xmin=0.8,
xmax=1.0,
ymin=1,
ymax=200,
xmajorgrids=true,
ymajorgrids=true,
]
addplot+
[
black,
mark options={fill= black},
only marks,
mark size=2,
mark=square*,
]
coordinates
{
(0.805, 10)
(0.85, 20)
};
end{axis}
defmyShift{-2cm}
draw [red, very thick, ->] ([xshift=myShift]myGraph.north west) -- ([xshift=myShift]myGraph.south west) node [midway, rotate=90, fill=white, yshift=2pt] {faster} ;
%draw [red, very thick, ->] (myGraph.left of north west) -- (myGraph.left of south west) node [midway, rotate=90, fill=white, yshift=2pt] {faster} ; % an alternative way
end{tikzpicture}
end{document}
Cheers,
1
I prefer your commented alternative solution, because this has the advantage that one doesn't have to adjust a "one time set"xshift
in case the (horizontal) size of anx label
or the size of theyticklabels
changes.
– Stefan Pinnow
Jan 27 '17 at 11:52
Thank you for the good advice. Should I edit the answer ?
– marsupilam
Jan 27 '17 at 12:09
That's up to you. It is your answer. Both solutions are valid and could be better depending on the situation. (Every solution has its pros and cons.) I (personally) just think that the commented answer is the one that more often would be "easier" compared to the non-commented one ;)
– Stefan Pinnow
Jan 27 '17 at 12:15
add a comment |
We name
the axis
, so as to be able to access it outside the axis
environment.
Then, we draw a line between some key points of it.
The output
The code
documentclass[tikz]{standalone}
usepackage{pgfplots}
usetikzlibrary{arrows}
begin{document}
begin{tikzpicture}[scale=0.75, >=stealth']
pgfplotsset{grid style={dashed,gray}}
begin{axis}
[
name=myGraph,
xlabel={X},
ylabel=time,
xmin=0.8,
xmax=1.0,
ymin=1,
ymax=200,
xmajorgrids=true,
ymajorgrids=true,
]
addplot+
[
black,
mark options={fill= black},
only marks,
mark size=2,
mark=square*,
]
coordinates
{
(0.805, 10)
(0.85, 20)
};
end{axis}
defmyShift{-2cm}
draw [red, very thick, ->] ([xshift=myShift]myGraph.north west) -- ([xshift=myShift]myGraph.south west) node [midway, rotate=90, fill=white, yshift=2pt] {faster} ;
%draw [red, very thick, ->] (myGraph.left of north west) -- (myGraph.left of south west) node [midway, rotate=90, fill=white, yshift=2pt] {faster} ; % an alternative way
end{tikzpicture}
end{document}
Cheers,
1
I prefer your commented alternative solution, because this has the advantage that one doesn't have to adjust a "one time set"xshift
in case the (horizontal) size of anx label
or the size of theyticklabels
changes.
– Stefan Pinnow
Jan 27 '17 at 11:52
Thank you for the good advice. Should I edit the answer ?
– marsupilam
Jan 27 '17 at 12:09
That's up to you. It is your answer. Both solutions are valid and could be better depending on the situation. (Every solution has its pros and cons.) I (personally) just think that the commented answer is the one that more often would be "easier" compared to the non-commented one ;)
– Stefan Pinnow
Jan 27 '17 at 12:15
add a comment |
We name
the axis
, so as to be able to access it outside the axis
environment.
Then, we draw a line between some key points of it.
The output
The code
documentclass[tikz]{standalone}
usepackage{pgfplots}
usetikzlibrary{arrows}
begin{document}
begin{tikzpicture}[scale=0.75, >=stealth']
pgfplotsset{grid style={dashed,gray}}
begin{axis}
[
name=myGraph,
xlabel={X},
ylabel=time,
xmin=0.8,
xmax=1.0,
ymin=1,
ymax=200,
xmajorgrids=true,
ymajorgrids=true,
]
addplot+
[
black,
mark options={fill= black},
only marks,
mark size=2,
mark=square*,
]
coordinates
{
(0.805, 10)
(0.85, 20)
};
end{axis}
defmyShift{-2cm}
draw [red, very thick, ->] ([xshift=myShift]myGraph.north west) -- ([xshift=myShift]myGraph.south west) node [midway, rotate=90, fill=white, yshift=2pt] {faster} ;
%draw [red, very thick, ->] (myGraph.left of north west) -- (myGraph.left of south west) node [midway, rotate=90, fill=white, yshift=2pt] {faster} ; % an alternative way
end{tikzpicture}
end{document}
Cheers,
We name
the axis
, so as to be able to access it outside the axis
environment.
Then, we draw a line between some key points of it.
The output
The code
documentclass[tikz]{standalone}
usepackage{pgfplots}
usetikzlibrary{arrows}
begin{document}
begin{tikzpicture}[scale=0.75, >=stealth']
pgfplotsset{grid style={dashed,gray}}
begin{axis}
[
name=myGraph,
xlabel={X},
ylabel=time,
xmin=0.8,
xmax=1.0,
ymin=1,
ymax=200,
xmajorgrids=true,
ymajorgrids=true,
]
addplot+
[
black,
mark options={fill= black},
only marks,
mark size=2,
mark=square*,
]
coordinates
{
(0.805, 10)
(0.85, 20)
};
end{axis}
defmyShift{-2cm}
draw [red, very thick, ->] ([xshift=myShift]myGraph.north west) -- ([xshift=myShift]myGraph.south west) node [midway, rotate=90, fill=white, yshift=2pt] {faster} ;
%draw [red, very thick, ->] (myGraph.left of north west) -- (myGraph.left of south west) node [midway, rotate=90, fill=white, yshift=2pt] {faster} ; % an alternative way
end{tikzpicture}
end{document}
Cheers,
answered Jan 27 '17 at 10:09
marsupilammarsupilam
5,7161935
5,7161935
1
I prefer your commented alternative solution, because this has the advantage that one doesn't have to adjust a "one time set"xshift
in case the (horizontal) size of anx label
or the size of theyticklabels
changes.
– Stefan Pinnow
Jan 27 '17 at 11:52
Thank you for the good advice. Should I edit the answer ?
– marsupilam
Jan 27 '17 at 12:09
That's up to you. It is your answer. Both solutions are valid and could be better depending on the situation. (Every solution has its pros and cons.) I (personally) just think that the commented answer is the one that more often would be "easier" compared to the non-commented one ;)
– Stefan Pinnow
Jan 27 '17 at 12:15
add a comment |
1
I prefer your commented alternative solution, because this has the advantage that one doesn't have to adjust a "one time set"xshift
in case the (horizontal) size of anx label
or the size of theyticklabels
changes.
– Stefan Pinnow
Jan 27 '17 at 11:52
Thank you for the good advice. Should I edit the answer ?
– marsupilam
Jan 27 '17 at 12:09
That's up to you. It is your answer. Both solutions are valid and could be better depending on the situation. (Every solution has its pros and cons.) I (personally) just think that the commented answer is the one that more often would be "easier" compared to the non-commented one ;)
– Stefan Pinnow
Jan 27 '17 at 12:15
1
1
I prefer your commented alternative solution, because this has the advantage that one doesn't have to adjust a "one time set"
xshift
in case the (horizontal) size of an x label
or the size of the yticklabels
changes.– Stefan Pinnow
Jan 27 '17 at 11:52
I prefer your commented alternative solution, because this has the advantage that one doesn't have to adjust a "one time set"
xshift
in case the (horizontal) size of an x label
or the size of the yticklabels
changes.– Stefan Pinnow
Jan 27 '17 at 11:52
Thank you for the good advice. Should I edit the answer ?
– marsupilam
Jan 27 '17 at 12:09
Thank you for the good advice. Should I edit the answer ?
– marsupilam
Jan 27 '17 at 12:09
That's up to you. It is your answer. Both solutions are valid and could be better depending on the situation. (Every solution has its pros and cons.) I (personally) just think that the commented answer is the one that more often would be "easier" compared to the non-commented one ;)
– Stefan Pinnow
Jan 27 '17 at 12:15
That's up to you. It is your answer. Both solutions are valid and could be better depending on the situation. (Every solution has its pros and cons.) I (personally) just think that the commented answer is the one that more often would be "easier" compared to the non-commented one ;)
– Stefan Pinnow
Jan 27 '17 at 12:15
add a comment |
EDIT: Changed rel axis cs
to axis description cs
as suggested in the comments.
You can use the axis description cs
coordinate system for stuff like this:
documentclass{article}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}
[
grid style = {dashed, gray},
xlabel={X},
ylabel=time,
xmin=0.8,
xmax=1.0,
ymin=1,
ymax=200,
xmajorgrids=true,
ymajorgrids=true,
clip = false % <--- Important
]
addplot+
[
black,
mark options={fill= black},
only marks,
mark size=2,
mark=square*,
]
coordinates { (0.805, 10) (0.85, 20) };
% add annotation here:
draw[red, ->] ([xshift = -2cm] axis description cs:0, 1) -- node[left] { Faster } ([xshift = -2cm] axis description cs:0, 0);
end{axis}
end{tikzpicture}
end{document}
The point (axis description cs:0, 1)
is the upper left point, (axis description cs:0, 0)
is the lower left point. Both points are shifted by 2cm
(arbitrary, choose for your taste). Note that you have to turn off clipping in the axis
environment, otherwise all stuff drawn outside the axis will be not visible.
I always have the feeling, things like this can be solved better. In my opinion, you should always choose your units and things you want to show to reflect your point. In this case, maybe it would be possible to use the inverse of time (perhaps frequency) to plot the data? I don't know what you are showing, but keep in mind that it's better (in my opinion) to solve things not by clever technical/texnical tricks (adding a custom annotation) than by using the right visualization method.
Good point about frequency vs. (response ?) time. One could also add a title stating "lower time is faster".
– marsupilam
Jan 27 '17 at 10:20
1
I would prefer to useaxis description cs
instead ofrel axis cs
, because it is independent of axis reversals or skewed axes. To show what I mean, addx dir=reverse,
to theaxis
options and compare both results ...
– Stefan Pinnow
Jan 27 '17 at 12:22
Ah, interesting. I was always wondering about the difference of the two.
– pschulz
Jan 27 '17 at 15:55
1
You should also change the description below the figure ...
– Stefan Pinnow
Jan 27 '17 at 16:04
add a comment |
EDIT: Changed rel axis cs
to axis description cs
as suggested in the comments.
You can use the axis description cs
coordinate system for stuff like this:
documentclass{article}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}
[
grid style = {dashed, gray},
xlabel={X},
ylabel=time,
xmin=0.8,
xmax=1.0,
ymin=1,
ymax=200,
xmajorgrids=true,
ymajorgrids=true,
clip = false % <--- Important
]
addplot+
[
black,
mark options={fill= black},
only marks,
mark size=2,
mark=square*,
]
coordinates { (0.805, 10) (0.85, 20) };
% add annotation here:
draw[red, ->] ([xshift = -2cm] axis description cs:0, 1) -- node[left] { Faster } ([xshift = -2cm] axis description cs:0, 0);
end{axis}
end{tikzpicture}
end{document}
The point (axis description cs:0, 1)
is the upper left point, (axis description cs:0, 0)
is the lower left point. Both points are shifted by 2cm
(arbitrary, choose for your taste). Note that you have to turn off clipping in the axis
environment, otherwise all stuff drawn outside the axis will be not visible.
I always have the feeling, things like this can be solved better. In my opinion, you should always choose your units and things you want to show to reflect your point. In this case, maybe it would be possible to use the inverse of time (perhaps frequency) to plot the data? I don't know what you are showing, but keep in mind that it's better (in my opinion) to solve things not by clever technical/texnical tricks (adding a custom annotation) than by using the right visualization method.
Good point about frequency vs. (response ?) time. One could also add a title stating "lower time is faster".
– marsupilam
Jan 27 '17 at 10:20
1
I would prefer to useaxis description cs
instead ofrel axis cs
, because it is independent of axis reversals or skewed axes. To show what I mean, addx dir=reverse,
to theaxis
options and compare both results ...
– Stefan Pinnow
Jan 27 '17 at 12:22
Ah, interesting. I was always wondering about the difference of the two.
– pschulz
Jan 27 '17 at 15:55
1
You should also change the description below the figure ...
– Stefan Pinnow
Jan 27 '17 at 16:04
add a comment |
EDIT: Changed rel axis cs
to axis description cs
as suggested in the comments.
You can use the axis description cs
coordinate system for stuff like this:
documentclass{article}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}
[
grid style = {dashed, gray},
xlabel={X},
ylabel=time,
xmin=0.8,
xmax=1.0,
ymin=1,
ymax=200,
xmajorgrids=true,
ymajorgrids=true,
clip = false % <--- Important
]
addplot+
[
black,
mark options={fill= black},
only marks,
mark size=2,
mark=square*,
]
coordinates { (0.805, 10) (0.85, 20) };
% add annotation here:
draw[red, ->] ([xshift = -2cm] axis description cs:0, 1) -- node[left] { Faster } ([xshift = -2cm] axis description cs:0, 0);
end{axis}
end{tikzpicture}
end{document}
The point (axis description cs:0, 1)
is the upper left point, (axis description cs:0, 0)
is the lower left point. Both points are shifted by 2cm
(arbitrary, choose for your taste). Note that you have to turn off clipping in the axis
environment, otherwise all stuff drawn outside the axis will be not visible.
I always have the feeling, things like this can be solved better. In my opinion, you should always choose your units and things you want to show to reflect your point. In this case, maybe it would be possible to use the inverse of time (perhaps frequency) to plot the data? I don't know what you are showing, but keep in mind that it's better (in my opinion) to solve things not by clever technical/texnical tricks (adding a custom annotation) than by using the right visualization method.
EDIT: Changed rel axis cs
to axis description cs
as suggested in the comments.
You can use the axis description cs
coordinate system for stuff like this:
documentclass{article}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}
[
grid style = {dashed, gray},
xlabel={X},
ylabel=time,
xmin=0.8,
xmax=1.0,
ymin=1,
ymax=200,
xmajorgrids=true,
ymajorgrids=true,
clip = false % <--- Important
]
addplot+
[
black,
mark options={fill= black},
only marks,
mark size=2,
mark=square*,
]
coordinates { (0.805, 10) (0.85, 20) };
% add annotation here:
draw[red, ->] ([xshift = -2cm] axis description cs:0, 1) -- node[left] { Faster } ([xshift = -2cm] axis description cs:0, 0);
end{axis}
end{tikzpicture}
end{document}
The point (axis description cs:0, 1)
is the upper left point, (axis description cs:0, 0)
is the lower left point. Both points are shifted by 2cm
(arbitrary, choose for your taste). Note that you have to turn off clipping in the axis
environment, otherwise all stuff drawn outside the axis will be not visible.
I always have the feeling, things like this can be solved better. In my opinion, you should always choose your units and things you want to show to reflect your point. In this case, maybe it would be possible to use the inverse of time (perhaps frequency) to plot the data? I don't know what you are showing, but keep in mind that it's better (in my opinion) to solve things not by clever technical/texnical tricks (adding a custom annotation) than by using the right visualization method.
edited 11 mins ago
answered Jan 27 '17 at 10:08
pschulzpschulz
980718
980718
Good point about frequency vs. (response ?) time. One could also add a title stating "lower time is faster".
– marsupilam
Jan 27 '17 at 10:20
1
I would prefer to useaxis description cs
instead ofrel axis cs
, because it is independent of axis reversals or skewed axes. To show what I mean, addx dir=reverse,
to theaxis
options and compare both results ...
– Stefan Pinnow
Jan 27 '17 at 12:22
Ah, interesting. I was always wondering about the difference of the two.
– pschulz
Jan 27 '17 at 15:55
1
You should also change the description below the figure ...
– Stefan Pinnow
Jan 27 '17 at 16:04
add a comment |
Good point about frequency vs. (response ?) time. One could also add a title stating "lower time is faster".
– marsupilam
Jan 27 '17 at 10:20
1
I would prefer to useaxis description cs
instead ofrel axis cs
, because it is independent of axis reversals or skewed axes. To show what I mean, addx dir=reverse,
to theaxis
options and compare both results ...
– Stefan Pinnow
Jan 27 '17 at 12:22
Ah, interesting. I was always wondering about the difference of the two.
– pschulz
Jan 27 '17 at 15:55
1
You should also change the description below the figure ...
– Stefan Pinnow
Jan 27 '17 at 16:04
Good point about frequency vs. (response ?) time. One could also add a title stating "lower time is faster".
– marsupilam
Jan 27 '17 at 10:20
Good point about frequency vs. (response ?) time. One could also add a title stating "lower time is faster".
– marsupilam
Jan 27 '17 at 10:20
1
1
I would prefer to use
axis description cs
instead of rel axis cs
, because it is independent of axis reversals or skewed axes. To show what I mean, add x dir=reverse,
to the axis
options and compare both results ...– Stefan Pinnow
Jan 27 '17 at 12:22
I would prefer to use
axis description cs
instead of rel axis cs
, because it is independent of axis reversals or skewed axes. To show what I mean, add x dir=reverse,
to the axis
options and compare both results ...– Stefan Pinnow
Jan 27 '17 at 12:22
Ah, interesting. I was always wondering about the difference of the two.
– pschulz
Jan 27 '17 at 15:55
Ah, interesting. I was always wondering about the difference of the two.
– pschulz
Jan 27 '17 at 15:55
1
1
You should also change the description below the figure ...
– Stefan Pinnow
Jan 27 '17 at 16:04
You should also change the description below the figure ...
– Stefan Pinnow
Jan 27 '17 at 16:04
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%2f350692%2fdraw-arrows-outside-of-content-area-of-tikz%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
2
Are you using pgfplots or is this drawn in plain tikz? Please provide a minimum working example with some data to create the plot.
– pschulz
Jan 27 '17 at 9:17
2
Standard TikZ plot, or standard
pgfplots
plot? (I.e. anaxis
environment.) If the latter, addclip=false
to theaxis
options, or draw the arrow outside theaxis
environment. For that method, it might be useful to add e.g.name=myaxis
to theaxis
options, so you can access the anchors likemyaxis.outer north west
.– Torbjørn T.
Jan 27 '17 at 9:17
I added a MWE of how I create the plot at the moment
– toobee
Jan 27 '17 at 9:51
2
@TorbjørnT. Also
clip mode=individual
is very handy (I have it on by default in my templates). This will clip graphs but not the added things (node
s,path
s etc.)– Rmano
Jan 27 '17 at 11:24
@Rmano Yes, I'm aware of that, but neglected to mention it in my comment..
– Torbjørn T.
Jan 27 '17 at 11:40