Rishikesh Kumar Rishi has Published 1156 Articles

How to turn off error bars in Seaborn Bar Plot using Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-May-2021 12:29:29

870 Views

To turn off error bars in a Seaborn bar plot, we can take the following steps−Load an example dataset from the online repository (requires Internet).Show the point estimates and confidence intervals with bars.To display the figure, use show() method.Exampleimport seaborn as sns import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] ... Read More

How to set "step" on axis X in my figure in Matplotlib Python 2.6.6?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-May-2021 12:24:35

2K+ Views

To set Step on X-axis in a figure in Matplotlib Python, we can take the following Steps −StepsCreate a list of data points, x.Add a subplot to the current figure using subplot() method.Set xticks and ticklabels with rotation=45.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.00, ... Read More

How to read an image in Python OpenCV?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-May-2021 12:24:17

988 Views

To read an image in Python OpenCV, we can take the following Steps −Load an image from a file.Display the image in the specified window.Wait for a pressed key.Destroy all of the HighGUI windows.Exampleimport cv2 img = cv2.imread("baseball.png", cv2.IMREAD_COLOR) cv2.imshow("baseball", img) cv2.waitKey(0) cv2.destroyAllWindows()OutputRead More

How to get the default blue colour of matplotlib.pyplot.scatter?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-May-2021 12:23:40

5K+ Views

The default color of a scatter point is blue. To get the default blue color of matplotlib scatter point, we can annotate them using annotate() method.StepsCreate a figure and a set of subplots using subplots() method.Plot a scatter point at (-1, 1) location.Add some label for that point.Plot a scatter ... Read More

How to set same color for markers and lines in a Matplotlib plot loop?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-May-2021 12:23:17

1K+ Views

To set the same color for markers and lines in a matplotlib, we can take the following Steps −Initialize m, n and x data points using numpy.Create a new figure or activate an existing figure using figure() method.Clear the figure using clf() method.Add a subplot to the current figure using ... Read More

Plot a rectangle with an edgecolor in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-May-2021 12:22:52

2K+ Views

To put edgecolor of a rectangle in matplotlib, we can take the following Steps −Create a new figure or activate an existing figure using figure() method.Add a subplot method to the current axis.Create a rectangle instance using Rectangle() class with an edgecolor and linewidth of the edge.Add a rectangle path ... Read More

Centering x-tick labels between tick marks in Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-May-2021 12:17:52

959 Views

To place labels between two ticks, we can take the following steps−Load some sample data, r.Create a copy of the array, cast to a specified type.Create a figure and a set of subplots using subplots() method.Plot date and r sample data.Set the locator of the major/minor ticker using set_major_locator() and ... Read More

How to change a table's fontsize with matplotlib.pyplot?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-May-2021 12:17:24

8K+ Views

To change a table's fontsize with matplotlib, we can use set_fontsize() method.StepsCreate a figure and a set of subplots, nrows=1 and ncols=1.Create random data using numpy.Create columns value.Make the axis tight and off.Initialize a variable fontsize to change the font size.Set the font size of the table using set_font_size() method.To ... Read More

Changing Matplotlib subplot size/position after axes creation

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-May-2021 12:16:58

1K+ Views

To change subplot size or position after axes creation, we can take the following steps−Create a new figure or activate an existing figure using figure() method.Add an '~.axes.Axes' to the figure as part of a subplot arrangement using add_subplot() method.A grid layout to place subplots within a figure using GridSpec() ... Read More

How to rotate Matplotlib annotation to match a line?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 15-May-2021 12:16:25

4K+ Views

To rotate matplotlib annotation to match a line, we can take the following steps−Create a new figure or activate an existing figure using figure() method.Add an '~.axes.Axes' to the figure as part of a subplot arrangement using add_subplot() method.Initialize the variables, m (slope) and c (intercept).Create x and y data ... Read More

Advertisements