How to show a “node near coord” even when it is out of bounds (with clip = true)?pgfplots: Positioning “node near coord” at the bottom of the barpgfplots: “nodes near coords” on xbar chart is offUse BPchem Numbering As Labels in a PGFPlotNodes near coords gives Undefined Control SequenceProblem with PGFPlots and Tikz fading library with disappearance of nodes near coords and irregular fadesDecorating a PGFPlots bar graph with Tikz decorationsHow to hide empty (value 0) ybars with pgfplots?Show mark labels near marks and not centered in ybar interaval graphHow to correct nodes near coords position in ybar stacked?How to display the y-values of each bar in pgfplots bar chart above the bar?pgfplots: percentage in matrix plot
What mathematical theory is required for high frequency trading?
Does there exist a non-trivial group that is both perfect and complete?
「捨ててしまう」why is there two て’s used here?
Implementation of the Jacobi Symbol in C
I calculated that we should be able to see the sun well beyond the observable universe. Where did I go wrong?
"Correct me if I'm wrong"
Am I legally required to provide a (GPL licensed) source code even after a project is abandoned?
Large-n limit of the distribution of the normalized sum of Cauchy random variables
How to modify a string without altering its text properties
Math symbols in math operators
Can the pre-order traversal of two different trees be the same even though they are different?
Would a 7805 5 V regulator drain a 9 V battery?
How to sort human readable size
Why things float in space, though there is always gravity of our star is present
Why was New Asgard established at this place?
Make symbols atomic, without losing their type
sudo passwd username keeps asking for the current password
What is this word in a sample of blackletter script?
First occurrence in the Sixers sequence
Why there is a red color in right side?
What is the highest power supply a Raspberry pi 3 B can handle without getting damaged?
Is declining an undergraduate award which causes me discomfort appropriate?
Synaptic Static - when to roll the d6?
If the mass of the Earth is decreasing by sending debris in space, does its angular momentum also decrease?
How to show a “node near coord” even when it is out of bounds (with clip = true)?
pgfplots: Positioning “node near coord” at the bottom of the barpgfplots: “nodes near coords” on xbar chart is offUse BPchem Numbering As Labels in a PGFPlotNodes near coords gives Undefined Control SequenceProblem with PGFPlots and Tikz fading library with disappearance of nodes near coords and irregular fadesDecorating a PGFPlots bar graph with Tikz decorationsHow to hide empty (value 0) ybars with pgfplots?Show mark labels near marks and not centered in ybar interaval graphHow to correct nodes near coords position in ybar stacked?How to display the y-values of each bar in pgfplots bar chart above the bar?pgfplots: percentage in matrix plot
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a ybar graph using the pgfplots package in which I use nodes near coords to display y values near the tops of the bars. There are some outliers in the data, for which I'd like to show a bar filled to the top of the graph. In this case, the y value should be displayed in the middle of the bar. I have tried to use visualization depends on to set a different yshift for the nodes near the coordinates for these outliers. However, it seems that pgfplots simply does not draw these nodes at all, because the node is still not displayed even with this yshift.
The below example clarifies this. Here I shift the nodes for values larger than 6. The first value is correctly placed above the bar; the second value is correctly shifted down. However, the last value ((3,9)) does not appear at all. How can I get this node to appear as well?
NB: the value for myshift here is not finalized yet; I haven't found a good way yet to calculate this appropriately. Suggestions welcome.
documentclassarticle
usepackagepgfplots
begindocument
begintikzpicture
beginaxis[
ybar,
ymin=0,ymax=8,
xmin=0,xmax=4,
nodes near coords,
visualization depends on=ifthenelse(y>6,-y,0) as myshift,
every node near coord/.append style=yshift=myshift em]
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

tikz-pgf pgfplots coordinates nodes-near-coords
add a comment |
I have a ybar graph using the pgfplots package in which I use nodes near coords to display y values near the tops of the bars. There are some outliers in the data, for which I'd like to show a bar filled to the top of the graph. In this case, the y value should be displayed in the middle of the bar. I have tried to use visualization depends on to set a different yshift for the nodes near the coordinates for these outliers. However, it seems that pgfplots simply does not draw these nodes at all, because the node is still not displayed even with this yshift.
The below example clarifies this. Here I shift the nodes for values larger than 6. The first value is correctly placed above the bar; the second value is correctly shifted down. However, the last value ((3,9)) does not appear at all. How can I get this node to appear as well?
NB: the value for myshift here is not finalized yet; I haven't found a good way yet to calculate this appropriately. Suggestions welcome.
documentclassarticle
usepackagepgfplots
begindocument
begintikzpicture
beginaxis[
ybar,
ymin=0,ymax=8,
xmin=0,xmax=4,
nodes near coords,
visualization depends on=ifthenelse(y>6,-y,0) as myshift,
every node near coord/.append style=yshift=myshift em]
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

tikz-pgf pgfplots coordinates nodes-near-coords
Not related: Choosearticleorstandaloneinstead ofdocumentclassminimal.minimalcan cause additional trouble.articleis the true "minimal" document class :).
– Dr. Manuel Kuehner
Jun 10 at 12:22
1
@Dr.ManuelKuehner thanks, didn't know about that!
– Keelan
Jun 10 at 12:23
add a comment |
I have a ybar graph using the pgfplots package in which I use nodes near coords to display y values near the tops of the bars. There are some outliers in the data, for which I'd like to show a bar filled to the top of the graph. In this case, the y value should be displayed in the middle of the bar. I have tried to use visualization depends on to set a different yshift for the nodes near the coordinates for these outliers. However, it seems that pgfplots simply does not draw these nodes at all, because the node is still not displayed even with this yshift.
The below example clarifies this. Here I shift the nodes for values larger than 6. The first value is correctly placed above the bar; the second value is correctly shifted down. However, the last value ((3,9)) does not appear at all. How can I get this node to appear as well?
NB: the value for myshift here is not finalized yet; I haven't found a good way yet to calculate this appropriately. Suggestions welcome.
documentclassarticle
usepackagepgfplots
begindocument
begintikzpicture
beginaxis[
ybar,
ymin=0,ymax=8,
xmin=0,xmax=4,
nodes near coords,
visualization depends on=ifthenelse(y>6,-y,0) as myshift,
every node near coord/.append style=yshift=myshift em]
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

tikz-pgf pgfplots coordinates nodes-near-coords
I have a ybar graph using the pgfplots package in which I use nodes near coords to display y values near the tops of the bars. There are some outliers in the data, for which I'd like to show a bar filled to the top of the graph. In this case, the y value should be displayed in the middle of the bar. I have tried to use visualization depends on to set a different yshift for the nodes near the coordinates for these outliers. However, it seems that pgfplots simply does not draw these nodes at all, because the node is still not displayed even with this yshift.
The below example clarifies this. Here I shift the nodes for values larger than 6. The first value is correctly placed above the bar; the second value is correctly shifted down. However, the last value ((3,9)) does not appear at all. How can I get this node to appear as well?
NB: the value for myshift here is not finalized yet; I haven't found a good way yet to calculate this appropriately. Suggestions welcome.
documentclassarticle
usepackagepgfplots
begindocument
begintikzpicture
beginaxis[
ybar,
ymin=0,ymax=8,
xmin=0,xmax=4,
nodes near coords,
visualization depends on=ifthenelse(y>6,-y,0) as myshift,
every node near coord/.append style=yshift=myshift em]
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

