Learn Coordinate Geometry

Learning Coordinate Geometry

Series: Python for kids

In our endavor to make learning fun and free of memorization, we have been using Python to allow children to experiment and analyze data to form their own opinion and discover facts. This way, children engage is learning process with more intensity and the they show higher retention rate vis a vis conventional learning.

This makes them think and try different things before they get it right. The focus shifts from being always 'right' to get it right after several failed attempts.

In this part of the series

Children create simple shapes using markers, move marker left, right , top and bottom. They learn coordinates geometry where the position of points on the plane.

They learn how to plot different type of shapes with simple marker shapes.

We also make sure that we don't use loop or variables that may make things difficult to follow.

Import module

In [1]:
import matplotlib.pyplot as plt

Draw a star at 0, 0

In [2]:
plt.plot( 0, 0, marker='*')
Out[2]:
[<matplotlib.lines.Line2D at 0x7f2b1597c210>]

Draw bigger star in red color at same place

In [3]:
plt.plot( 0, 0, marker='*', color='red', markersize = 30)
Out[3]:
[<matplotlib.lines.Line2D at 0x7f2b158eed90>]

Draw another star on the right side any where

In [4]:
plt.plot( 0, 0, marker='*', color='red', markersize = 30)
plt.plot( 2, 0, marker='*', color='blue', markersize = 30)
Out[4]:
[<matplotlib.lines.Line2D at 0x7f2b15869690>]

Draw another star on the left side any where

In [5]:
plt.plot( 0, 0, marker='*', color='red', markersize = 30)
plt.plot( 2, 0, marker='*', color='blue', markersize = 30)
plt.plot( -2, 0, marker='*', color='green', markersize = 30)
Out[5]:
[<matplotlib.lines.Line2D at 0x7f2b157e5b50>]

Draw new yellow color star at the top of green star

In [6]:
plt.plot( 0, 0, marker='*', color='red', markersize = 30)
plt.plot( 2, 0, marker='*', color='blue', markersize = 30)
plt.plot( -2, 0, marker='*', color='green', markersize = 30)
plt.plot( -2, 2, marker='*', color='yellow', markersize = 30)
Out[6]:
[<matplotlib.lines.Line2D at 0x7f2b1576a290>]

Move a red star below to green star

In [7]:
plt.plot( -2, -2, marker='*', color='red', markersize = 30)
plt.plot( 2, 0, marker='*', color='blue', markersize = 30)
plt.plot( -2, 0, marker='*', color='green', markersize = 30)
plt.plot( -2, 2, marker='*', color='yellow', markersize = 30)
Out[7]:
[<matplotlib.lines.Line2D at 0x7f2b15671410>]

Draw a small purple circle at the top of right corner

In [8]:
plt.plot( -2, -2, marker='*', color='red', markersize = 30)
plt.plot( 2, 0, marker='*', color='blue', markersize = 30)
plt.plot( -2, 0, marker='*', color='green', markersize = 30)
plt.plot( -2, 2, marker='*', color='yellow', markersize = 30)
plt.plot( 2, 2, marker='o', color='purple', markersize = 20)
Out[8]:
[<matplotlib.lines.Line2D at 0x7f2b155f8b90>]

Draw a square at right bottom corner

In [9]:
plt.plot( -2, -2, marker='*', color='red', markersize = 30)
plt.plot( 2, 0, marker='*', color='blue', markersize = 30)
plt.plot( -2, 0, marker='*', color='green', markersize = 30)
plt.plot( -2, 2, marker='*', color='yellow', markersize = 30)
plt.plot( 2, 2, marker='o', color='purple', markersize = 20)
plt.plot( 2, -2, marker='o', color='green', markersize = 20)
Out[9]:
[<matplotlib.lines.Line2D at 0x7f2b1558d850>]

Draw a triangle in the center

In [10]:
plt.plot( -2, -2, marker='*', color='red', markersize = 30)
plt.plot( 2, 0, marker='*', color='blue', markersize = 30)
plt.plot( -2, 0, marker='*', color='green', markersize = 30)
plt.plot( -2, 2, marker='*', color='yellow', markersize = 30)
plt.plot( 2, 2, marker='o', color='purple', markersize = 20)
plt.plot( 2, -2, marker='o', color='green', markersize = 20)
plt.plot( 0, 0, marker='^', color='grey', markersize = 20)
Out[10]:
[<matplotlib.lines.Line2D at 0x7f2b1551dd10>]

Move all shapes in diagonally

In [11]:
plt.plot( 0, 0, marker='^', color='grey', markersize = 20)

plt.plot( -0.5, -0.5, marker='*', color='pink', markersize = 30)
plt.plot( -1, -1, marker='*', color='yellow', markersize = 30)
plt.plot( -1.5, -1.5, marker='*', color='green', markersize = 30)
plt.plot( -2, -2, marker='*', color='red', markersize = 30)


