Saturday, December 30, 2017

How to Multiplots on Same Canvas using Matplotlib

Subplot function can be used to plot multiple graphs in same canvas.

Case 1:- Create graph in same ROW

import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
x = np.linspace(0, 5, 11)
y = x ** 2
#Instantiate figure and axes object. 
#fig, ax = plt.subplots()
# bydefualt on not passing any parameters in constructor, Just a figure and one subplot
f, ax = plt.subplots(nrows=1, ncols=2)
ax[0].plot(x, y)
ax[0].set_title('Simple plot')

ax[1].plot(y, x)
ax[1].set_title('Simple plot')

Case 2:- Create graph in same Column

import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
x = np.linspace(0, 5, 11)
y = x ** 2
#Instantiate figure and axes object. 
#fig, ax = plt.subplots()
# bydefualt on not passing any parameters in constructor, Just a figure and one subplot
f, ax = plt.subplots(nrows=2, ncols=1)
ax[0].plot(x, y)
ax[0].set_title('Simple1 plot')

ax[1].plot(y, x)
ax[1].set_title('Simple2 plot')

Matplotlib/subplot/python Syntax and Analysis “fig, ax = plt.subplots()”

The Matplotlib subplot() function can be called to plot two or more plots in one figure. Matplotlib supports all kind of subplots including 2×1 vertical, 2×1 horizontal or a 2×2 grid.

# Import required library
import matplotlib.pyplot as plt
import numpy as np

#First create some toy data:
x = np.linspace(0, 5, 11)
y = x ** 2

#Instantiate figure and axes object. 
# bydefualt on not passing any parameters in constructor, Just a figure and one subplot
fig, ax = plt.subplots()
#Set Data
ax.plot(x, y)
#Set Title for the graph
ax.set_title('Simple plot')

Analysis of used code

#Instantiate figure and axes object. 
fig, ax = plt.subplots()

Important feature of the below code is we are using 2 variables for assignment on instantiation of object.


plt.subplots() is a function that returns a tuple containing a figure and axes object(s). Thus when using fig, ax = plt.subplots() you unpack this tuple into the variables fig and ax.Thus this can also be read as 2 below statement combined as one.

fig = plt.figure()
ax = fig.add_subplot(111)

f : matplotlib.figure.Figure object

ax : Axes object or array of Axes objects.

ax can be either a single  matplotlib.axes.Axes object or an array of Axes objects if more than one subplot was created. The dimensions of the resulting array can be controlled with the squeeze keyword, see above.

Thursday, December 28, 2017

List of Keywords in Python

Keywords are the reserved words in Python. We cannot use a keyword as variable name, function name or any other identifier.

Here's a list of all keywords in Python Programming

Keywords in Python programming language

Python : Built-in Functions

