
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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

240 Views
To change the linewidth and markersize separately in a factorplot, we can use the following steps −Set the figure size and adjust the padding between and around the subplots.Load an example dataset from the online repository.Use factorplot() method with scale to change the marker size.To display the figure, use show() method.Exampleimport seaborn as sns from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True exercise = sns.load_dataset("exercise") g = sns.factorplot(x="time", y="pulse", hue="kind", data=exercise, ci=95, markers=['o', '*', 'd'], ... Read More

7K+ Views
To change the space between bars when drawing multiple barplots in Pandas within a group, we can use linewidth in plot() method.StepsSet the figure size and adjust the padding between and around the subplots.Make a dictionary with two columns.Create a two-dimensional, size-mutable, potentially heterogeneous tabular data.Plot the dataframe with plot() method, with linewidth that change the space between the bars.Place a legend on the plot.To display the figure, use show() method.Exampleimport pandas as pd from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True d = {'Column 1': [i for i in range(10)], ... Read More

579 Views
To install Matplotlib package with Conda, run one of the following −conda install -c conda-forge matplotlib-base conda install -c conda-forge/label/testing matplotlib-base conda install -c conda-forge/label/testing/gcc7 matplotlib-base conda install -c conda-forge/label/cf202003 matplotlib-base conda install -c conda-forge/label/matplotlib_rc matplotlib-base conda install -c conda-forge/label/gcc7 matplotlib-base conda install -c conda-forge/label/broken matplotlib-base conda install -c conda-forge/label/matplotlib-base_rc matplotlib-base conda install -c conda-forge/label/rc matplotlib-base conda install -c conda-forge/label/cf201901 matplotlib-base

2K+ Views
To reuse plots 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 using figure() method.Plot a line with some input lists.To reuse the plot, update y data and the linewidth of the plotTo display the figure, use show() method.Examplefrom matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True line, = plt.plot([1, 3], [3, 4], label="line plot", color='red', lw=0.5) line.set_ydata([3.5]) line.set_linewidth(4) plt.show()Output

2K+ Views
To modify a Matplotlib legend after it has been created, we can have multiple methods to modify the created legend.Set the figure size and adjust the padding between and around the subplots.Plot a line using plot() method, with two lists and a label.Use legend() method to place a legend over the plot.To modify the matplotlib legend, use set_title() method.To display the figure, use show() method.Examplefrom matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True plt.plot([1, 3, 4, 5, 2, 1], [3, 4, 1, 3, 0, 1], label="line plot", color='red', lw=0.5) ... Read More

575 Views
To plot error bars from a dataframe using Seaborn FacetGrid, we can use following steps −Get a two-dimensional, size-mutable, potentially heterogeneous tabular data.Multi-plot grid for plotting conditional relationships.Apply a plotting function to each facet's subset of the data.To display the figure, use show() method.Exampleimport pandas as pd import seaborn as sns from matplotlib import pyplot as plt df = pd.DataFrame({'col1': [3.0, 7.0, 8.0], 'col2': [1.0, 4.0, 3.0]}) g = sns.FacetGrid(df, col="col1", hue="col1") g.map(plt.errorbar, "col1", "col2", yerr=0.75, fmt='o') plt.show()Output

2K+ Views
To show pyplot images on a console, we can use pyplot.show() method.StepsSet the figure size and adjust the padding between and around the subplots.Create random data of 5☓5 dimension.Use imshow() method, with data. Display the data as an image, i.e., on a 2D regular raster.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.show()Output

74K+ Views
To plot a function defined with def in Python, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a user-defined function using, def, i.e., f(x).Create x data points using numpy.Plot x and f(x) using plot() 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 def f(x): return np.sin(x) + x + x * np.sin(x) x = np.linspace(-10, 10, 100) plt.plot(x, f(x), color='red') plt.show()OutputRead More

375 Views
To produce a barcode in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a list of binary numbers, i.e., 0s and 1s.Create a new figure or activate an existing figure with dpi=100Add an axes to the figure.Turn off the axes.Use imshow() method to plot the data from step 2.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 code = np.array([ 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, ... Read More

2K+ Views
To set label for an already plotted line in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Plot the line with an input list.Set the label of the created line.Place a legend on the plot at the "upper right" location.To display the figure, use show() method.Examplefrom matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True line, = plt.plot([2, -1, 4, -1, 2]) line.set_label("line") plt.legend(loc="upper right") plt.show()Output