plt.plot( 0.5, 0.5, marker='o', color='green', markersize = 20)
plt.plot( 1, 1, marker='*', color='blue', markersize = 30)
plt.plot( 1.5, 1.5, marker='*', color='red', markersize = 30)
plt.plot( 2, 2, marker='o', color='purple', markersize = 20)
Out[11]:
[<matplotlib.lines.Line2D at 0x7f2b15438f50>]

Create triangle pattern

In [12]:
plt.plot( 0, 0, marker='^', color='grey', markersize = 20)

plt.plot( -0.5, -0.5, marker='*', color='pink', markersize = 30)
plt.plot( -1, -1, marker='*', color='yellow', markersize = 30)
plt.plot( -1.5, -1.5, marker='*', color='green', markersize = 30)
plt.plot( -2, -2, marker='*', color='red', markersize = 30)


plt.plot( 0.5, 0.5, marker='o', color='green', markersize = 20)
plt.plot( 1, 1, marker='*', color='blue', markersize = 30)
plt.plot( 1.5, 1.5, marker='*', color='red', markersize = 30)
plt.plot( 2, 2, marker='o', color='purple', markersize = 20)


plt.plot( 2, 1, marker='*', color='lightgreen', markersize = 30)
plt.plot( 2, 0, marker='*', color='blue', markersize = 30)
plt.plot( 2, -1, marker='*', color='purple', markersize = 30)
plt.plot( 2, -2, marker='*', color='yellow', markersize = 30)



plt.plot( -1, -2, marker='*', color='lightgreen', markersize = 30)
plt.plot( 0, -2, marker='*', color='blue', markersize = 30)
plt.plot( 1, -2, marker='*', color='purple', markersize = 30)
Out[12]:
[<matplotlib.lines.Line2D at 0x7f2b15379450>]

Create a kite

In [18]:
plt.plot( 0, 0, marker='*', color='grey', markersize = 20)

plt.plot( 0, -5, marker='*', color='red', markersize = 20)
plt.plot( 0, 5, marker='*', color='blue', markersize = 20)
plt.plot( 5, 0, marker='*', color='green', markersize = 20)
plt.plot( -5, 0, marker='*', color='green', markersize = 20)

plt.plot( -2.5, -2.5, marker='*', color='blue', markersize = 20)
plt.plot( -2.5, 2.5, marker='*', color='red', markersize = 20)
plt.plot( 2.5, 2.5, marker='*', color='red', markersize = 20)
plt.plot( 2.5, -2.5, marker='*', color='blue', markersize = 20)

plt.plot( 0, -6.5, marker='^', color='pink', markersize = 5)
plt.plot( 0, -7.5, marker='^', color='pink', markersize = 5)
plt.plot( 0, -8.5, marker='^', color='pink', markersize = 5)
plt.plot( 0, -9.5, marker='^', color='pink', markersize = 5)
plt.plot( 0, -10.5, marker='^', color='pink', markersize = 5)
plt.plot( 0, -11.5, marker='^', color='pink', markersize = 5)
plt.plot( 0, -12.5, marker='^', color='pink', markersize = 5)


plt.xlim(-15, 15)
plt.ylim(-15, 15)
Out[18]:
(-15.0, 15.0)
In [19]:
#horizontal line at center
plt.plot( -7.5, 0, marker='*', color='green', markersize = 10)
plt.plot( -5, 0, marker='*', color='green', markersize = 10)
plt.plot( -2.5, 0, marker='*', color='green', markersize = 10)
plt.plot( 0, 0, marker='*', color='red', markersize = 10)
plt.plot( 2.5, 0, marker='*', color='green', markersize = 10)
plt.plot( 5, 0, marker='*', color='green', markersize = 10)
plt.plot( 7.5, 0, marker='*', color='green', markersize = 10)

#horizontal line at above center
plt.plot( -6.0, +2.5, marker='*', color='green', markersize = 10)
plt.plot( -3.75, +2.5, marker='*', color='green', markersize = 10)
plt.plot( -1.25, +2.5, marker='*', color='green', markersize = 10)
plt.plot( 1.25, +2.5, marker='*', color='green', markersize = 10)
plt.plot( 3.75, +2.5, marker='*', color='green', markersize = 10)
plt.plot( 6.0, +2.5, marker='*', color='green', markersize = 10)


#horizontal line at one below center
plt.plot( -6.0, -2.5, marker='*', color='green', markersize = 10)
plt.plot( -3.75, -2.5, marker='*', color='green', markersize = 10)
plt.plot( -1.25, -2.5, marker='*', color='green', markersize = 10)
plt.plot( 1.25, -2.5, marker='*', color='green', markersize = 10)
plt.plot( 3.75, -2.5, marker='*', color='green', markersize = 10)
plt.plot( 6.0, -2.5, marker='*', color='green', markersize = 10)