Method Description
Python abs() returns absolute value of a number
Python all() returns true when all elements in iterable is true
Python any() Checks if any Element of an Iterable is True
Python ascii() Returns String Containing Printable Representation
Python bin() converts integer to binary string
Python bool() Coverts a Value to Boolean
Python bytearray() returns array of given byte size
Python bytes() returns immutable bytes object
Python callable() Checks if the Object is Callable
Python chr() Returns a Character (a string) from an Integer
Python classmethod() returns class method for given function
Python compile() Returns a Python code object
Python complex() Creates a Complex Number
Python delattr() Deletes Attribute From the Object
Python dict() Creates a Dictionary
Python dir() Tries to Return Attributes of Object
Python divmod() Returns a Tuple of Quotient and Remainder
Python enumerate() Returns an Enumerate Object
Python eval() Runs Python Code Within Program
Python exec() Executes Dynamically Created Program
Python filter() constructs iterator from elements which are true
Python float() returns floating point number from number, string
Python format() returns formatted representation of a value
Python frozenset() returns immutable frozenset object
Python getattr() returns value of named attribute of an object
Python globals() returns dictionary of current global symbol table
Python hasattr() returns whether object has named attribute
Python hash() returns hash value of an object
Python help() Invokes the built-in Help System
Python hex() Converts to Integer to Hexadecimal
Python id() Returns Identify of an Object
Python input() reads and returns a line of string
Python int() returns integer from a number or string
Python isinstance() Checks if a Object is an Instance of Class
Python issubclass() Checks if a Object is Subclass of a Class
Python iter() returns iterator for an object
Python len() Returns Length of an Object
Python list() Function creates list in Python
Python locals() returns dictionary of current local symbol table
Python map() Applies Function and Returns a List
Python max() returns largest element
Python memoryview() returns memory view of an argument
Python min() returns smallest element
Python next() Retrieves Next Element from Iterator
Python object() Creates a Featureless Object
Python oct() converts integer to octal
Python open() Returns a File object
Python ord() returns Unicode code point for Unicode character
Python pow() returns x to the power of y
Python print() Prints the Given Object
Python property() returns a property attribute
Python range() return sequence of integers between start and stop
Python repr() returns printable representation of an object
Python reversed() returns reversed iterator of a sequence
Python round() rounds a floating point number to ndigits places.
Python set() returns a Python set
Python setattr() sets value of an attribute of object
Python slice() creates a slice object specified by range()
Python sorted() returns sorted list from a given iterable
Python staticmethod() creates static method from a function
Python str() returns informal representation of an object
Python sum() Add items of an Iterable
Python super() Allow you to Refer Parent Class by super
Python tuple() Function Creates a Tuple
Python type() Returns Type of an Object
Python vars() Returns __dict__ attribute of a class
Python zip() Returns an Iterator of Tuples
Python __import__() Advanced Function Called by import

Friday, May 16, 2014

Released Magento 1.9 Wait for Magento 1.9.1

2 Days back Magento released  has Community Edition 1.9. This is a major release after 1.8.1. Same as every other major release, Magento 1.9 has also under gone major changes. Following are highlights of this release are

Magento 1.9 Screenshot with demo data
  • Less Time and Less Cost to Get a Responsive Site
  • Cross Border Price Consistency
  • Improved Payment and Financing Options
  • Fresher Search Results for Customers and Faster Indexing for Merchants
  • Cross Border Price Consistency
  • Improved Quality and More Features

Wait for Magento 1.9.1

Historically Magento 1.x.0 version has always been vulnerable. And to plug-in the issues, magneto has always released 1.x.1 release in next 60 days. Historically 1.x.1 version has been one there most stable releases. Going by track record, I suggest users to avoid using magento 1.9 for production as upgrade or as a fresh installation. And its more interesting to observe that magento has release Magento CE Version within 2 days of release of 1.9 version. 
After major release wait for bugs to be fixed. 

Monday, April 21, 2014

Modi and BJP IT Cell Exposed : They Vote at 2am

Its long time that people have been saying Indian Politicians  presence on Facebook and Tweeter is FAKE. Number like 1 Million Likes 2 Million likes are just illusive. When an Indian Leader is famous in Istanbul but not in state which he represents in Parliament then that person should be considered as a person having good IT cell.

Vote for 2014 TIME 100 

There is an on going Voting on for Top 100 impact-full persons. The voting is going on for last 4-5 days. And till yesterday, Narendra Modi was not even in Top 20. And His bitter rival was on top. And every body was surprised that how come till now Modi's IT cell didn't WakeUP. Last night they wokeup.

Sleeping Indians voted for MODI for 2 mins

Last night when India was sleeping Modi was getting votes on And in less than 2 mins times Modi got vote to break into top 10. But unfortunately, this time BJP's media cell caught red handed. 2 people have made the video. Last night he was the only person who was voted 100 yes per second in entire voting.

The real Desperate and Lost Modi

This really highlights the desperation of Modi. This really highlights and exemplify as how Narandra Modi had created his so called FAKE WAVE.   This exemplifies that its him who is creating this all popularity propaganda. And the reality is he is yet to earn the popularity that is claiming.


