1

I'm trying to study the distribution of weight (1 d.p numeric) vs age (integers). I tried using the following plot script:

babyData <- read.csv("baby2.csv", colClasses = c("NULL", NA, NA))      
plot(babyData$Weight, babyData$Age, 
  main = "Distribution of Weight across ages",
  sub = "Scatterplot of Baby Weight vs Age",
  pch = 10,
  cex = 0.5,
  xlab = "Age",
  ylab = "Weight")

And this is the resulting scatterplot: Resulting Scatterplot

This is how my data looks like: Dataset

As you can see, my Weight column has 1 decimal place but the plot function automatically rounds it and snaps to integers. How do I make the data points more precise down to 1 d.p? I tired googling and looking at documentations but I can't seem to fix it.

Thank you for your help and attention, sorry if this problem has been solved before.

Jaap
  • 81,064
  • 34
  • 182
  • 193
Soggeh
  • 101
  • 1
  • 8
  • You should post reproducible data rather than an image of your data. See [dput](https://www.rdocumentation.org/packages/base/versions/3.4.1/topics/dput) for one way to do this. – cmaher Aug 25 '17 at 17:33
  • Your Y axis spans from 0 to 40 and you want to put 400 tick marks on it? That's going to look like one big black stripe. – Spacedman Aug 25 '17 at 17:44
  • Also, its very weird that your **data points** seem to be snapped to integers. – Spacedman Aug 25 '17 at 17:47
  • https://stackoverflow.com/questions/17535706/r-plot-decimal-point-accuracy-on-the-axis Change your x axis to be more accurate – Chabo Aug 25 '17 at 19:42
  • @Spacedman Yea that's the problem I have with, I guess it's wrong to say ticks. My Weight data is 1.dp numeric but it's snapped to integers. Any ideas why? – Soggeh Aug 26 '17 at 03:06
  • 1
    Shouldn't it be `plot(babyData$Age, babyData$Weight, ...`? You had the y argument before the x argument without labelling them. – Z.Lin Aug 26 '17 at 05:13

0 Answers0