Home » Python » Python programs

# Python program for plotting in same and different graph

In this segment, we are going to take one step further in pylab library to explore **how to plot two data in same graph and as well as in different graphs?**

Submitted by Anuj Singh, on June 24, 2019

In many cases, we need to compare the data of two different sources visually and then plotting in the same graph will help us out. But when we need to study differently then we must plot them on different graphs.

So here is the code:

import pylab as pl #PLOTTING IN SAPERATE GRAPH pl.figure(1) pl.plot([1,2,3], [1,2,3,]) #PLOTTING IN SAPERATE GRAPH pl.figure(2) pl.plot([1,3,2,4], [4,5,6,7]) pl.figure(3) #PLOTTING IN SAME GRAPH pl.plot([1,2,3,4,5,6,7,8], [5,6,5,4,6,4,5,7]) #PLOTTING IN SAME GRAPH pl.plot([1,2,3,4,5,6,7,8], [5,6,7,9,9,5,7,6])

**Output:**

TOP Interview Coding Problems/Challenges

- Run-length encoding (find/print frequency of letters in a string)
- Sort an array of 0's, 1's and 2's in linear time complexity
- Checking Anagrams (check whether two string is anagrams or not)
- Relative sorting algorithm
- Finding subarray with given sum
- Find the level in a binary tree with given sum K
- Check whether a Binary Tree is BST (Binary Search Tree) or not
- 1[0]1 Pattern Count
- Capitalize first and last letter of each word in a line
- Print vertical sum of a binary tree
- Print Boundary Sum of a Binary Tree
- Reverse a single linked list
- Greedy Strategy to solve major algorithm problems
- Job sequencing problem
- Root to leaf Path Sum
- Exit Point in a Matrix
- Find length of loop in a linked list
- Toppers of Class
- Print All Nodes that don't have Sibling
- Transform to Sum Tree
- Shortest Source to Destination Path

Comments and Discussions

**Ad:**
Are you a blogger? Join our Blogging forum.

Learn PCB Designing: PCB DESIGNING TUTORIAL