
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Rishikesh Kumar Rishi has Published 1156 Articles

Rishikesh Kumar Rishi
264 Views
pylab is a module that imports matplotlib.pyplot (for plotting) and numpy (for mathematics and working with arrays) in a single namespace.Although many examples use pylab, it is no longer recommended. For non-interactive plotting, it is suggested to use pyplot to create the figures and then the OO interface for plotting.Exampleimport ... Read More

Rishikesh Kumar Rishi
5K+ Views
Using plt.figure() method, we can create a figure and thereafter, we can create an axis. Using set_xticks and set_yticks, we can change the ticks format and ax.grid could help to specify the grid interval.StepsCreate a new figure, or activate an existing figure, using fig = plt.figure() method.Add an `~.axes.Axes` to ... Read More

Rishikesh Kumar Rishi
9K+ Views
To get a linear regression plot, we can use sklearn’s Linear Regression class, and further, we can draw the scatter points.StepsGet x data using np.random.random((20, 1)). Return random floats in the half-open interval[20, 1).Get the y data using np.random.normal() method. Draw random samples from a normal (Gaussian) distribution.Get ordinary least ... Read More

Rishikesh Kumar Rishi
5K+ Views
First, we will create a polygon using the mplPath.Path method and to check whether a given point is in the polygon or not, we will use the method, poly_path.contains_point.StepsCreate a list of points to make the polygon.Create a new path with the given vertices and codes, using mplPath.Path().Check if point ... Read More

Rishikesh Kumar Rishi
4K+ Views
First, we can initialize an array matrix and pass it into the imshow method that can help to get the image for the given matrix.StepsCreate a 2D Array i.e., img.Using imshow() method, display the data as an image, i.e., on a 2D regular raster.Use plt.show() method to show the figure.Exampleimport ... Read More

Rishikesh Kumar Rishi
3K+ Views
To make a custom color, we can create a hexadecimal string. From it, we can make different sets of color representation and can pass into the scatter method to get the desired output.StepsTake an input from the user for the number of colors, i.e., number_of_colors = 20.Use Hexadecimal alphabets to ... Read More

Rishikesh Kumar Rishi
4K+ Views
To make a custom color, we can create a hexadecimal string. From it, we can make different sets of color representation and can pass them into the scatter method to get the desired output.Using the set_color method, we could set the color of the bar.StepsTake user input for the number ... Read More

Rishikesh Kumar Rishi
2K+ Views
We can override the backend value using atplotlib.rcParams['backend'] variable.StepsUsing get_backend() method, return the name of the current backend, i.e., default name.Now override the backend name.Using get_backend() method, return the name of the current backend, i.e., updated name.Exampleimport matplotlib print("Before, Backend used by matplotlib is: ", matplotlib.get_backend()) matplotlib.rcParams['backend'] = 'TkAgg' print("After, ... Read More

Rishikesh Kumar Rishi
552 Views
Using the subplot method, we can configure the number of rows and columns. nrows*nclos will create number positions to draw a diagram.StepsNumber of rows = 2, Number of columns = 1, so total locations are: 2*1 = 2.Add a subplot to the current figure, nrow = 2, ncols = 1, ... Read More

Rishikesh Kumar Rishi
560 Views
We can first activate the figure using plt.ion() method. Then, we can update the plot with different sets of values.StepsCreate fig and ax variables using subplots method, where default nrows and ncols are 1.Draw a line, using plot() method.Set the color of line, i.e., orange.Activate the interaction, using plt.ion() method.To ... Read More