Rishikesh Kumar Rishi has Published 1162 Articles

How to plot a wav file using Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Apr-2021 12:31:42

6K+ Views

To plot a .wav file using matplotlib, we can take following the steps −To read a .wav file, we can use the read() method.After reading the .wav file, we will get a tuple. At the 0 th index, rate would be there and at the 1st index, array sample data.Use ... Read More

Increase the distance between the title and the plot in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Apr-2021 12:31:23

4K+ Views

To increase the distance between the title and the plot in matplotlib, we can take the following steps −Create point x using numpy.Create point y using numpy sin.Set the title of the plot. After changing the value y (in argument), we can increase or decrease the distance between the title ... Read More

How do I write a Latex formula in the legend of a plot using Matplotlib inside a .py file?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Apr-2021 12:29:47

4K+ Views

LaTeX is a typesetting language for producing scientific documents. We use a very small part of the language for writing mathematical notation. Jupyter notebook recognizes LaTeX code written in markdown cells and renders the symbols in the browser using the MathJax JavaScript library.To write a LaTeX formula in the legend ... Read More

How to draw grid lines behind Matplotlib bar graph?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Apr-2021 12:29:26

2K+ Views

To draw grid lines behind matplotlib bar graph, we can take the following Steps −Make a list of numbers, i.e., data.Make a bar using the bar() method, by passing data, color='red' and alpha = 0.5. The alpha blending value should be between 0 (transparent) and 1 (opaque).To configure the grid ... Read More

Plot parallel coordinates in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Apr-2021 12:20:48

371 Views

To plot parallel coordinates, we can take the following Steps −Load dataset iris using Seaborn (Need internet).Pass the loaded data into the parallel_coordinates() method, which will help in parallel plotting.To display the figure, use the show() method.Exampleimport matplotlib.pyplot as plt from pandas.plotting import parallel_coordinates import seaborn as sns plt.rcParams["figure.figsize"] = [7.50, 3.50] ... Read More

How to hide in IPython notebook?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Apr-2021 12:20:28

315 Views

To hide matplotlib.lines.Line2D instance while calling the plot() method, we can take the following steps −Import numpy as np.From matplotlib, import pyplot as plt.Create points for x, i.e., np.linspace(1, 10, 1000)Now plot the line using the plot() method.To hide the instance, use plt.plot(x); (with semi colon)Or, use _ = plt.plot(x).ExampleIn ... Read More

Embedding small plots inside subplots in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Apr-2021 12:20:06

4K+ Views

To embed small plots inside subplots, we can take the following Steps −Using subplots() method, create a figure and a set of subplots (fig, ax1).On ax1, plot a line with color red, line width=4, label=”outer plot”.Using add_axes(), add an axis, i.e., ax2 with l, b, h and w values.Plot the ... Read More

How to change the figuresize using Seaborn factorplot in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Apr-2021 12:19:43

335 Views

To change the figuresize using Seaborn factorplot, we can take the following Steps −Load the exercise data using load_dataset() method.Using factorplot() method, change figure size by customising the size and aspect values.To display the figure, use the show() method.Exampleimport seaborn as sns from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] ... Read More

How to set the font size of Matplotlib axis Legend?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Apr-2021 12:19:18

2K+ Views

To set the font size of matplotlib axis legend, we can take the following steps −Create the points for x and y using numpy.Plot x and y using the plot() method with label y=sin(x).Title the plot using the title() method.To set the fontsize, we can override rcParams legend fontsize by value ... Read More

Show the origin axis (x,y) in Matplotlib plot

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Apr-2021 08:32:44

11K+ Views

To show the origin, we can take the following Steps −Create the points x, y1 and y2 using numpy.Plot the sine and cosine curves using plot() methods.Plot the vertical line, i.e., x=0.Plot the horizontal line, i.e.,  y=0.Intersection point of (Step 3 and 4), could be the origin.To display the label ... Read More

Advertisements