I hope this will be a good waking call for my fellow Indians. Hope they will think sensibly on their own. Time for WAKE UP.

Thursday, April 17, 2014

Modi's BJP and Baba Ramdev Exposed

This time Modi's Candidate Mahant Chand Nath(ALWAR) and Baba ramdev has gone exposed. Both have been caught on camera talking in a slow pitched volume about difficulty in taking money for election. Certainly when they talk about money it was BLACK money. The Yoga guru is heard carefully whispering to Nath to not talk about all this here as they were surrounded with cameras and recorders which can record their conversation.

While press conference, media person sought clarification on the context of recorded text. But in reply both of they denied any such talks. They went on to say that, this could Media people's rumors/confusions.After the reply they had a nervous smiles on their innocent face. Unfortunately, none of the media house expect few raised their voice as this season most of them are hugely funded by the Modi's people. 

Baba the lone Black money fighter : Time for reality check

For last three years baba Ramdev has always projected himself a lone fighter against Black money.
He started his journey being an apolitical activist who want to clean India. Then Quietly he started "Bharat Swabhiman Party". But Head on directly with Congress exposed his Black asset . This resulted quashing of his Political ambitions. Even though his ambitions were quashed miserably but he later found Modi as path to fulfill his ambitions.

AK has always spotted Rotten Egg WELL

Just after Ram leela madian incident, Anti corruption movement happened. Again he tried to get political mileage out of it. It was AK who spotted his ambitions and proactively denied his participation. Till that time nothing was out. Till that time he was never spotted so aggressively with political parties. But AK spotted  the rotten egg and showed the door. And now any common man can judge baba Ramdev Act.


After the firm evidence of their BJP candidate is out, I hope Alwar will Wake up and will vote for Clean Politics.

Saturday, April 12, 2014

Review : Bangalore

