Monday, 15 August 2022

Indian Flag using Python || हर घर तिरंगा || #azadikaamritmahotsav

INDIAN Flag in Python. All dimensions are as per our INDIAN standards. Let us know if you have any suggestions.




import numpy as np

import matplotlib.pyplot as py

import matplotlib.patches as patch

#Plotting the tri colours in national flag

a = patch.Rectangle((0,1), width=9, height=2, facecolor='#138808', edgecolor='grey')

b = patch.Rectangle((0,3), width=9, height=2, facecolor='#ffffff', edgecolor='grey')

c = patch.Rectangle((0,5), width=9, height=2, facecolor='#FF6103', edgecolor='grey')

m,n = py.subplots()

n.add_patch(a)

n.add_patch(b)

n.add_patch(c)

#AshokChakra Circle

radius=0.8

py.plot(4.5,4, marker = 'o', markerfacecolor = '#000080', markersize = 9.5)

chakra = py.Circle((4.5, 4), radius, color='#000080', fill=False, linewidth=7)

n.add_artist(chakra)

#24 spokes in AshokChakra

for i in range(0,24):

   p = 4.5 + radius/2 * np.cos(np.pi*i/9 + np.pi/48)

   q = 4.5 + radius/2 * np.cos(np.pi*i/9 - np.pi/48)

   r = 4 + radius/2 * np.sin(np.pi*i/9 + np.pi/48)

   s = 4 + radius/2 * np.sin(np.pi*i/9 - np.pi/48)

   t = 4.5 + radius * np.cos(np.pi*i/9)

   u = 4 + radius * np.sin(np.pi*i/9)

   n.add_patch(patch.Polygon([[4.5,4], [p,r], [t,u],[q,s]], fill=True, closed=True, color='#000080'))

py.axis('equal')

py.show() #clcoding.com






0 Comments:

Post a Comment

Popular Posts

Categories

AI (33) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (146) C (77) C# (12) C++ (82) Course (67) Coursera (198) Cybersecurity (24) data management (11) Data Science (106) Data Strucures (8) Deep Learning (13) Django (14) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flask (3) flutter (1) FPL (17) Google (21) Hadoop (3) HTML&CSS (47) IBM (25) IoT (1) IS (25) Java (93) Leet Code (4) Machine Learning (46) Meta (18) MICHIGAN (5) microsoft (4) Nvidia (1) Pandas (3) PHP (20) Projects (29) Python (893) Python Coding Challenge (285) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (2) Software (17) SQL (42) UX Research (1) web application (8)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses