Rishikesh Kumar Rishi has Published 1162 Articles

How to change the color of a single bar if a condition is true (Matplotlib)?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 02-Jun-2021 08:45:08

5K+ Views

To change the color of a single bar if a condition is true, we can make a set of values and a list of colors with red until the value is 2; else add yellow color in the list.StepsSet the figure size and adjust the padding between and around the ... Read More

How to annotate each cell of a heatmap in Seaborn?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 02-Jun-2021 08:43:16

1K+ Views

To annotate each cell of a heatmap, we can make annot = True in heatmap() method.StepsSet the figure size and adjust the padding between and around the subplots.Create a Pandas dataframe with 5 columns.Use sns.heatmap() to plot a dataframe (Step 2) with annot=True flag in the argument.To display the figure, ... Read More

How to plot multiple Pandas columns on the Y-axis of a line graph (Matplotlib)?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

1K+ Views

To plot multiple Pandas columns on the Y-axis of a line graph, we can set the index using set_index() method.StepsSet the figure size and adjust the padding between and around the subplots.Create a dataframe with Category 1, Category 2, and Category 3 columns.Use set_index() method to set the DataFrame index ... Read More

Matplotlib Backend Differences between Agg and Cairo

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

376 Views

RendererFile typesDescriptionAGGPngRaster graphics − high-quality images using the Anti-Grain Geometry engineCairopng, ps, pdf, svgRaster or vector graphics − using the Cairo libraryStepsSet the figure size and adjust the padding between and around the subplots.Set the backend name as "Agg".Create a 5☓5 matrix array using numpy.Use imshow() method to display data ... Read More

Find the area between two curves plotted in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 02-Jun-2021 08:35:20

1K+ Views

To find the area between two curves plot in matplotlib, we can take the following stepsSet the figure size and adjust the padding between and around the subplots.Create x, c1 and c2 data points using numpy.Plot (x, c1) and (x, c2) using plot() methods.Fill the area between the two curves, ... Read More

How to make the Parula colormap in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 02-Jun-2021 08:34:01

848 Views

To make the Parula colormap in matplotlib, we can take the following stepsSet the figure size and adjust the padding between and around the subplots.Create colormap data using numpy.Create a 'LinearSegmentedColormap' from a list of colors.Viscum is a little tool for analyzing colormaps and creating new colormaps.Use imshow() method to ... Read More

Setting the size of the plotting canvas in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 02-Jun-2021 08:32:11

3K+ Views

To set the size of the plotting canvas in matplotlib, we can take the following steps:Set the figure size and adjust the padding between and around the subplots. Use figsize 7.50 and 3.50 to set the figure size.Create x and y data points using numpy.Plot x and y data points ... Read More

What is the name of the default Seaborn color palette?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 02-Jun-2021 08:29:38

260 Views

To get the default Seaborn color palette, we can take the following stepsSet the figure size and adjust the padding between and around the subplots.Return a list of colors or continuous colormap defining a palette.Plot the values in a color palette as a horizontal array.To display the figure, use show() ... Read More

How to get different font sizes in the same annotation of Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 02-Jun-2021 08:28:26

3K+ Views

To add different font sizes in the same annotation method, we can take the following stepsMake lists of x and y data points where text could be placed.Initialize a variable 'labels', i.e., a string.Make a list of sizes of the fonts.Use subplots() method to create a figure and a set ... Read More

How to load an image and show the image using Keras?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 02-Jun-2021 08:26:28

2K+ Views

To load an image and show the image using Keras, we will use load_image() method to load an image and set the target size of the image to be shown.StepsUse load_img() method to load the figure.Set the target size of the image.To display the figure, use show() method.Examplefrom keras.preprocessing import ... Read More

Advertisements