This is  2 months pending work. This Review is about Washing Machine Clinic, Bangalore ( 

I had a pathetic experience from Previous to actual experience I was told about their prompt and efficient service. So I decided to call them.

Got attended after number of follow up

I called them in one evening for the appointment. And I got appointment for next day. But unfortunately nobody turned up. But after a number of follow up it got attended next day.

Very High and Random charges

The person came  to my place and examined the washing machine. Immediately after examination, the person told me motor is damaged and needs to be changed. He quoted Rs 4,200.  I was confused, that the company is supposed to service all kind of washing machine and they deal with several part. How come the person knows exact price of the part? How come he told me price without consulting any paper or person. 

Going by logic that the price of machine is Rs 10,000. So how can only part be of Rs 4,200 I opted NOT to go for the service.

Next day I called Godrej service center. And I got my machine repaired in only Rs 2,400. Rs 1,800 less from what Washing Machine clinic quoted.

Always eager to change parts

In another experience of my friends, they called for the appointment.  They explained the problem. Surprisingly, at the same moment,  on same call,  they suggested one of part to get replaced. My friend was very surprised to hear that. The person is suggesting diagnosis without even examining. Later on he got it repaired WITHOUT any replacement of the said part from some other mechanic.


After my and my friend experience I would highly recommend NOT to go for the service. Instead, I would recommend to opt for either Company customer service or any near by mechanic. 

Thursday, April 10, 2014

Congress = BJP : ND Tiwari at 89 "Papa", Modi at 63 "Pati"

Time and again we prove that in every aspect BJP = Congress. Again and Again we repeat, its just 2 different name but same people. Faces are different but their Intended are same. Flags are different but behavior is same.

At Age of 89 ND Tiwari became Father

On June 28, 2012, In one the strange cases ND Tiwari lost the case and proved the biological father of  32 year old Rohit Sharma. In 2008,Shekhar filed paternity suit. He tried all option to delay the case. For a long time he resisted giving his blood for the DNA test and later tried to block the report being made public.The DNA test results released by the court on Friday, 27 July 2012 established that Tiwari is the biological father of Rohit Shekhar, in the DNA test it was proved that N D Tiwari is the biological father of Rohit Shekhar and Ujjwala Sharma is his biological mother. And On March 3,2014 Tiwari accepted that Rohit was his son. He said "I have accepted that Rohit Shekhar is my son. The DNA test also proved he is my biological son," the 89-year-old was quoted as telling NDTV

At Age of 63 Modi's Martial status changed from "Single" to "Married" 
Modi in Affidavit for 2007 Election, in the form where he was required to write spouse name, he left blank. 
 In 2012, He again left it blank. 

In 2014, after 15 months, he declared himself married and  Jashodaben as his wife. 

Why people questioning personal questions?
During discussion, many BJP supporters argued that its his personal life. And one should not be questioning his personal life.Questions should be on  his work. Questions should be on  his promises.Questions should be on  his delivery of promises. And to extent they are right but it becomes a very serious matter you start promising people sighting your past. And Caught red handed. 

Modi, as public figure, is accountable for all matters on which he chooses to speak. Even if its his personal life. Because its him who has started the discussion. And public have full right to put those words, facts on trail till their establishment or conclusive END. 

Saturday, April 5, 2014

Part 2: Is Modi Coward? Modi vs Party Manifesto?

Finally we are touch away from Election 2014. Parties putting all the blocks in right place for the fight. Putting strategies for connection with people on ground level. Communicating their plans for development. In same course release Manifesto is one of the important activity.

What is Manifesto?

From dictionary:-
manifesto (ˌmænɪˈfɛstəʊ)
npl -tos or -toes
1. (Government, Politics & Diplomacy) a public declaration of intent, policy, aims, etc, as issued by a political party, government, or movement

Form Wiki
manifesto is a published verbal declaration of the intentions, motives, or views of the issuer, be it an individual, group, political party or governmen

In short, its a written public declaration of the intentions, motives or views of the issuer, be it an individual, group or political party.

So going by definition, Manifesto is considered as documented promises which can be used to make part accountable for the work if voted in. It can be used as Bible by public for accountability.In 21st century, during elections, Parties promises of greater public accountability. And keeping in view releases their Election Manifesto well before election.

Why BJP releasing Manifesto after 1st Poll Day?

When Manifesto is considered as a "Written Promise", why BJP is release after first poll day? BJP is releasing their Manifesto on 7th April. On same day, 2 states will have polls in 6 constituencies. The states are Assam, Tripura. Does this mean, people from 6 constituencies will not have any written promises from BJP, the party, which says INDIA FIRST.Why those people don't have right to know their intentions? their vision?


During 2012 state election, when Modi was not bigger than BJP, BJP released their Manifesto 10 days before the polling. If they want to bring same Development model to national level then why they are afraid of releasing the manifesto at last minute?

BJP says "Ghat Ghar Modi" but why not manifesto? I remember when Modi used to deliver speeches during State elections, he always talked about development. When manifesto is written document of their plans/vision for National development, then why BJP does want to make MODI to reach every house but NOT the vision document?


Even if we exempt the delay of release, then next question arises, Why they are releasing the  Manifesto when there is known offiical blackout? Electronic Media can not telecast manifesto because Section 126(1) of the RP Act bans "public display of election matter by means of cinematograph, television or other similar apparatus" during 48 hours prior to the end of polling and Election Manifesto comes under election matter.

Initially I though its a BJP's Planning miscalculation. But I was proved wrong When I heard the official statement from BJP. According to then, they are releasing the document according to their plan.


In 21st century, electronic media is considered as the fastest medium of communication. Then why BJP don't want use the same medium to communicate their Ideas for development to people? Do BJP give top priority to MODI then thier plan to for India Development? Is India first is a goof up?

Part 1: Is Modi coward or BETRAYER? Fighting from 2 seats?