About 34,400,000 results
Open links in new tab
  1. Draw any polygon in Turtle – Python - GeeksforGeeks

    Feb 10, 2020 · In this article, we will learn how to draw different shaped Polygons using Turtle module. Given the number of sides (n) and length of sides (l), one can easily draw any polygon shape. Let’s try to understand it better with the help of examples.

  2. tkinter - How to draw polygons with Python? - Stack Overflow

    May 15, 2017 · If you want to draw polygons on a matrix representing an image, scikit-image has 3 functions for you: skimage.draw.polygon2mask(image_shape, polygon) that directly returns a bool-type numpy.array where True means the point is inside the polygon.

  3. How to Draw Shapes in Matplotlib with Python - GeeksforGeeks

    Jul 22, 2024 · Drawing shapes in Matplotlib is simple and provides a wide range of options for creating and customizing displays. Using the Rectangle, Circle, and Polygon classes, you can add different shapes to your plots to help with data representation or visualization style.

  4. geometry - How do I draw a polygon in python? - Stack Overflow

    Jul 29, 2014 · The polygon they form is effectively an extremely flat triangle. Try varying one of the points so that it doesn't line up with the other two. pygame.draw.polygon(screen, black, [[300,400],[150,100],[450,300]],6)

  5. How do I plot Shapely polygons and objects using Matplotlib?

    Apr 29, 2019 · If you can get individual lists of the x and y coordinates for your polygon you can plot like: plt.plot(polygon_x,polygon_y). You'll also have to append the first elements to the end to get the final line drawn.

  6. Create different shapes using Canvas class in Tkinter – Python

    Apr 12, 2025 · Drawing Shapes on the Canvas. This Python code uses Tkinter to create a simple GUI that displays various shapes on a canvas. The Shape class defines methods to draw ovals, rectangles, arcs, and polygons using the Canvas widget. These shapes are customized with different colors and line widths.

  7. How To Draw A Shape In Python Using Turtle (Turtle ... - Python

    Jan 8, 2021 · To draw a polygon in python using turtle, we have to use the module called import turtle, and then we will use the for loop to print the code number of times. Here, the turtle will move forward by 100 units assuming the side of the polygon and then it turns towards the right by 40 degrees clockwise.

  8. How to Draw Different Shapes Using Tkinter - AskPython

    Jan 29, 2022 · 4. Polygon. We can draw as many vertices as we want. We use the create_polygon() method which takes coordinates of edges and renders them accordingly on our main window. In the below code we’ve created a list of coordinates and passed it into our create_polygon method.

  9. Shapes in Python - Plotly

    As a general rule, there are two ways to add shapes (lines or polygons) to figures: Trace types in the scatter family (e.g. scatter, scatter3d, scattergeo etc) can be drawn with mode="lines" and optionally support a fill="self" attribute, and so can be used to …

  10. How to create and plot polygons in python using shapely and

    Nov 15, 2023 · In this article, we will explore how to plot polygons in python using shapely library. Shapely is a python package for computational geometry which provides easy access to geometric objects such as points, lines, and polygons.

  11. Some results have been removed
Refresh