tikz-pgf pgfplots coordinates nodes-near-coords
tikz-pgf pgfplots coordinates nodes-near-coords
edited Jun 10 at 13:04
Dr. Manuel Kuehner
9,67632871
9,67632871
asked Jun 10 at 12:19
KeelanKeelan
2,16052641
2,16052641
Not related: Choosearticleorstandaloneinstead ofdocumentclassminimal.minimalcan cause additional trouble.articleis the true "minimal" document class :).
– Dr. Manuel Kuehner
Jun 10 at 12:22
1
@Dr.ManuelKuehner thanks, didn't know about that!
– Keelan
Jun 10 at 12:23
add a comment |
Not related: Choosearticleorstandaloneinstead ofdocumentclassminimal.minimalcan cause additional trouble.articleis the true "minimal" document class :).
– Dr. Manuel Kuehner
Jun 10 at 12:22
1
@Dr.ManuelKuehner thanks, didn't know about that!
– Keelan
Jun 10 at 12:23
Not related: Choose
article or standalone instead of documentclassminimal. minimal can cause additional trouble. article is the true "minimal" document class :).– Dr. Manuel Kuehner
Jun 10 at 12:22
Not related: Choose
article or standalone instead of documentclassminimal. minimal can cause additional trouble. article is the true "minimal" document class :).– Dr. Manuel Kuehner
Jun 10 at 12:22
1
1
@Dr.ManuelKuehner thanks, didn't know about that!
– Keelan
Jun 10 at 12:23
@Dr.ManuelKuehner thanks, didn't know about that!
– Keelan
Jun 10 at 12:23
add a comment |
3 Answers
3
active
oldest
votes
Not exactly what you were asking for, but I think this is a better alternative than shifting the nodes near coords to the middle of the bar. Instead I still write it on top of it, although it is "truncated".
% used PGFPlots v1.16
documentclass[border=5pt]standalone
usepackagepgfplots
begindocument
begintikzpicture
beginaxis[
ybar,
xmin=0,
xmax=4,
ymin=0,
ymax=8,
xtick=data,
% -----------------------------------------------------------------
% we store the *original* y value in a variable ...
visualization depends on=rawy as rawy,
% ... which value should be shown in the `nodes near coords' ...
nodes near coords=pgfmathprintnumberrawy,
% ... and we want to limit the range of the bars to the axis limits
restrict y to domain*=
pgfkeysvalueof/pgfplots/ymin:pgfkeysvalueof/pgfplots/ymax
,
% -----------------------------------------------------------------
]
addplot coordinates (1,5) (2,7) (3,10);
endaxis
endtikzpicture
enddocument

+1: Perfect! So rawy is a predefined variable as it looks like?
– Dr. Manuel Kuehner
Jun 11 at 5:15
1
@Dr.ManuelKuehner, many thanks. Yes,rawxand friends can be found in various contexts. This is most likely the case when transformation of the raw data is involved.
– Stefan Pinnow
Jun 11 at 5:24
Thanks very much, this looks like a neater solution indeed! I decided to put the label at the top of the bar but inside the axis. I'm not sure what it translates to for the MWE, but in my larger example this isanchor=ifdimmyy pt=0pt westelse eastfi. You are right that placing them in the middle of the bar was a bad idea.
– Keelan
Jun 11 at 18:41
add a comment |
Maybe clip = false is what you are looking for.
documentclassarticle
usepackagepgfplots
begindocument
begintikzpicture
beginaxis[
ybar,
ymin = 0,
ymax = 8,
xmin = 0,
xmax = 4,
nodes near coords,
clip = false, % <--- Added
]
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

Update 1
This almost works -- if I use clip = true then the 9 is not printed anymore at the bottom (strangely).
Maybe some of the experts here can support.
documentclassarticle
usepackagepgfplots
begindocument
% Based on
% https://tex.stackexchange.com/questions/110879
begintikzpicture
beginaxis[
ybar,
ymin = 0,
ymax = 8,
xmin = 0,
xmax = 4,
nodes near coords,
clip = false, % <--- Added, `true` does not work
visualization depends on = y as myYOffset, % <--- Added
every node near coord/.append style =
shift = (axis direction cs: 0, -myYOffset) % <--- Added
,
]
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

Thanks, that's almost what I'm looking for. I'd still like the bar to be clipped however. Unfortunately addingclip=falsetoevery node coords/.append styleinstead does not work (same result as my original code). Any ideas?
– Keelan
Jun 10 at 12:41
@Keelanclipapplies to theaxisenvironment I guess.
– Dr. Manuel Kuehner
Jun 10 at 12:53
@marmot Is this a case for you? :)
– Dr. Manuel Kuehner
Jun 10 at 13:02
add a comment |
Very similar to Dr. Manuel Kuehner's answer except that a clip for the plots is added by hand.
documentclassarticle
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture
beginaxis[clip=false,
ybar,
ymin=0,ymax=8,
xmin=0,xmax=4,
nodes near coords,
visualization depends on=y as myy,
nodes near coords style=at=(0,-myy/2)]
clip (current axis.south west) rectangle (current axis.north east);
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

+1: Thanks for the support, any ideas why my proposal ("Update 1") does not work as expected?
– Dr. Manuel Kuehner
Jun 10 at 14:16
1
@Dr.ManuelKuehner This is most likely related to the waypgfplotsclips. It is more than the usual pgf clip, see section 4.20.2 Clipping of the manual.
– marmot
Jun 10 at 14:21
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%2f495114%2fhow-to-show-a-node-near-coord-even-when-it-is-out-of-bounds-with-clip-true%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Not exactly what you were asking for, but I think this is a better alternative than shifting the nodes near coords to the middle of the bar. Instead I still write it on top of it, although it is "truncated".
% used PGFPlots v1.16
documentclass[border=5pt]standalone
usepackagepgfplots
begindocument
begintikzpicture
beginaxis[
ybar,
xmin=0,
xmax=4,
ymin=0,
ymax=8,
xtick=data,
% -----------------------------------------------------------------
% we store the *original* y value in a variable ...
visualization depends on=rawy as rawy,
% ... which value should be shown in the `nodes near coords' ...
nodes near coords=pgfmathprintnumberrawy,
% ... and we want to limit the range of the bars to the axis limits
restrict y to domain*=
pgfkeysvalueof/pgfplots/ymin:pgfkeysvalueof/pgfplots/ymax
,
% -----------------------------------------------------------------
]
addplot coordinates (1,5) (2,7) (3,10);
endaxis
endtikzpicture
enddocument

