Rishikesh Kumar Rishi has Published 1156 Articles

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

2K+ 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

4K+ 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

767 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

7K+ 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

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

6K+ 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

595 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

Advertisements