Barplot not in scale

Hi, I can't get my barplot to be their actual size, here is my data.

Type Respiratory Rate Mean
C 18.667
M 19.167
N 19

Type (C,M,N)
Respiratory Rate Mean (18.667,19.167,19)

Here is my code that I'm using

barplot(counts,main="Respiratory Rate Mean vs Nicotine Type", xlab="Nicotine Type",ylab="Average Respiratory Rate")![Rplot|347x500]

Here is the graph, however, I want the bar height to be the actual vaules.
(upload://nlO1rMQVBWAc9wcok4xgOXs7qcB.png)

Thanks in advance :slight_smile:

Hi Lucy, welcome!

The code you have shared is not reproducible, and you didn't wait for the image to finish uploading so we can't see it either, so I'm guessing here, but I think this what you are trying to do.

library(ggplot2)

counts <- data.frame(type = c('C','M','N'),
                     respiratory_rate_mean = c(18.667,19.167,19))

ggplot(counts, aes(x = type, y = respiratory_rate_mean)) +
    geom_col() +
    labs(title = 'Respiratory Rate Mean vs Nicotine Type',
         x = 'Nicotine Type',
         y = 'Average Respiratory Rate')

Created on 2019-01-24 by the reprex package (v0.2.1)

For future posts please read this FAQ about making a reproducible example (like the one I did above)

1 Like

Hi Andrés!
I seemed to figure it out since posting this.
I used:

barplot(c(18.667,19.167,19.000),names.arg=c("Cigarette","Menthol Cigarette","Nicotine Inhaler"), main="Respiratory Rate vs Nicotine Type",xlab="Nicotine Type",ylab="Average Respiratory Rate",ylim=c(0,20),beside=TURE)

Thank you for spending the time to explain it to me!!! Assignment due tomorrow :slight_smile:

Also I have another question, for the life of me I can't figure out how to get a scatter plot, none of things on google will give me a scatter plot. I'm even trying to download packages.
thanks :slight_smile:

If you have a different question, is better for you to make a new topic, and don't forget to include a reproducible example.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.