- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 784 Articles for Data Visualization
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
3K+ Views
To plot masked and NaN values 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 using numpy.Get x2 and y2 data points such that y > 0.7.Get masked y3 data points such that y > 0.7.Mask y3 with NaN values.Plot x, y, y2, y3 and y4 using plot() method.Place a legend to the plot.Set the title of the plot.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
1K+ Views
To zoom with Axes3D, 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 using figure() method.Get 3D axes object using Axes3D(fig) method.Plot x, y and z data points using scatter() method.To display the figure, use show() method.Examplefrom mpl_toolkits.mplot3d import Axes3D from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig = plt.figure() ax = Axes3D(fig) x = [2, 4, 6, 3, 1] y = [1, 6, 8, 1, 3] z = [3, 4, 10, 3, 1] ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
701 Views
To move labels from bottom to top without adding ticks, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create random data of 5☓5 dimension matrix.Display the data as an image, i.e., on a 2D regular raster using imshow() method.Use tick_params() method to move labels from bottom to top.To display the figure, use show() method.Exampleimport numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True data = np.random.rand(5, 5) plt.imshow(data, cmap="copper") plt.tick_params(axis='both', which='major', labelsize=10, labelbottom=False, ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
303 Views
To plot scattered masked points and add a line to demark the masked regions, we can take the following steps.StepsSet the figure size and adjust the padding between and around the subplots.Create N, r0, x, y, area, c, r, area1and area2 data points using numpy.Plot x and y data points using scatter() method.To demark the maked regions, plot the curve using plot() method.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True N = 100 r0 = 0.6 x = 0.9 * np.random.rand(N) y = 0.9 * ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
3K+ Views
To plot a stem plot in Matplotlib, we can use stem() method. It creates vertical lines from a baseline to the Y-coordinate and places a marker at the tip.StepsSet the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Create a stem plot using stem() method.Set the marker face color with red color.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = np.linspace(0.1, 2 * np.pi, 41) y = np.exp(np.sin(x)) markerline, stemlines, baseline = plt.stem(x, y, ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
1K+ Views
To refresh text in Matplotlib, 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.Add text to the axes.Write customized method to update text based on the keys "z" and "c".Bind the function action with key_press_event.Draw the canvas that contains the figure.Animate the figure with texts.To display the figure, use show() method.Examplefrom matplotlib import pyplot as plt, animation plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig, ax = plt.subplots() text = ax.text(.5, .5, 'First Text') def action(event): if event.key == "z": ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
3K+ Views
To make xticks evenly spaced despite their values, we can use set_ticks() and set_ticklabels() methods.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 using subplots() method.Plot x and y data points on axis 1.Set xticks using xaxis.set_ticks() method.Plot x and y data points on axis 2.Set xticks and ticklabels using xaxis.set_ticks() and xaxis.set_ticklabels() method.To display the figure, use show() method.Exampleimport numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = np.array([1, 1.5, ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
2K+ Views
To stuff a Pandas dataframe plot into a Matplotlib subplot, 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, two axes.Create a Pandas dataframe using DataFrame.Use DataFrame.plot() method to plot.To display the figure, use show() method.Exampleimport pandas as pd import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig, (ax1, ax2) = plt.subplots(2) df = pd.DataFrame(dict(name=["Joe", "James", "Jack"], age=[23, 34, 26])) df.set_index("name").plot(ax=ax1) df.set_index("name").plot(ax=ax2) plt.show()OutputRead More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
3K+ Views
To get boxplot data for Matplotlib boxplot we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make data frame using pandas.Make a box plot from DataFrame columns.Get boxplot's outliers, boxes, medians and whiskers data.Prit all the above information.To display the figure, use show() method.Exampleimport seaborn as sns import pandas as pd from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True df = pd.DataFrame(dict(age=[23, 45, 21, 15, 12])) _, bp = pd.DataFrame.boxplot(df, return_type='both') outliers = [flier.get_ydata() for flier in bp["fliers"]] boxes = [box.get_ydata() for box in ... Read More
![Rishikesh Kumar Rishi](https://www.tutorialspoint.com/assets/profiles/318007/profile/60_254496-1615815423.jpg)
3K+ Views
To draw a parametrized curve using pyplot.plot(), we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Initialize a variable, N, for number of samples.Create t, r, x and y data points using numpy.Create a figure and a set of subplots.Use plot() method to plot x and y data points.To display the figure, use show() method.Exampleimport numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True N = 400 t = np.linspace(0, 2 * np.pi, N) r = 0.5 + np.cos(t) x, y = r * ... Read More