Rishikesh Kumar Rishi has Published 1162 Articles

How do I plot a spectrogram the same way that pylab's specgram() does? (Matplotlib)

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Jun-2021 12:22:41

349 Views

To plot a spectrogram the same way that pylab's specgram() does, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create t, s1, s2, nse, x, NEFT and Fs data points using numpy.Create a new figure or activate an existing figure ... Read More

How to save an array as a grayscale image with Matplotlib/Numpy?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Jun-2021 12:17:54

3K+ Views

To save an array as a grayscale image with Matplotlib/numpy, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create random data with 5☓5 dimension.Set the colormap to "gray".Plot the data using imshow() method.To display the figure, use show() method.Exampleimport numpy ... Read More

How do I change the font size of the scale in Matplotlib plots?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Jun-2021 12:17:35

8K+ Views

To change the font size of the scale in Matplotlib, we can use labelsize in the tick_params() method.StepsSet the figure size and adjust the padding between and around the subplots.Create a figure and a set of subplots.Plot x data points using plot() method.To change the font size of the scale ... Read More

How to plot categorical variables in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Jun-2021 12:16:54

4K+ Views

To plot categorical variables in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a dictionary with some details.Extract the keys and values from the dictionary (Step 2).Create a figure and a set of subplots.Plot bar, scatter and plot ... Read More

Plot curves in fivethirtyeight stylesheet in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Jun-2021 12:13:40

373 Views

To use fivethirtyeight stylesheet, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.To use fivethirtyeight, we can use plt.style.use() method.Create x data points using numpy.Create a figure and a set of subplots using subplots() method.Plot three curves using plot() method.Set ... Read More

Adding a line to a scatter plot using Python's Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Jun-2021 12:11:11

15K+ Views

To add a line to a scatter plot using Python's Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Initialize a variable, n, for number of data points.Plot x and y data points using scatter() method.Plot a line using plot() ... Read More

How to disable the keyboard shortcuts in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Jun-2021 12:10:54

447 Views

To disable the keyboard shortcuts in Matplotlib, we can use remove('s') method.StepsSet the figure size and adjust the padding between and around the subplots.To disable the shortcut "s" to save the figure, use remove("s") method.Initialize a variable n for number of data points.Create x and y data points using numpyPlot ... Read More

How can I set the location of minor ticks in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Jun-2021 12:09:09

6K+ Views

To set the location of the minor ticks in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Create a figure and a set of subplots.Plot x and y data points using plot() ... Read More

How to label and change the scale of a Seaborn kdeplot's axes? (Matplotlib)

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Jun-2021 12:08:50

1K+ Views

To label and change the scale of a Seaborn kdeplot's axes, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create random data points using numpy.Plot Kernel Density Estimate (KDE) using kdeplot() method.Set Y-axis tscale and label.To display the figure, use ... Read More

How to make a broken horizontal bar plot in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Jun-2021 12:08:34

615 Views

We can take the following steps to make a broken bar plot, Set the figure size and adjust the padding between and around the subplots.Create a figure and a set of subplots.Plot a horizontal sequence of rectangles.Set x and y axes scale, X-axis label, Y ticks and Y tick labels.Configure ... Read More

Advertisements