0
plot(1:4,dbinom(1:4,4,0.7),
     type='h',
     main='Binominal Distribution (n=4, p=0.7',
     ylab='Probability',
     xlab='# Successes',
     lwd=3,xaxt="n")

This is my plot and i want to colour only the highest bar, but i don´t know how to associate the max() to the col = " "

  • Sorry for off-topic, I saw your other post that you deleted regarding drawing a pie-chart for Municipality/Competitor/MarketOwned. I was half-way-done for it. Decided to send you [my solution, code is here](https://cutt.ly/HgIAx8C) by this link. – Arty Oct 31 '20 at 15:44

1 Answers1

1

This should work:

y <- dbinom(1:4,4,0.7)
plot(1:4,y,
     type='h',
     col = ifelse(y == max(y), "red", "black"), 
     main='Binominal Distribution (n=4, p=0.7',
     ylab='Probability',
     xlab='# Successes',
     lwd=3,xaxt="n")

enter image description here

DaveArmstrong
  • 18,377
  • 2
  • 13
  • 25