Rishikesh Kumar Rishi has Published 1156 Articles

How to display percentage above a bar chart in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 10:07:46

3K+ Views

To display percentage above a bar chart 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; initialize a variable, width.Create a figure and a set of subplots using subplots() method.Add bars with x ... Read More

How to make two markers share the same label in the legend using Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 10:05:25

1K+ Views

To make two markers share the same label in the legend using Matplotlib, we can take the following stepsStepsSet the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Plot x and y(as a sin(x) and cos(x)), using plot() method.Place legend with ... Read More

Manipulation on horizontal space in Matplotlib subplots

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

1K+ Views

To manipulate on horizontal space in Matplotlib subplots, we can use wspace=1 in subplots_adjust() method without tight plot layout.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 with 4 indices.To adjust the ... Read More

How to get the list of font family (or Name of Fonts) in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 10:01:51

869 Views

o get the list of font family in Matplotlib, we can take the following steps −Iterate fonts manager ttflist and print the names.Iterate fonts manager afmlist and print the names.Exampleimport matplotlib.font_manager as fm for f in fm.fontManager.ttflist:    print(f.name) for f in fm.fontManager.afmlist:    print(f.name)OutputSTIXNonUnicode STIXGeneral STIXSizeFiveSym cmr10 ... ... ... Read More

How can I pass parameters to on_key in fig.canvas.mpl_connect('key_press_event',on_key)?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

655 Views

To pass parameters to on_key in fig.canvas.mpl_connect('key_press_event', on_key), we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a figure and a set of subplots.Set x and y scale of the axes.Bind the function to the event.To display the figure, use ... Read More

Customizing annotation with Seaborn's FacetGrid

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

471 Views

To customizing annotation with seaborn's face grid, we can take following steps −Set the figure size and adjust the padding between and around the subplots.Create a data frame with col1 and col2 columns.Multi-plot grid for plotting conditional relationships.Apply a plotting function to each facet's subset of the data.Set the title ... Read More

Manipulation on vertical space in Matplotlib subplots

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 03-Jun-2021 09:48:05

3K+ Views

To manipulate on vertical space in Matplotlib subplots, we can use hspace=1 in subplots_adjust() method without tight plot layout.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 with 4 indices.To adjust the ... Read More

How to convert data values into color information for Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

990 Views

To convert data values into color information for Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Get a colormap instance, defaulting to rc values if *name* is None.Create random values that could be converted into color information.Create random data ... Read More

Interactive plotting with Python Matplotlib via command line

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

1K+ Views

To get interactive plots, we need to activate the figure. Using plt.ioff() and plt.ion(), we can perform interactive actions with a plot.Open Ipython shell and enter the following commands on the shell.ExampleIn [1]: %matplotlib auto Using matplotlib backend: GTK3Agg In [2]: import matplotlib.pyplot as In [3]: fig, ax ... Read More

Displaying different images with actual size in a Matplotlib subplot

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

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

3K+ Views

To display different images with actual size in a Matplotlib subplot, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Read two images using imread() method (im1 and im2)Create a figure and a set of subplots.Turn off axes for both the ... Read More

Advertisements