LaTeX forum ⇒ Graphics, Figures & TablesThousand Separator for Value Nodes in Plots Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
Didou139
Posts: 2
Joined: Thu Feb 07, 2013 4:04 pm

Thousand Separator for Value Nodes in Plots

Postby Didou139 » Thu Feb 07, 2013 4:13 pm

Hi all,

with the pgfplots package, I have a problem with thousands separator of the node. I would like to have no thousands separator. For the x tick labels, I found the solution (xticklabel style={/pgf/number format/1000 sep=}) but not for the node value (see code below).
  1. \begin{tikzpicture}[scale=1.4]
  2. \begin{axis}[,xbar, bar width=36pt,
  3. enlarge y limits, xmajorgrids,xlabel={Value X}, xticklabel style={/pgf/number format/1000 sep=},
  4. nodes near coords, nodes near coords align={anchor=west},
  5. xmin =0, ymin=0.5, ymax=3.5, ytick= {1,2,3}
  6. , yticklabels={value1,value2 ,Value3}]
  7. \addplot coordinates {(1471.2,1) (200.6,2) (157.3,3)};
  8. \end{axis}
  9. \end{tikzpicture}



Many thanks in advance
Didou139
Last edited by Stefan Kottwitz on Thu Feb 07, 2013 4:50 pm, edited 1 time in total.

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany

Postby localghost » Thu Feb 07, 2013 7:05 pm

There is a style called every node near coord that determines the appearance of those nodes. Give it the same parameters and you get what you are after (see below code).
  1. \documentclass[11pt]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{pgfplots}
  4.  
  5. \begin{document}
  6. \begin{tikzpicture}
  7. \begin{axis}[
  8. xmin=0,
  9. xmax=2000,
  10. xbar,
  11. xmajorgrids,
  12. xlabel={Value X},
  13. xticklabel style={/pgf/number format/1000 sep=},
  14. ymin=0.5,
  15. ymax=3.5,
  16. ytick= {1,2,3},
  17. yticklabels={Value1,Value2,Value3},
  18. bar width=36pt,
  19. enlarge y limits,
  20. nodes near coords,
  21. nodes near coords align={anchor=west},
  22. every node near coord/.style={/pgf/number format/1000 sep=}
  23. ]
  24. \addplot coordinates {(1471.2,1) (200.6,2) (157.3,3)};
  25. \end{axis}
  26. \end{tikzpicture}
  27. \end{document}

For details please refer to the package manual.


Best regards and welcome to the board
Thorsten
Attachments
tmp.png
tmp.png (4.91 KiB) Viewed 2694 times
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses

Link:
BBcode: Topic is solved[/url]" title="Click to select post's link in BBcode format" onclick="this.focus();this.select();" />
HTML: Topic is solved</a>" title="Click to select post's link in HTML format" onclick="this.focus();this.select();" />
Hide post links
Show post links

Didou139
Posts: 2
Joined: Thu Feb 07, 2013 4:04 pm

Postby Didou139 » Mon Feb 11, 2013 1:26 pm

That's very nice,
Many thanks !
Didou139

Link:
BBcode:
HTML:
Hide post links
Show post links


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: Bing [Bot] and 6 guests