#horizontal line at two rows above center
plt.plot( -5, 5, marker='*', color='green', markersize = 10)
plt.plot( -2.5, 5, marker='*', color='green', markersize = 10)
plt.plot( 0, 5, marker='*', color='green', markersize = 10)
plt.plot( 2.5, 5, marker='*', color='green', markersize = 10)
plt.plot( 5, 5, marker='*', color='green', markersize = 10)

#horizontal line at two rows below center
plt.plot( -5, -5, marker='*', color='green', markersize = 10)
plt.plot( -2.5, -5, marker='*', color='green', markersize = 10)
plt.plot( 0, -5, marker='*', color='green', markersize = 10)
plt.plot( 2.5, -5, marker='*', color='green', markersize = 10)
plt.plot( 5, -5, marker='*', color='green', markersize = 10)


#horizontal line at three rows above center
plt.plot( -3.75, +7.5, marker='*', color='green', markersize = 10)
plt.plot( -1.25, +7.5, marker='*', color='green', markersize = 10)
plt.plot( 1.25, +7.5, marker='*', color='green', markersize = 10)
plt.plot( 3.75, +7.5, marker='*', color='green', markersize = 10)

#horizontal line at three rows below center
plt.plot( -3.75, -7.5, marker='*', color='green', markersize = 10)
plt.plot( -1.25, -7.5, marker='*', color='green', markersize = 10)
plt.plot( 1.25, -7.5, marker='*', color='green', markersize = 10)
plt.plot( 3.75, -7.5, marker='*', color='green', markersize = 10)


#horizontal line at four rows above center
plt.plot( -2.5, 10, marker='*', color='green', markersize = 10)
plt.plot( 0, 10, marker='*', color='green', markersize = 10)
plt.plot( 2.5, 10, marker='*', color='green', markersize = 10)

#horizontal line at four rows below center
plt.plot( -2.5, -10, marker='*', color='green', markersize = 10)
plt.plot( 0, -10, marker='*', color='green', markersize = 10)
plt.plot( 2.5, -10, marker='*', color='green', markersize = 10)

#horizontal line at five rows above center
plt.plot( -1.25, +12.5, marker='*', color='green', markersize = 10)
plt.plot( 1.25, +12.5, marker='*', color='green', markersize = 10)

#horizontal line at five rows below center
plt.plot( -1.25, -12.5, marker='*', color='green', markersize = 10)
plt.plot( 1.25, -12.5, marker='*', color='green', markersize = 10)

#horizontal line at top
plt.plot( 0, 15, marker='*', color='green', markersize = 10)

#horizontal line at bottom
plt.plot( 0, -15, marker='*', color='green', markersize = 10)


plt.xlim(-20, 20)
plt.ylim(-20, 20)
Out[19]:
(-20.0, 20.0)
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 

Machine Learning

  1. Deal Banking Marketing Campaign Dataset With Machine Learning

TensorFlow

  1. Difference Between Scalar, Vector, Matrix and Tensor
  2. TensorFlow Deep Learning Model With IRIS Dataset
  3. Sequence to Sequence Learning With Neural Networks To Perform Number Addition
  4. Image Classification Model MobileNet V2 from TensorFlow Hub
  5. Step by Step Intent Recognition With BERT
  6. Sentiment Analysis for Hotel Reviews With NLTK and Keras
  7. Simple Sequence Prediction With LSTM
  8. Image Classification With ResNet50 Model
  9. Predict Amazon Inc Stock Price with Machine Learning
  10. Predict Diabetes With Machine Learning Algorithms
  11. TensorFlow Build Custom Convolutional Neural Network With MNIST Dataset
  12. Deal Banking Marketing Campaign Dataset With Machine Learning

PySpark

  1. How to Parallelize and Distribute Collection in PySpark
  2. Role of StringIndexer and Pipelines in PySpark ML Feature - Part 1
  3. Role of OneHotEncoder and Pipelines in PySpark ML Feature - Part 2
  4. Feature Transformer VectorAssembler in PySpark ML Feature - Part 3
  5. Logistic Regression in PySpark (ML Feature) with Breast Cancer Data Set

PyTorch

  1. Build the Neural Network with PyTorch
  2. Image Classification with PyTorch
  3. Twitter Sentiment Classification In PyTorch
  4. Training an Image Classifier in Pytorch

Natural Language Processing

  1. Spelling Correction Of The Text Data In Natural Language Processing
  2. Handling Text For Machine Learning
  3. Extracting Text From PDF File in Python Using PyPDF2
  4. How to Collect Data Using Twitter API V2 For Natural Language Processing
  5. Converting Text to Features in Natural Language Processing
  6. Extract A Noun Phrase For A Sentence In Natural Language Processing