+1: Perfect! So rawy is a predefined variable as it looks like?
– Dr. Manuel Kuehner
Jun 11 at 5:15
1
@Dr.ManuelKuehner, many thanks. Yes,rawxand friends can be found in various contexts. This is most likely the case when transformation of the raw data is involved.
– Stefan Pinnow
Jun 11 at 5:24
Thanks very much, this looks like a neater solution indeed! I decided to put the label at the top of the bar but inside the axis. I'm not sure what it translates to for the MWE, but in my larger example this isanchor=ifdimmyy pt=0pt westelse eastfi. You are right that placing them in the middle of the bar was a bad idea.
– Keelan
Jun 11 at 18:41
add a comment |
Not exactly what you were asking for, but I think this is a better alternative than shifting the nodes near coords to the middle of the bar. Instead I still write it on top of it, although it is "truncated".
% used PGFPlots v1.16
documentclass[border=5pt]standalone
usepackagepgfplots
begindocument
begintikzpicture
beginaxis[
ybar,
xmin=0,
xmax=4,
ymin=0,
ymax=8,
xtick=data,
% -----------------------------------------------------------------
% we store the *original* y value in a variable ...
visualization depends on=rawy as rawy,
% ... which value should be shown in the `nodes near coords' ...
nodes near coords=pgfmathprintnumberrawy,
% ... and we want to limit the range of the bars to the axis limits
restrict y to domain*=
pgfkeysvalueof/pgfplots/ymin:pgfkeysvalueof/pgfplots/ymax
,
% -----------------------------------------------------------------
]
addplot coordinates (1,5) (2,7) (3,10);
endaxis
endtikzpicture
enddocument

+1: Perfect! So rawy is a predefined variable as it looks like?
– Dr. Manuel Kuehner
Jun 11 at 5:15
1
@Dr.ManuelKuehner, many thanks. Yes,rawxand friends can be found in various contexts. This is most likely the case when transformation of the raw data is involved.
– Stefan Pinnow
Jun 11 at 5:24
Thanks very much, this looks like a neater solution indeed! I decided to put the label at the top of the bar but inside the axis. I'm not sure what it translates to for the MWE, but in my larger example this isanchor=ifdimmyy pt=0pt westelse eastfi. You are right that placing them in the middle of the bar was a bad idea.
– Keelan
Jun 11 at 18:41
add a comment |
Not exactly what you were asking for, but I think this is a better alternative than shifting the nodes near coords to the middle of the bar. Instead I still write it on top of it, although it is "truncated".
% used PGFPlots v1.16
documentclass[border=5pt]standalone
usepackagepgfplots
begindocument
begintikzpicture
beginaxis[
ybar,
xmin=0,
xmax=4,
ymin=0,
ymax=8,
xtick=data,
% -----------------------------------------------------------------
% we store the *original* y value in a variable ...
visualization depends on=rawy as rawy,
% ... which value should be shown in the `nodes near coords' ...
nodes near coords=pgfmathprintnumberrawy,
% ... and we want to limit the range of the bars to the axis limits
restrict y to domain*=
pgfkeysvalueof/pgfplots/ymin:pgfkeysvalueof/pgfplots/ymax
,
% -----------------------------------------------------------------
]
addplot coordinates (1,5) (2,7) (3,10);
endaxis
endtikzpicture
enddocument

