- 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
7K+ Views
To remove X or Y labels from a Seaborn heatmap, we can use yticklabel=False.StepsSet the figure size and adjust the padding between and around the subplots.Make a Pandas dataframe with 5 columns.Use heatmap() method to plot rectangular data as a color-encoded matrix with yticklabels=False.To display the figure, use show() method.Exampleimport seaborn as sns import pandas as pd import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True df = pd.DataFrame(np.random.random((5, 5)), columns=["col1", "col2", "col3", "col4", "col5"]) sns.heatmap(df, yticklabels=False) plt.show()OutputRead More
277 Views
To display a Seaborn/Matplolib plot with a dark background, we can use "dark" in set_style() method that gives an aesthetic style to the plots.StepsSet the figure size and adjust the padding between and around the subplots.Use "dark" in set_style() method that sets the aesthetic style.Create a Pandas dataframe with two columns.Show point estimates and confidence intervals with bars, using bar plot() method.Rotate xticks by 45 degrees.To display the figure, use show() method.Exampleimport pandas import matplotlib.pylab as plt import seaborn as sns import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True sns.set_style("dark") df = pandas.DataFrame({"X-Axis": [np.random.randint(10) ... Read More
166 Views
To detect display availability with matplotlib, we can take the following steps −StpsImport os module.Use os.environ["DISPLAY"] to get the available display.Exampleimport os env = os.environ["DISPLAY"] print("Automatic detected display availability: ", env)OutputAutomatic detected display availability: 0
427 Views
To turn off the left or bottom axis tick marks in matplotlib, we can use length=0 for the axes.StepsSet the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Plot the x and y data points using plot() method.Use tick_params() method with length=0.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 x = np.linspace(-2, 2, 10) y = np.sin(x) plt.plot(x, y) plt.tick_params(axis='both', which='both', length=0) plt.show()OutputRead More
3K+ Views
To set the spacing between grouped bar plots in matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a dictionary for bar details to be plotted.Make a Pandas dataframe using dictionary, d.Plot the bar using dictionary, d, with align="center".To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt import pandas as pd plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True d = {"Name": ["John", "Jacks", "James", "Joe"], "Age": [23, 12, 30, 26], "Marks": [98, 85, 70, 77]} df = pd.DataFrame(d) df.set_index('Name').plot(kind="bar", align='center', width=0.1) plt.tick_params(rotation=45) plt.show()OutputRead More
1K+ Views
To show two different colored colormaps in the same imshow matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a 2D matrix of 5×5 dimension.Get masked matrix, data1 and data2, with positive and negative values.Create a figure and a set of subplots.Display the data as an image, i.e., on a 2D regular raster, with data1 and data2.To make two different colorbars, use colorbar method.Set the colorbar for both the images.Set the label of the colorbars.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt import numpy as np ... Read More
4K+ Views
To make custom grid lines in Seaborn heatmap, we can use linewidths and linecolor values in the heatmap() method.StepsSet the figure size and adjust the padding between and around the subplots.Create a Pandas dataframe with 5 columns.Use heatmap() method to plot the rectangular data as a color-encoded matrix.To display the figure, use show() method.Exampleimport seaborn as sns import pandas as pd import numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True df = pd.DataFrame(np.random.random((5, 5)), columns=["col1", "col2", "col3", "col4", "col5"]) sns.heatmap(df, linewidths=4, linecolor='green') plt.show()OutputRead More
3K+ Views
To plot scatter points in a 3D figure with a colorbar in matplotlib, we can use the scatter() and colorbar() methods.StepsSet the figure size and adjust the padding between and around the subplots.Create a new figure or activate an existing figure using figure() method.Add an axis as a subplot arrangement.Create xs, ys and zs data points using numpy.Use scatter() method to create a scatter plot.Use colorbar() method with scatter scalar mappable instance for colorbar.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 fig = plt.figure() ax ... Read More
300 Views
To plot the line color of a 3D parametric curve 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.Add an axis as a subplot arrangement.To make a parametric curve, initialize theta, z, r, x and y variables.Plot x, y and z data points using scatter() method.Set the title of the plot.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 fig = plt.figure() ax = fig.add_subplot(projection='3d') ... Read More
675 Views
To display real-time graphs in a simple UI for a Python program, we can animate the contour plot.StepsSet the figure size and adjust the padding between and around the subplots.Create a random data of shape 10×10 dimension.Create a figure and a set of subplots using subplots() method.Make an animation by repeatedly calling a function *func*, using FuncAnimation() class.To update the contour value in a function, we can define a method, animate(), that can be used in FuncAnimation() class.To display the figure, use show() method.Exampleimport numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation plt.rcParams["figure.figsize"] = [7.50, 3.50] ... Read More