Dev Prakash Sharma has Published 548 Articles

How to customize spines of Matplotlib figures?

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 14:48:37

938 Views

When we plot a figure in Matplotlib, it creates four spines around the figure, top, left, bottom and right. Spines are nothing but a box surrounded with the pictorial representation of the grid which displays some ticks and tickable axes on left(y) and bottom(x).Let us see how to customize the ... Read More

How to customize the color and colormaps of a Plot in Matplotlib

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 14:47:58

610 Views

To customize the color and colormaps of a plot, we can use the colormap property from the color library. There are two types of colormap we can create: (a) discrete colormap and (b) continuous colormap.We will first see how to create a discrete colormap followed by continuous colormap.In the example, ... Read More

How to plot Time Zones in a map in Matplotlib

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 14:46:09

500 Views

Let us consider that we have some data in which we have to deal with the actual time. To plot the time-zones on the map, we can use the ‘cartopy’ or ‘metPy’ package in Python. However, we can install ‘cartopy’ package in the Anaconda environment using the commands, conda install ... Read More

Yen's k-Shortest Path Algorithm in Data Structure

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 06:35:29

2K+ Views

Instead of giving a single shortest path, Yen’s k-shortest path algorithm gives k shortest paths so that we can get the second shortest path and the third shortest path and so on.Let us consider a scenario that we have to travel from place A to place B and there are ... Read More

How to manage image resolution of a graph in Matplotlib

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 06:25:45

1K+ Views

An Image contains a 2-D matrix RGB data points which can be defined by the dots point per inch [ DPI ] of the image. The resolution of the image is important because a hi-resolution image will have much more clarity.We have a method ‘plt.savefig()’ in Matplotlib which determines the ... Read More

How to provide shadow effect in a Plot using path_effect attribute in Matplotlib

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 06:25:32

1K+ Views

In order to provide path effects like shadow effect in a plot or a graph, we can use the path_effect attribute.For example, let’s see how we can use the path_effect attribute in Matplotlib add a shadow effect to a sigmoid function.import matplotlib.pyplot as plt import numpy as np from matplotlib.patheffects ... Read More

How to plot with multiple color cycle using cycler property in Matplotlib

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 06:21:53

827 Views

Matplotlib has a default color cycle for all the graphs and plots, however, in order to draw plots with multiple color cycles, we can use the cycler property of Matplotlib. It is used to plot repetitive patterns for the axis.First, we will use the Object Oriented APIs such as pyplot ... Read More

How to plot Exponentially Decaying Function using FuncAnimation in Matplotlib

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 06:17:50

284 Views

Let us assume that we want to animate a nature of function which is exponentially decaying like y = a(b)^x where b = growth factor and a = initial value.An exponentially decay function would look like this, However, for now, we want to animate and plot the exponentially decaying tan ... Read More

How to create custom markers on a plot in Matplotlib

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 06:08:50

854 Views

To create a custom marker on a plot or graph, we use a list where we write the markers we want to see in the plot. The markers are nothing but symbols, emoji, character or any character which we want to see on the figure.In order to create the marker, ... Read More

Significance of regex match() and regex search() function in Python

Dev Prakash Sharma

Dev Prakash Sharma

Updated on 23-Feb-2021 05:50:24

623 Views

There are two types of operations that can be performed using regex, (a) search and (b) match. In order to use regex efficiently while finding the pattern and matching with the pattern, we can use these two functions.Let us consider that we have a string. regex match() checks the pattern ... Read More

Advertisements