adding a simple legend that includes a chosen text using ggplot

let’s say I have this simple df with its plot as follows : df = data.frame(a = c(‘person1′,’person2′,’person3′), b = c(10,20,30)) ggplot(df)+aes(x=a,y=b,fill=b)+ geom_bar(stat=’identity’) the outcome I wish that the legend is a box that only includes (for example) the following phrase : TOTAL = 60 Thanks a lot. >Solution : You could create an annotation… Read More adding a simple legend that includes a chosen text using ggplot

How to generate a random number with the amount of digits, the user enters?

I’m making a small math program for practice purposes. The user is supposed to enter, how many digits the two summands should have. I did this as shown below: import random digits = int(input(“How many digits should the numbers have? “)) if digits == 1: while True: num1 = random.randint(0,9) num2 = random.randint(0,9) solution =… Read More How to generate a random number with the amount of digits, the user enters?