- 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
2K+ Views
To animate text in matplotlib, we can take the following steps −Import "animation" package from matplotlib.Set the figure size and adjust the padding between and around the subplots.Create a new figure or activate an existing figure.Add an 'ax' to the figure as part of a subplot arrangement.Initialize a variable "text" to hold a string.Add text to the axes at x=0.20 and y=0.50.Make a list of colors.Make an animation by repeatedly calling a function *animate*, where size of text is increased and color is changed.To display the figure, use show() method.Examplefrom matplotlib import animation import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = ... Read More
3K+ Views
To make a grouped boxplot graph in matplotlib, we can take the following steps −Import matplotlib.pyplot and seaborn.Set the figure size and adjust the padding between and around the subplots.Load an example Seaborn dataset from the online repository.Make a boxplot with male and female group in a single day.To display the figure, use show() method.Exampleimport seaborn as sns import matplotlib.pyplot as plt # Set the figure size plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True # Import a Seaborn dataset data = sns.load_dataset('tips') # Create a grouped boxplot sns.boxplot(x=data['day'], y=data['total_bill'], hue=data['sex']) plt.show()OutputIt will produce the following ... Read More
674 Views
To plot a rainbow circles 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.Set the X and Y axes scale.Make a list of rainbow colors.Create a true circle at (0, 0).Add a circle instance 'c' to the figure.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 5.50] plt.rcParams["figure.autolayout"] = True fig, ax = plt.subplots() plt.axis("equal") ax.set(xlim=(-10, 10), ylim=(-10, 10)) for i in range(0, 7): rainbow = ['violet', 'indigo', 'blue', 'green', ... Read More
1K+ Views
To plot thousands of circles quickly in Matplotlib, we will have to use matplotlib.collections. In this case, we will use CircleCollection.StepsImport the collections package from matplotlib along with pyplot and numpy.Set the figure size and adjust the padding between and around the subplots.Initialize variables "num" for number of small circles and "sizes" for sizes of circles.Create a list of circle patches.Add circle patch artist on the current axis.Set the margins of the axes.To display the figure, use show() method.Exampleimport numpy as np import matplotlib.pyplot as plt import matplotlib.collections as mc plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True num ... Read More
23K+ Views
To plot multiple dataframes using Pandas functionality, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create two Pandas dataframes, df1 and df2, of two-dimensional, size-mutable, potentially heterogeneous tabular data.Plot df1 and df2 using plot() method.To display the figure, use show() method.Exampleimport pandas as pd from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True df1 = pd.DataFrame( dict( name=['John', 'James', 'Stephen', 'Kandy'], age=[23, 45, 12, 34] ) ... Read More
3K+ Views
To plot a time series graph using Seaborn or Plotly, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a Pandas dataframe, df, to hold a date_time series "time" and another variable data, speed.Make a Seaborn line plot with the data, "time" and "speed"Rotate the tick params by 45.To display the figure, use show() method.Exampleimport seaborn as sns from matplotlib import pyplot as plt import pandas as pd import numpy as np plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True df = pd.DataFrame( dict( ... Read More
617 Views
Rug plots are used to visualize the distribution of data. It is a plot of data for a single variable, displayed as marks along an axis. To make a rug plot in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create x data points using numpy.Add representation of a kernel-density estimate using Gaussian kernels, kde1 and kde2.Create a new figure or activate an existing figure using figure() method.Add an 'ax1' to the figure as part of a subplot arrangement.Make a rug plot with marker_size=20.Plot x_eval, kde1(x_eval) and kde2(x_eval) data ... Read More
546 Views
To fill rainbow color under a curve in Python Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a user-defined method, plot_rainbow_under_curve(), that could have a list of 7 rainbow colors and create a set of data points "x" using numpy.Iterate in the range of 0 to 7 and plot the curve and fill the area between that curve.To display the figure, use show() method.Exampleimport numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True def plot_rainbow_under_curve(): rainbow_colors = ['violet', 'indigo', ... Read More
402 Views
To draw axis lines inside a plot in 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.Create x data points using numpy.Add an 'ax' to the figure as part of a subplot arrangement.Plot x and x**x data points using plot() method.Set the left and bottom positions at 0, whereas color of the right and top spines none.To display the figure, use show() method.Exampleimport numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True fig = ... Read More
3K+ Views
To set the same scale for subplot in Python 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 'ax1' to the figure as part of a subplot arrangement with nrows=2, ncols=1 and index=1.Add another axis 'ax2' to the figure as part of a subplot arrangement with nrows=2, ncols=1 and index=2, with shared X-axis (to set same scale for subplots)Create "t" data points to plot sine and cosine curves on axes ax1 and ax2.To display the figure, use show() method.Exampleimport ... Read More