Not exactly what you were asking for, but I think this is a better alternative than shifting the nodes near coords to the middle of the bar. Instead I still write it on top of it, although it is "truncated".
% used PGFPlots v1.16
documentclass[border=5pt]standalone
usepackagepgfplots
begindocument
begintikzpicture
beginaxis[
ybar,
xmin=0,
xmax=4,
ymin=0,
ymax=8,
xtick=data,
% -----------------------------------------------------------------
% we store the *original* y value in a variable ...
visualization depends on=rawy as rawy,
% ... which value should be shown in the `nodes near coords' ...
nodes near coords=pgfmathprintnumberrawy,
% ... and we want to limit the range of the bars to the axis limits
restrict y to domain*=
pgfkeysvalueof/pgfplots/ymin:pgfkeysvalueof/pgfplots/ymax
,
% -----------------------------------------------------------------
]
addplot coordinates (1,5) (2,7) (3,10);
endaxis
endtikzpicture
enddocument

answered Jun 10 at 17:34
Stefan PinnowStefan Pinnow
20.7k93678
20.7k93678
+1: Perfect! So rawy is a predefined variable as it looks like?
– Dr. Manuel Kuehner
Jun 11 at 5:15
1
@Dr.ManuelKuehner, many thanks. Yes,rawxand friends can be found in various contexts. This is most likely the case when transformation of the raw data is involved.
– Stefan Pinnow
Jun 11 at 5:24
Thanks very much, this looks like a neater solution indeed! I decided to put the label at the top of the bar but inside the axis. I'm not sure what it translates to for the MWE, but in my larger example this isanchor=ifdimmyy pt=0pt westelse eastfi. You are right that placing them in the middle of the bar was a bad idea.
– Keelan
Jun 11 at 18:41
add a comment |
+1: Perfect! So rawy is a predefined variable as it looks like?
– Dr. Manuel Kuehner
Jun 11 at 5:15
1
@Dr.ManuelKuehner, many thanks. Yes,rawxand friends can be found in various contexts. This is most likely the case when transformation of the raw data is involved.
– Stefan Pinnow
Jun 11 at 5:24
Thanks very much, this looks like a neater solution indeed! I decided to put the label at the top of the bar but inside the axis. I'm not sure what it translates to for the MWE, but in my larger example this isanchor=ifdimmyy pt=0pt westelse eastfi. You are right that placing them in the middle of the bar was a bad idea.
– Keelan
Jun 11 at 18:41
+1: Perfect! So rawy is a predefined variable as it looks like?
– Dr. Manuel Kuehner
Jun 11 at 5:15
+1: Perfect! So rawy is a predefined variable as it looks like?
– Dr. Manuel Kuehner
Jun 11 at 5:15
1
1
@Dr.ManuelKuehner, many thanks. Yes,
rawx and friends can be found in various contexts. This is most likely the case when transformation of the raw data is involved.– Stefan Pinnow
Jun 11 at 5:24
@Dr.ManuelKuehner, many thanks. Yes,
rawx and friends can be found in various contexts. This is most likely the case when transformation of the raw data is involved.– Stefan Pinnow
Jun 11 at 5:24
Thanks very much, this looks like a neater solution indeed! I decided to put the label at the top of the bar but inside the axis. I'm not sure what it translates to for the MWE, but in my larger example this is
anchor=ifdimmyy pt=0pt westelse eastfi. You are right that placing them in the middle of the bar was a bad idea.– Keelan
Jun 11 at 18:41
Thanks very much, this looks like a neater solution indeed! I decided to put the label at the top of the bar but inside the axis. I'm not sure what it translates to for the MWE, but in my larger example this is
anchor=ifdimmyy pt=0pt westelse eastfi. You are right that placing them in the middle of the bar was a bad idea.– Keelan
Jun 11 at 18:41
add a comment |
Maybe clip = false is what you are looking for.
documentclassarticle
usepackagepgfplots
begindocument
begintikzpicture
beginaxis[
ybar,
ymin = 0,
ymax = 8,
xmin = 0,
xmax = 4,
nodes near coords,
clip = false, % <--- Added
]
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

Update 1
This almost works -- if I use clip = true then the 9 is not printed anymore at the bottom (strangely).
Maybe some of the experts here can support.
documentclassarticle
usepackagepgfplots
begindocument
% Based on
% https://tex.stackexchange.com/questions/110879
begintikzpicture
beginaxis[
ybar,
ymin = 0,
ymax = 8,
xmin = 0,
xmax = 4,
nodes near coords,
clip = false, % <--- Added, `true` does not work
visualization depends on = y as myYOffset, % <--- Added
every node near coord/.append style =
shift = (axis direction cs: 0, -myYOffset) % <--- Added
,
]
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

Thanks, that's almost what I'm looking for. I'd still like the bar to be clipped however. Unfortunately addingclip=falsetoevery node coords/.append styleinstead does not work (same result as my original code). Any ideas?
– Keelan
Jun 10 at 12:41
@Keelanclipapplies to theaxisenvironment I guess.
– Dr. Manuel Kuehner
Jun 10 at 12:53
@marmot Is this a case for you? :)
– Dr. Manuel Kuehner
Jun 10 at 13:02
add a comment |
Maybe clip = false is what you are looking for.
documentclassarticle
usepackagepgfplots
begindocument
begintikzpicture
beginaxis[
ybar,
ymin = 0,
ymax = 8,
xmin = 0,
xmax = 4,
nodes near coords,
clip = false, % <--- Added
]
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

Update 1
This almost works -- if I use clip = true then the 9 is not printed anymore at the bottom (strangely).
Maybe some of the experts here can support.
documentclassarticle
usepackagepgfplots
begindocument
% Based on
% https://tex.stackexchange.com/questions/110879
begintikzpicture
beginaxis[
ybar,
ymin = 0,
ymax = 8,
xmin = 0,
xmax = 4,
nodes near coords,
clip = false, % <--- Added, `true` does not work
visualization depends on = y as myYOffset, % <--- Added
every node near coord/.append style =
shift = (axis direction cs: 0, -myYOffset) % <--- Added
,
]
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

Thanks, that's almost what I'm looking for. I'd still like the bar to be clipped however. Unfortunately addingclip=falsetoevery node coords/.append styleinstead does not work (same result as my original code). Any ideas?
– Keelan
Jun 10 at 12:41
@Keelanclipapplies to theaxisenvironment I guess.
– Dr. Manuel Kuehner
Jun 10 at 12:53
@marmot Is this a case for you? :)
– Dr. Manuel Kuehner
Jun 10 at 13:02
add a comment |
Maybe clip = false is what you are looking for.
documentclassarticle
usepackagepgfplots
begindocument
begintikzpicture
beginaxis[
ybar,
ymin = 0,
ymax = 8,
xmin = 0,
xmax = 4,
nodes near coords,
clip = false, % <--- Added
]
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

Update 1
This almost works -- if I use clip = true then the 9 is not printed anymore at the bottom (strangely).
Maybe some of the experts here can support.
documentclassarticle
usepackagepgfplots
begindocument
% Based on
% https://tex.stackexchange.com/questions/110879
begintikzpicture
beginaxis[
ybar,
ymin = 0,
ymax = 8,
xmin = 0,
xmax = 4,
nodes near coords,
clip = false, % <--- Added, `true` does not work
visualization depends on = y as myYOffset, % <--- Added
every node near coord/.append style =
shift = (axis direction cs: 0, -myYOffset) % <--- Added
,
]
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

Maybe clip = false is what you are looking for.
documentclassarticle
usepackagepgfplots
begindocument
begintikzpicture
beginaxis[
ybar,
ymin = 0,
ymax = 8,
xmin = 0,
xmax = 4,
nodes near coords,
clip = false, % <--- Added
]
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

Update 1
This almost works -- if I use clip = true then the 9 is not printed anymore at the bottom (strangely).
Maybe some of the experts here can support.
documentclassarticle
usepackagepgfplots
begindocument
% Based on
% https://tex.stackexchange.com/questions/110879
begintikzpicture
beginaxis[
ybar,
ymin = 0,
ymax = 8,
xmin = 0,
xmax = 4,
nodes near coords,
clip = false, % <--- Added, `true` does not work
visualization depends on = y as myYOffset, % <--- Added
every node near coord/.append style =
shift = (axis direction cs: 0, -myYOffset) % <--- Added
,
]
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

edited Jun 10 at 13:01
answered Jun 10 at 12:31
Dr. Manuel KuehnerDr. Manuel Kuehner
9,67632871
9,67632871
Thanks, that's almost what I'm looking for. I'd still like the bar to be clipped however. Unfortunately addingclip=falsetoevery node coords/.append styleinstead does not work (same result as my original code). Any ideas?
– Keelan
Jun 10 at 12:41
@Keelanclipapplies to theaxisenvironment I guess.
– Dr. Manuel Kuehner
Jun 10 at 12:53
@marmot Is this a case for you? :)
– Dr. Manuel Kuehner
Jun 10 at 13:02
add a comment |
Thanks, that's almost what I'm looking for. I'd still like the bar to be clipped however. Unfortunately addingclip=falsetoevery node coords/.append styleinstead does not work (same result as my original code). Any ideas?
– Keelan
Jun 10 at 12:41
@Keelanclipapplies to theaxisenvironment I guess.
– Dr. Manuel Kuehner
Jun 10 at 12:53
@marmot Is this a case for you? :)
– Dr. Manuel Kuehner
Jun 10 at 13:02
Thanks, that's almost what I'm looking for. I'd still like the bar to be clipped however. Unfortunately adding
clip=false to every node coords/.append style instead does not work (same result as my original code). Any ideas?– Keelan
Jun 10 at 12:41
Thanks, that's almost what I'm looking for. I'd still like the bar to be clipped however. Unfortunately adding
clip=false to every node coords/.append style instead does not work (same result as my original code). Any ideas?– Keelan
Jun 10 at 12:41
@Keelan
clip applies to the axis environment I guess.– Dr. Manuel Kuehner
Jun 10 at 12:53
@Keelan
clip applies to the axis environment I guess.– Dr. Manuel Kuehner
Jun 10 at 12:53
@marmot Is this a case for you? :)
– Dr. Manuel Kuehner
Jun 10 at 13:02
@marmot Is this a case for you? :)
– Dr. Manuel Kuehner
Jun 10 at 13:02
add a comment |
Very similar to Dr. Manuel Kuehner's answer except that a clip for the plots is added by hand.
documentclassarticle
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture
beginaxis[clip=false,
ybar,
ymin=0,ymax=8,
xmin=0,xmax=4,
nodes near coords,
visualization depends on=y as myy,
nodes near coords style=at=(0,-myy/2)]
clip (current axis.south west) rectangle (current axis.north east);
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

+1: Thanks for the support, any ideas why my proposal ("Update 1") does not work as expected?
– Dr. Manuel Kuehner
Jun 10 at 14:16
1
@Dr.ManuelKuehner This is most likely related to the waypgfplotsclips. It is more than the usual pgf clip, see section 4.20.2 Clipping of the manual.
– marmot
Jun 10 at 14:21
add a comment |
Very similar to Dr. Manuel Kuehner's answer except that a clip for the plots is added by hand.
documentclassarticle
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture
beginaxis[clip=false,
ybar,
ymin=0,ymax=8,
xmin=0,xmax=4,
nodes near coords,
visualization depends on=y as myy,
nodes near coords style=at=(0,-myy/2)]
clip (current axis.south west) rectangle (current axis.north east);
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

+1: Thanks for the support, any ideas why my proposal ("Update 1") does not work as expected?
– Dr. Manuel Kuehner
Jun 10 at 14:16
1
@Dr.ManuelKuehner This is most likely related to the waypgfplotsclips. It is more than the usual pgf clip, see section 4.20.2 Clipping of the manual.
– marmot
Jun 10 at 14:21
add a comment |
Very similar to Dr. Manuel Kuehner's answer except that a clip for the plots is added by hand.
documentclassarticle
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture
beginaxis[clip=false,
ybar,
ymin=0,ymax=8,
xmin=0,xmax=4,
nodes near coords,
visualization depends on=y as myy,
nodes near coords style=at=(0,-myy/2)]
clip (current axis.south west) rectangle (current axis.north east);
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

Very similar to Dr. Manuel Kuehner's answer except that a clip for the plots is added by hand.
documentclassarticle
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture
beginaxis[clip=false,
ybar,
ymin=0,ymax=8,
xmin=0,xmax=4,
nodes near coords,
visualization depends on=y as myy,
nodes near coords style=at=(0,-myy/2)]
clip (current axis.south west) rectangle (current axis.north east);
addplot coordinates (1,5) (2,7) (3,9);
endaxis
endtikzpicture
enddocument

answered Jun 10 at 14:15
marmotmarmot
136k6177326
136k6177326
+1: Thanks for the support, any ideas why my proposal ("Update 1") does not work as expected?
– Dr. Manuel Kuehner
Jun 10 at 14:16
1
@Dr.ManuelKuehner This is most likely related to the waypgfplotsclips. It is more than the usual pgf clip, see section 4.20.2 Clipping of the manual.
– marmot
Jun 10 at 14:21
add a comment |
+1: Thanks for the support, any ideas why my proposal ("Update 1") does not work as expected?
– Dr. Manuel Kuehner
Jun 10 at 14:16
1
@Dr.ManuelKuehner This is most likely related to the waypgfplotsclips. It is more than the usual pgf clip, see section 4.20.2 Clipping of the manual.
– marmot
Jun 10 at 14:21
+1: Thanks for the support, any ideas why my proposal ("Update 1") does not work as expected?
– Dr. Manuel Kuehner
Jun 10 at 14:16
+1: Thanks for the support, any ideas why my proposal ("Update 1") does not work as expected?
– Dr. Manuel Kuehner
Jun 10 at 14:16
1
1
@Dr.ManuelKuehner This is most likely related to the way
pgfplots clips. It is more than the usual pgf clip, see section 4.20.2 Clipping of the manual.– marmot
Jun 10 at 14:21
@Dr.ManuelKuehner This is most likely related to the way
pgfplots clips. It is more than the usual pgf clip, see section 4.20.2 Clipping of the manual.– marmot
Jun 10 at 14:21
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%2f495114%2fhow-to-show-a-node-near-coord-even-when-it-is-out-of-bounds-with-clip-true%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
Not related: Choose
articleorstandaloneinstead ofdocumentclassminimal.minimalcan cause additional trouble.articleis the true "minimal" document class :).– Dr. Manuel Kuehner
Jun 10 at 12:22
1
@Dr.ManuelKuehner thanks, didn't know about that!
– Keelan
Jun 10 at 12:23