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
Are there incongruent pythagorean triangles with the same perimeter and same area?
Feature engineering suggestion required
Is there a symbol for a right arrow with a square in the middle?
Did 3000BC Egyptians use meteoric iron weapons?
For what reasons would an animal species NOT cross a *horizontal* land bridge?
Are there any other methods to apply to solving simultaneous equations?
What do hard-Brexiteers want with respect to the Irish border?
FPGA - DIY Programming
What tool would a Roman-age civilization have for the breaking of silver and other metals into dust?
Why hard-Brexiteers don't insist on a hard border to prevent illegal immigration after Brexit?
How come people say “Would of”?
Apparent duplicates between Haynes service instructions and MOT
What is the meaning of Triage in Cybersec world?
Why can Shazam fly?
Looking for Correct Greek Translation for Heraclitus
Does coating your armor in silver add any effects?
Is flight data recorder erased after every flight?
How are circuits which use complex ICs normally simulated?
Deal with toxic manager when you can't quit
If I score a critical hit on an 18 or higher, what are my chances of getting a critical hit if I roll 3d20?
Does a dangling wire really electrocute me if I'm standing in water?
How to answer pointed "are you quitting" questioning when I don't want them to suspect
Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?
What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?
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
usepackagepgfplots, pgfplotstable
usepackagetikz
begindocument
beginfigure
begintikzpicture[scale=0.75]
pgfplotssetgrid style=dashed,gray
beginaxis[
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)
;
endaxis
endtikzpicture
endfigure
enddocument

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
usepackagepgfplots, pgfplotstable
usepackagetikz
begindocument
beginfigure
begintikzpicture[scale=0.75]
pgfplotssetgrid style=dashed,gray
beginaxis[
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)
;
endaxis
endtikzpicture
endfigure
enddocument

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 standardpgfplotsplot? (I.e. anaxisenvironment.) If the latter, addclip=falseto theaxisoptions, or draw the arrow outside theaxisenvironment. For that method, it might be useful to add e.g.name=myaxisto theaxisoptions, 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=individualis very handy (I have it on by default in my templates). This will clip graphs but not the added things (nodes,paths 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
usepackagepgfplots, pgfplotstable
usepackagetikz
begindocument
beginfigure
begintikzpicture[scale=0.75]
pgfplotssetgrid style=dashed,gray
beginaxis[
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)
;
endaxis
endtikzpicture
endfigure
enddocument

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
usepackagepgfplots, pgfplotstable
usepackagetikz
begindocument
beginfigure
begintikzpicture[scale=0.75]
pgfplotssetgrid style=dashed,gray
beginaxis[
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)
;
endaxis
endtikzpicture
endfigure
enddocument

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 standardpgfplotsplot? (I.e. anaxisenvironment.) If the latter, addclip=falseto theaxisoptions, or draw the arrow outside theaxisenvironment. For that method, it might be useful to add e.g.name=myaxisto theaxisoptions, 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=individualis very handy (I have it on by default in my templates). This will clip graphs but not the added things (nodes,paths 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 standardpgfplotsplot? (I.e. anaxisenvironment.) If the latter, addclip=falseto theaxisoptions, or draw the arrow outside theaxisenvironment. For that method, it might be useful to add e.g.name=myaxisto theaxisoptions, 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=individualis very handy (I have it on by default in my templates). This will clip graphs but not the added things (nodes,paths 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 (nodes, paths 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 (nodes, paths 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
usepackagepgfplots
usetikzlibraryarrows
begindocument
begintikzpicture[scale=0.75, >=stealth']
pgfplotssetgrid style=dashed,gray
beginaxis
[
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)
;
endaxis
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
endtikzpicture
enddocument
Cheers,
1
I prefer your commented alternative solution, because this has the advantage that one doesn't have to adjust a "one time set"xshiftin case the (horizontal) size of anx labelor the size of theyticklabelschanges.
– 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:
documentclassarticle
usepackagepgfplots
begindocument
begintikzpicture
beginaxis
[
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);
endaxis
endtikzpicture
enddocument

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 csinstead ofrel axis cs, because it is independent of axis reversals or skewed axes. To show what I mean, addx dir=reverse,to theaxisoptions 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
usepackagepgfplots
usetikzlibraryarrows
begindocument
begintikzpicture[scale=0.75, >=stealth']
pgfplotssetgrid style=dashed,gray
beginaxis
[
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)
;
endaxis
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
endtikzpicture
enddocument
Cheers,
1
I prefer your commented alternative solution, because this has the advantage that one doesn't have to adjust a "one time set"xshiftin case the (horizontal) size of anx labelor the size of theyticklabelschanges.
– 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
usepackagepgfplots
usetikzlibraryarrows
begindocument
begintikzpicture[scale=0.75, >=stealth']
pgfplotssetgrid style=dashed,gray
beginaxis
[
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)
;
endaxis
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
endtikzpicture
enddocument
Cheers,
1
I prefer your commented alternative solution, because this has the advantage that one doesn't have to adjust a "one time set"xshiftin case the (horizontal) size of anx labelor the size of theyticklabelschanges.
– 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
usepackagepgfplots
usetikzlibraryarrows
begindocument
begintikzpicture[scale=0.75, >=stealth']
pgfplotssetgrid style=dashed,gray
beginaxis
[
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)
;
endaxis
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
endtikzpicture
enddocument
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
usepackagepgfplots
usetikzlibraryarrows
begindocument
begintikzpicture[scale=0.75, >=stealth']
pgfplotssetgrid style=dashed,gray
beginaxis
[
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)
;
endaxis
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
endtikzpicture
enddocument
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"xshiftin case the (horizontal) size of anx labelor the size of theyticklabelschanges.
– 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"xshiftin case the (horizontal) size of anx labelor the size of theyticklabelschanges.
– 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:
documentclassarticle
usepackagepgfplots
begindocument
begintikzpicture
beginaxis
[
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);
endaxis
endtikzpicture
enddocument

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 csinstead ofrel axis cs, because it is independent of axis reversals or skewed axes. To show what I mean, addx dir=reverse,to theaxisoptions 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:
documentclassarticle
usepackagepgfplots
begindocument
begintikzpicture
beginaxis
[
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);
endaxis
endtikzpicture
enddocument

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 csinstead ofrel axis cs, because it is independent of axis reversals or skewed axes. To show what I mean, addx dir=reverse,to theaxisoptions 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:
documentclassarticle
usepackagepgfplots
begindocument
begintikzpicture
beginaxis
[
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);
endaxis
endtikzpicture
enddocument

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:
documentclassarticle
usepackagepgfplots
begindocument
begintikzpicture
beginaxis
[
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);
endaxis
endtikzpicture
enddocument

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 13 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 csinstead ofrel axis cs, because it is independent of axis reversals or skewed axes. To show what I mean, addx dir=reverse,to theaxisoptions 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 csinstead ofrel axis cs, because it is independent of axis reversals or skewed axes. To show what I mean, addx dir=reverse,to theaxisoptions 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
pgfplotsplot? (I.e. anaxisenvironment.) If the latter, addclip=falseto theaxisoptions, or draw the arrow outside theaxisenvironment. For that method, it might be useful to add e.g.name=myaxisto theaxisoptions, 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=individualis very handy (I have it on by default in my templates). This will clip graphs but not the added things (nodes,paths 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