- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 1162 Articles
Rishikesh Kumar Rishi
2K+ Views
To show logarithmically spaced grid lines at all ticks on a log-log plot using matplotlib, we can take the following steps−Create data points for x and y using numpy.Using loglog method, make a plot with log scaling on both the X and Y axis.Use grid() method, lay out a grid ... Read More
Rishikesh Kumar Rishi
500 Views
To set a value for color bar on Seaborn heatmap, we can take following Steps−Create random data using numpy.Use heatmap() method to plot rectangular data as a color-encoded matrix.To display the figure, use show() method.Exampleimport numpy as np import seaborn as sns from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = ... Read More
Rishikesh Kumar Rishi
2K+ Views
To draw arrow heads vectors in 3D matplotlb's plot, we can take the following steps −Create a 2D array, where x, y, z, u, v and w are the coordinates of the arrow locations and direction components of arrow vectors.Using figure() method, create a new figure or activate an existing figure.Add an '~.axes.Axes' to ... Read More
Rishikesh Kumar Rishi
2K+ Views
To remove the X-ticks while keeping the grids, we can take the following steps−Use gca() method to get the current axes, creating one if necessary.Plot the x and np.sin(x) using plot() method with linewidth=5, label y=sin(x).Remove yticks and xticks by passing empty array in the argument of set_xticklabels and set_yticklabels ... Read More
Rishikesh Kumar Rishi
822 Views
To plot a transparent histogram with non-transparent edge, we can take the following steps−Create a set of random data points (y).Initialize the number of bins to be drawn.To plot the histogram, we can use hist() method with edge color and facecolor tuplesTo display the figure, use show() method.Exampleimport numpy as ... Read More
Rishikesh Kumar Rishi
15K+ Views
To extract csv file for specific columns to list in Python, we can use Pandas read_csv() method.StepsMake a list of columns that have to be extracted.Use read_csv() method to extract the csv file into data frame.Print the exracted data.Plot the data frame using plot() method.To display the figure, use show() method.Exampleimport pandas as ... Read More
Rishikesh Kumar Rishi
3K+ Views
To make a log histogram, we can use log=True in the argument of the hist() method.StepsMake a list of numbers.Plot a histogram with density=True.To display the figure, use show() method.Exampleimport numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True k = np.array([5, 5, 5, 5]) x, bins, ... Read More
Rishikesh Kumar Rishi
6K+ Views
To shade the regions between curves, we can use the fill_between() method.StepsInitialize the variable n. Initiliize x and y data points using numpy.Create a figure and a set of subplots, fig and ax.Plot the curve using plot method.Use fill_between() method, fill the area between the two curves.To display the figure, use show() method.Exampleimport numpy as np ... Read More
Rishikesh Kumar Rishi
4K+ Views
To plot with arrows in matplotlib, we can use arrow() method.StepsCreate x and y data points using numpy.Plot x and y with color=red and linewidth = 1.Use arrow method to add an arrow to the axes. The first two values in the arguments are the coordinates of the arrow base ... Read More
Rishikesh Kumar Rishi
904 Views
To center an annotation horizontally over a point, we can take the following steps−Create points for x and y using numpy.Create labels using xpoints.Use scatter() method to scatter the points.Iterate labels, xpoints and ypoints and annotate the plot with label, x and y with different properties, make horizontal alignment ha=center.To ... Read More