Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Adding text to plot
#1
I am asked to plot a circle with user's input of radius, and display the area of the circle next to it on the plot. I know how to set up the whole thing but I don't know how to print on plot.
This is the code up till now:

import turtle
from math import pi
import math
r = float(input ("Input the radius of the circle : "))
print ("The area of the circle with radius " + str® + " is: " + str(pi * r**2))
turtle.circle®

I'm still a newbie and I'm taking a class in Python for the first time.
Quote
#2
Use something like this:

import turtle  # importing the module
from math import pi
radius=float(input("Enter radius of the circle: \n"))
area=pi*(radius**2)
trtl = turtle.Turtle()    #making a turtle object of Turtle class for drawing
trtl.pencolor('black')    #making colour of the pen red
trtl.speed(10)
trtl.circle(radius) 
turtle.exitonclick()
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  How to create a new plot in a figure right below the first one after click event? codexx 0 28 Yesterday, 04:45 PM
Last Post: codexx
  Split string into 160-character chunks while adding text to each part iambobbiekings 7 259 May-08-2019, 01:09 AM
Last Post: SheeppOSU
  Adding Variable kevinwoo00 4 212 Feb-18-2019, 04:51 PM
Last Post: perfringo
  Help adding items to a glossary lga13 2 255 Jan-08-2019, 06:39 AM
Last Post: perfringo
  How do I make my plot show up? ThomasM4 0 267 Dec-09-2018, 05:28 AM
Last Post: ThomasM4
  Tips on surface plot HW question Cwcox 1 330 Nov-14-2018, 11:45 PM
Last Post: Larz60+
  How to customize x axis in matplotlib.pyplot for a scatter plot? wlsa 9 670 Nov-10-2018, 01:32 AM
Last Post: wlsa
  Adding values to list and pickling mefiak 2 497 May-31-2018, 08:57 AM
Last Post: mefiak
  plot the mean in a bar diagram sussii 3 537 May-23-2018, 11:27 PM
Last Post: wavic
  How to plot date series in matplotlib? StrybolData 2 2,300 Jan-25-2018, 07:13 PM
Last Post: StrybolData

Forum Jump:


Users browsing this thread: 1 Guest(s)