代码如下: import turtle def main(): t = turtle.Turtle() t.hideturtle() lengthOfSize = 200 drawFivePointStar(t,0,0,lengthOfSize) def drawFivePointStar(t,x,y,lengthOfSize): t.up() t.goto(x,y) t.left(36) t.down() for i in range(5): t.forward(lengthOfSize) t
沉淀再出发:用python画各种图表 一.前言 最近需要用python来做一些统计和画图,因此做一些笔记. 二.python画各种图表 2.1.使用turtle来画图 import turtle as t #turtle库是python的内部库,直接import使用即可 import time def draw_diamond(turt): for i in range(1,3): turt.forward(100) #向前走100步 turt.right(45) #海龟头向右转45度 turt
转自:python画个小猪佩奇 # -*- coding: utf-8 -*- """ Created on Mon May 20 11:36:03 2019 @author: epsoft """ import turtle as t def nose(x,y):#鼻子 t.pu() t.goto(x,y) t.pd() t.seth(-30) t.begin_fill() a=0.4 for i in range(120): if 0<
用python画 pareto front 觉得有用的话,欢迎一起讨论相互学习~Follow Me 2D pf import os import matplotlib.pyplot as plt import numpy as np def Read_Files(filename): X_axis = [] # X Y_axis = [] # Y with open(filename, 'r') as f: for line in f.readlines(): x = line.split("
用python画一只佩奇 from turtle import* def nose(x,y):#鼻子 penup()#提起笔 goto(x,y)#定位 pendown()#落笔,开始画 setheading(-30)#将乌龟的方向设置为to_angle/为数字(0-东.90-北.180-西.270-南) begin_fill()#准备开始填充图形 a=0.4 for i in range(120): if 0<=i<30 or 60<=i<90: a=a+0.08 left(3)
使用Gizmos的DrawLine方法画线. 首先在场景中找到五角星的五个定点的坐标,按照一笔画的顺序命名为1,2,3,4,5,如图所示: 接下来就是编写代码了,代码很少,如下所示: using UnityEngine; using System.Collections; public class fiveStars : MonoBehaviour { public Transform[] fivePoints = new Transform[5]; // Use this for initia