I'm trying to get my graph to fit inside of the graph's dimensions (4in by 7.5in). I want the ymin of the graph to be the minimum y value of all my points and the ymax value the maximum y value for all of my points (so that my graph fits snugly but doesn't get cut off).
My graph seems to go outside of the boundaries. I've tried to useenlargelimits=true but it adds too much whitespace.
I've also triedenlarge y limits={true, abs value=0.75}, and many different variations, however it doesn't appear to affect the graph at all.
I could use xmin and xmax but I have ~20 graphs, and I don't really want to change each separately.
\begin{tikzpicture} \begin{axis}[ xmin=1, enlarge y limits={true, abs value=0.75}, xlabel=Atomic Number, ylabel=Atomic Radius $(in$ $pm)$, width=7.5in, height=4in, enlargelimits = false, extra x ticks={1,84}, title={\large Atomic Number vs. Atomic Radius $(in$ $pm)$}] \addplot[smooth,mark=none,black] plot coordinates {(1,37.1) (2,31) (3,152) (4,112) (5,85) (6,77.2) (7,70) (8,73) (9,72) (10,71) (11,186) (12,160) (13,143) (14,117.6) (15,110) (16,103) (17,100) (18,98) (19,227) (20,197) (21,162) (22,147) (23,134) (24,128) (25,127) (26,126) (27,125) (28,124) (29,128) (30,134) (31,135) (32,122.3) (33,120) (34,119) (35,114) (36,112) (37,248) (38,215) (39,180) (40,160) (41,146) (42,139) (43,136) (44,134) (45,134) (46,137) (47,144) (48,151) (49,167) (50,140.5) (51,140) (52,142) (53,133) (54,131) (55,265) (56,222) (57,187) (58,182) (59,182) (60,181) (61,183) (62,180) (63,208) (64,180) (65,177) (66,178) (67,176) (68,176) (69,176) (70,193) (71,174) (72,159) (73,146) (74,139) (75,137) (76,135) (77,136) (78,139) (79,144) (80,151) (81,170) (82,146) (83,150) (84,168) };\end{axis}\end{tikzpicture}
- 1Welcome to TeX.sx! Please add aminimal working example (MWE) that illustrates your problem.percusse– percusse2012-10-27 14:05:37 +00:00CommentedOct 27, 2012 at 14:05
- Yep, I already added it! It's the graph around x=1alexyorke– alexyorke2012-10-27 14:08:16 +00:00CommentedOct 27, 2012 at 14:08
- 2MWE is meant to be the code producing it. Please check the link in my previous comment.percusse– percusse2012-10-27 14:09:19 +00:00CommentedOct 27, 2012 at 14:09
- 2@alexy13: An MWE should be a complete minimal document, so something beginning with
\documentclassthat can just be copied into a new document to get a compilable.texfile. Otherwise everyone who wants to try and help needs to complete the file themselves, which is not a whole lot of fun.Jake– Jake2012-10-27 14:37:36 +00:00CommentedOct 27, 2012 at 14:37
1 Answer1
Settingenlargelimits=false, as you've done, causes PGFPlots to adjust the limits so that all the data points are just visible. However, this does not take into account the overshooting introduced by thesmooth style. So you'll need to adjust the limits, using something like (as you've attempted)enlarge y limits={true, abs value=5}. However, youalso need to remove theenlargelimits=false, otherwise you'll override the setting.
I would recommend not using thesmooth style, however: As you've noticed, it doesn't accurately represent the data due to the overshooting. Also, smoothing the data makes it seem like you have much more data than you actually do, so it's not entirely honest.
You mustlog in to answer this question.
Explore related questions
See similar questions with these tags.


