Rishikesh Kumar Rishi has Published 1162 Articles

How to create a Matplotlib bar chart with a threshold line?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 09:20:34

3K+ Views

To create a Matplotlib bar chart with a threshold line, we have to use axhline() method.StepsSet the figure size and adjust the padding between and around the subplots.Initialize a variable, threshold.Make lists for bars values.Get the below and above bar values based on the threshold value.Create a figure and a ... Read More

How to plot a remote image from http url using Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 09:18:42

2K+ Views

To plot a remote image from an http URL, we can use io.imread() method to read an URL and take the following steps −Set the figure size and adjust the padding between and around the subplots.Load an image from an http URLUse imshow() method to display data as an image, ... Read More

How to add text inside a plot in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 09:16:46

9K+ Views

To add text inside a plot 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.Place text with some text properties.Plot x and y using plot() method.Turn off the axes.To display the ... Read More

How to place X-axis grid over a spectrogram in Python Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 09:13:58

369 Views

To place X-axis grid over a spectrogram in Python, we can use grid() method and 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 ... Read More

How to hide axes but keep axis-labels in 3D Plot with Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 09:11:21

2K+ Views

To hide axes but keep axis-labels in 3D plot with Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a new figure or activate an existing figure.Add an '~.axes.Axes' to the figure as part of a subplot arrangement.Create x, ... Read More

How to plot a rectangle on a datetime axis using Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 09:09:23

1K+ Views

To plot a recatangle on a datetime axis using matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a new figure or activate an existing figure.Add an '~.axes.Axes' to the figure as part of a subplot arrangement using add_subplot() ... Read More

How to remove scientific notation from a Matplotlib log-log plot?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 09:06:49

3K+ Views

To remove scientific notation from a matplotlib log-log plot, we can use ax.xaxis.set_minor_formatter(mticker.ScalarFormatter()) statement.StepsSet the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Plot x and y data points using scatter() method.Set x and y axes sacle using set_xscale() and set_yscale() ... Read More

How to turn off the upper/right axis tick marks in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 02-Jun-2021 08:50:54

1K+ Views

To turn off the upper or right axis ticks marks in matplotlib, we can make a custom dictionary visible_ticks and turn off the flag.StepsSet the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Plot x and y data points using plot() ... Read More

How to work with images in Bokeh (Python)?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 02-Jun-2021 08:49:14

609 Views

To work with images in Bokeh, use image_url() method and pass a list of images.StepsConfigure the default output state to generate output saved to a file when :func:'show' is called.Create a new Figure for plotting.Render the images loaded from the given URLs.Immediately display a Bokeh object or application.Examplefrom bokeh.plotting import ... Read More

How to show legend elements horizontally in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 02-Jun-2021 08:47:03

5K+ Views

To show legend elements horizontally, we can take the following stepsSet the figure size and adjust the padding between and around the subplots.Using plot() method, plot lines with the labels line1, line2 and line3.Place a legend on the figure using legend() method, with number of labels for ncol value in ... Read More

Advertisements