Regarding Multiple Bar diagram


I have a data frame with three vectors as described below.

  RNO - c("Y153082150","Y153082151",...)
  Avg. - c(93.5,92.5,80.6,....)
  Max. Avg. - c(93.5,93.5,.....)

Each vector has 93 records.

Now my question is how to draw a multiple bar diagram between Avg. and Max.Avg. against each RNO.?

What have you tried so far? What's your specific problem?

It would be better if you provide a reproducible example, if you don't know how to made one, here is how to do it.

1 Like


I have students results data of 93 students. I want to draw a graph between a students aggregate percentage and the top scorer of the class. Can you help me out in that way?

It's hard to help you any further if you don't provide a reproducible example.
I think this could be a good resource to get you started with data visualization.

 # Reading a csv file with 1300 records
 # Obtaining subset of the data with a specific sem no. and group of study and calculated the total score and average score for each student.

ra2=subset(ra,SEMNO.==1 & GROUP=="M.S.CS.")
ra2$AVG=round(ra2$TOTAL/4,digits = 2)

   # Then i found the max. average score


Now i want to draw a multiple bar diagram between the avg. score of a student and max. avg. score. Please help me out.

1 Like

We are more inclined towards helping you with the things that you have already tried, and I see in your code that you have not even tried to made a plot, so, please read the resource I advised you before and at least try to made the plot you want, that way we can have a better understanding of what are you trying to accomplish.

Just now i was tried the following code:

barplot(t(as.matrix(ratop)),beside = T,col=c("red","blue"),
        main="Student Score Vs. Top Score",sub="MSCS Semester-1",
        xlab="Serial No.",ylab="Percentages",ylim=c(0,100),
        legend.text=c("Avg. Score","Top Score"),args.legend=list(x="topright"))

But i got the diagram what i am looking for but i am unable to get the RNO in the X-Axis

I'm going to insist about the reproducible example, your example code is not actually reproducible since we dont have access to your .csv file, you can include some example data to your reprex using datapasta package, here is a blog post by Mara that explains really well how to do it.

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