Rishikesh Kumar Rishi has Published 1156 Articles

Adding a legend to a Matplotlib boxplot with multiple plots on the same axis

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 13:12:54

3K+ Views

To add a legend to a matplotlib boxplot with multiple plots on the same axis, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create random data, a and b, using numpy.Create a new figure or activate an existing figure using ... Read More

How to plot data against specific dates on the X-axis using Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 13:11:30

3K+ Views

To plot data against specific dates on the X-axis using matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a list of dates and convert them in datetime format as x.Make a list of y data points.Set the formatter ... Read More

How to draw an average line for a scatter plot in MatPlotLib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

3K+ Views

To draw an average line for a plot in matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make x and y data points using numpy.Use subplots() method to create a figure and a set of subplots.Use plot() method for ... Read More

How to remove X or Y labels from a Seaborn heatmap?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

8K+ Views

To remove X or Y labels from a Seaborn heatmap, we can use yticklabel=False.StepsSet the figure size and adjust the padding between and around the subplots.Make a Pandas dataframe with 5 columns.Use heatmap() method to plot rectangular data as a color-encoded matrix with yticklabels=False.To display the figure, use show() method.Exampleimport ... Read More

Best way to display Seaborn/Matplotlib plots with a dark iPython Notebook profile

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

348 Views

To display a Seaborn/Matplolib plot with a dark background, we can use "dark" in set_style() method that gives an aesthetic style to the plots.StepsSet the figure size and adjust the padding between and around the subplots.Use "dark" in set_style() method that sets the aesthetic style.Create a Pandas dataframe with two ... Read More

Automatic detection of display availability with Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 13:04:06

241 Views

To detect display availability with matplotlib, we can take the following steps −StpsImport os module.Use os.environ["DISPLAY"] to get the available display.Exampleimport os env = os.environ["DISPLAY"] print("Automatic detected display availability: ", env)OutputAutomatic detected display availability: 0

Turn off the left/bottom axis tick marks in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 13:03:11

540 Views

To turn off the left or bottom axis tick marks in matplotlib, we can use length=0 for the axes.StepsSet the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Plot the x and y data points using plot() method.Use tick_params() method with ... Read More

Setting the spacing between grouped bar plots in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

3K+ Views

To set the spacing between grouped bar plots in matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a dictionary for bar details to be plotted.Make a Pandas dataframe using dictionary, d.Plot the bar using dictionary, d, with align="center".To ... Read More

How to show two different colored colormaps in the same imshow Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 13:00:42

2K+ Views

To show two different colored colormaps in the same imshow matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a 2D matrix of 5×5 dimension.Get masked matrix, data1 and data2, with positive and negative values.Create a figure and a ... Read More

How to make custom grid lines in Seaborn heatmap?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 12:57:23

4K+ Views

To make custom grid lines in Seaborn heatmap, we can use linewidths and linecolor values in the heatmap() method.StepsSet the figure size and adjust the padding between and around the subplots.Create a Pandas dataframe with 5 columns.Use heatmap() method to plot the rectangular data as a color-encoded matrix.To display the ... Read More

Advertisements