Rishikesh Kumar Rishi has Published 1162 Articles

Text alignment in a Matplotlib legend

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 04-Jun-2021 06:18:42

3K+ Views

To make text alignment in a matplotlib legend, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create x data points using numpy.Plot x, sin(x) and cos(x) using plot() method.Place legend using legend() method and initialize a method.Iterate the legend.get_texts() method ... Read More

Plot Matplotlib 3D plot_surface with contour plot projection

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 04-Jun-2021 06:16:49

597 Views

To plot 3d plot_surface with contour plot projection, we can use plot_surface() and contourf() methods.StepsSet the figure size and adjust the padding between and around the subplots.Create x, y, X, Y and Z data points using numpy.Create a new figure or activate an existing figure using figure() method.Add an '~.axes.Axes' ... Read More

How to add Matplotlib Colorbar Ticks?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 04-Jun-2021 06:15:23

5K+ Views

To add ticks to the colorbar, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create x, y and z data points using numpy.Use imshow() method to display the data as an image, i.e., on a 2D regular raster.Create ticks using ... Read More

How to change the font properties of a Matplotlib colorbar label?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 04-Jun-2021 06:14:11

3K+ Views

To change the font properties of a matplotlib colorbar label, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create x, y and z data points using numpy.Use imshow() method to display the data as an image, i.e., on a 2D ... Read More

How can I draw a scatter trend line using Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 04-Jun-2021 06:12:46

5K+ Views

To draw a scatter trend line using matplotlib, we can use polyfit() and poly1d() methods to get the trend line points.StepsSet 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 ... Read More

How to plot hexbin histogram in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 13:40:05

404 Views

To plot a hexbin histogram 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 using hexbin() method.Set the title of the ... Read More

How to plot a 2D histogram in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 13:38:46

3K+ Views

To plot a 2D histogram 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 using hist2d() method.Set the title of the ... Read More

How to make joint bivariate distributions in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 13:37:49

202 Views

To make joint bivariate distributions in matplotlib, we can use the scatter method.StepsSet 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 using scatter() method.To display the figure, use show() ... Read More

How to align the bar and line in Matplotlib two Y-axes chart?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 13:36:31

2K+ Views

To align the bar and line in matplotlib two Y-axes chart, we can use twinx() method to create a twin of Axes with a shared X-axis but independent Y-axis.StepsSet the figure size and adjust the padding between and around the subplots.Make a Pandas dataframe with columns 1 and 2.Plot the ... Read More

Draw a border around subplots in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 13:35:14

4K+ Views

To draw a border around subplots in matplotlib, we can use a Rectangle patch on the subplots.StepsSet the figure size and adjust the padding between and around the subplots.Add a subplot to the current figure using subplot(121).Get the subplot axes.Add a rectangle defined via an anchor point *xy* and its ... Read More

Advertisements