Draw Graph Grid Using Turtle in Python Last Updated : 15 Jul, 2025 Comments Improve Suggest changes Like Article Like Report Prerequisite: Turtle Programming Basics Turtle is an inbuilt module in Python. It provides drawing using a screen (cardboard) and turtle (pen). To draw something on the screen, we need to move the turtle (pen). To move turtle, there are some functions i.e forward(), backward(), etc. Approach: Following steps are used : Import turtleSet screenMake turtleDraw the y-axis linesDraw the x-axis linesDraw the x-axis and y-axis with labeling. Below is the implementation : Python3 # import package and making objects import turtle sc=turtle.Screen() trtl=turtle.Turtle() # method to draw y-axis lines def drawy(val): # line trtl.forward(300) # set position trtl.up() trtl.setpos(val,300) trtl.down() # another line trtl.backward(300) # set position again trtl.up() trtl.setpos(val+10,0) trtl.down() # method to draw y-axis lines def drawx(val): # line trtl.forward(300) # set position trtl.up() trtl.setpos(300,val) trtl.down() # another line trtl.backward(300) # set position again trtl.up() trtl.setpos(0,val+10) trtl.down() # method to label the graph grid def lab(): # set position trtl.penup() trtl.setpos(155,155) trtl.pendown() # write 0 trtl.write(0,font=("Verdana", 12, "bold")) # set position again trtl.penup() trtl.setpos(290,155) trtl.pendown() # write x trtl.write("x",font=("Verdana", 12, "bold")) # set position again trtl.penup() trtl.setpos(155,290) trtl.pendown() # write y trtl.write("y",font=("Verdana", 12, "bold")) # Main Section # set screen sc.setup(800,800) # set turtle features trtl.speed(100) trtl.left(90) trtl.color('lightgreen') # y lines for i in range(30): drawy(10*(i+1)) # set position for x lines trtl.right(90) trtl.up() trtl.setpos(0,0) trtl.down() # x lines for i in range(30): drawx(10*(i+1)) # axis trtl.color('green') # set position for x axis trtl.up() trtl.setpos(0,150) trtl.down() # x-axis trtl.forward(300) # set position for y axis trtl.left(90) trtl.up() trtl.setpos(150,0) trtl.down() # y-axis trtl.forward(300) # labeling lab() # hide the turtle trtl.hideturtle() Output : Comment More infoAdvertise with us Next Article Must Coding Questions - Company-wise D deepanshu_rustagi Follow Improve Article Tags : Python Python-turtle Practice Tags : python Similar Reads Interview PreparationInterview Preparation For Software DevelopersMust Coding Questions - Company-wise Must Do Coding Questions - Topic-wiseCompany-wise Practice ProblemsCompany PreparationCompetitive ProgrammingSoftware Design-PatternsCompany-wise Interview ExperienceExperienced - Interview ExperiencesInternship - Interview ExperiencesPractice @GeeksforgeeksProblem of the DayTopic-wise PracticeDifficulty Level - SchoolDifficulty Level - BasicDifficulty Level - EasyDifficulty Level - MediumDifficulty Level - HardLeaderboard !!Explore More...Data StructuresArraysLinked ListStackQueueBinary TreeBinary Search TreeHeapHashingGraphAdvance Data StructuresMatrixStringAll Data StructuresAlgorithmsAnalysis of AlgorithmsSearching AlgorithmsSorting AlgorithmsPattern SearchingGeometric AlgorithmsMathematical AlgorithmsRandomized AlgorithmsGreedy AlgorithmsDynamic ProgrammingDivide & ConquerBacktrackingBranch & BoundAll AlgorithmsProgramming LanguagesCC++JavaPythonC#Go LangSQLPHPScalaPerlKotlinWeb TechnologiesHTMLCSSJavaScriptBootstrapTailwind CSSAngularJSReactJSjQueryNodeJSPHPWeb DesignWeb BrowserFile FormatsComputer Science SubjectsOperating SystemsDBMSComputer NetworkComputer Organization & ArchitectureTOCCompiler DesignDigital Elec. & Logic DesignSoftware EngineeringEngineering MathematicsData Science & MLComplete Data Science CourseData Science TutorialMachine Learning TutorialDeep Learning TutorialNLP TutorialMachine Learning ProjectsData Analysis TutorialTutorial LibraryPython TutorialDjango TutorialPandas TutorialKivy TutorialTkinter TutorialOpenCV TutorialSelenium TutorialGATE CSGATE CS NotesGate CornerPrevious Year GATE PapersLast Minute Notes (LMNs)Important Topic For GATE CSGATE CoursePrevious Year Paper: CS exams Like