
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 10476 Articles for Python

295 Views
To plot histogram bins interpreted with different bins, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a list of data to plot in histogram.Add a subplot to the current figure, nrows=1, ncols=3 and index=1.Plot a histogram with data; bins is a number.Add a subplot to the current figure, nrows=1, ncols=3 and index=2.Plot a histogram with data; bins is an array.Add a subplot to the current figure, nrows=1, ncols=3 and index=3.Plot a histogram with data, bins is a string.Exampleimport matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True ... Read More

1K+ Views
To annotate points from a Pandas dataframe in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a two-dimensional, size-mutable, potentially heterogeneous tabular data, with x, y and textc columns.Plot the columns x and y data points, using plot() method.Concatenate Pandas objects along a particular axis with optional set logic along the other axes.Iterate the Pandas object.Place text for each plotted points using text() method.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 df = ... Read More

21K+ Views
To show a bar and line graph on the same plot in matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a two-dimensional, size-mutable, potentially heterogeneous tabular data.Create a figure and a set of subplots.Plot the bar and line with the dataframe obtained from Step 2.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 df = pd.DataFrame(dict(data=[2, 4, 1, 5, 9, 6, 0, 7])) fig, ax = plt.subplots() df['data'].plot(kind='bar', color='red') df['data'].plot(kind='line', marker='*', color='black', ms=10) ... Read More

945 Views
To plot blurred points 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 new figure.Add an ax1 to the figure as part of a subplot arrangement.First, we can make a marker, i.e., to be blurred.Set the X and Y axes scale, turn off the axes.Save the marker in a file, and load that image to be plotted after blurred.Close the previous figure, fig1.Create a new figure or activate an existing figure, fig2.Create random data points, x and y.Apply Gaussian filter, to ... Read More

25K+ Views
The label widget in Tkinter is used to display text and images in a Tkinter application. In order to change the properties of the label widget such as its font-property, color, background color, foreground color, etc., you can use the configure() method.If you want to change the size of the text in a Label widget, then you can configure the font=('font-family font-size style') property in the widget constructor.Example# Import the required libraries from tkinter import * import tkinter.font as tkFont # Create an instance of tkinter frame or window win=Tk() # Set the size of the tkinter window ... Read More

2K+ Views
The Entry widget is a single-line text widget defined in Tcl/Tk toolkit. We can use the Entry widget to accept and display single-line user input.In order to use the Entry widget, you have to first create an Entry widget using the constructor Entry(parent, width, **options). Once we've defined our Entry widget, we can configure its properties such as font-properties, color, width, etc., using the configure() method.ExampleLet use create an Entry widget to accept the username and display it in the window.# Import the required libraries from tkinter import * # Create an instance of tkinter frame or window win ... Read More

20K+ Views
The Tkinter library has many built-in functions and methods which can be used to implement the functional part of an application. We can use messagebox module in Tkinter to create various popup dialog boxes. The messagebox property has different types of built-in popup windows that the users can use in their applications.If you need to display the error messagebox in your application, you can use showerror("Title", "Error Message") method. This method can be invoked with the messagebox itself.Example# Import the required libraries from tkinter import * from tkinter import messagebox # Create an instance of tkinter frame or window ... Read More

11K+ Views
Most often, Tkinter Label widgets are used in the application to display the text or images. We can configure the label widget such as its text property, color, background or foreground color using the config(**options) method.If you need to modify or change the label widget dynamically, then you can use a button and a function to change the text of the label widget.Example# Import the required libraries from tkinter import * # Create an instance of tkinter frame or window win = Tk() # Set the size of the tkinter window win.geometry("700x350") # Define a function update ... Read More

11K+ Views
Using the Canvas widget, we can create text, images, graphics, and visual content to add to the Canvas widget. If you need to configure the Canvas item dynamically, then tkinter provides itemconfig(**options) method. You can use this method to configure the properties and attributes of the Canvas items. For example, if we create a line inside the Canvas widget, we can configure its color or width using itemconfig() method.Example# Import the required libraries from tkinter import * # Create an instance of tkinter frame or window win = Tk() # Set the size of the tkinter window win.geometry("700x350") ... Read More

4K+ Views
The Text widget supports multiline user input from the user. We can configure the Text widget properties such as its font properties, text color, background, etc., by using the configure() method.To set the justification of our text inside the Text widget, we can use tag_add() and tag_configure() properties. We will specify the value of "justify" as CENTER.Example# Import the required libraries from tkinter import * # Create an instance of tkinter frame or window win=Tk() # Set the size of the tkinter window win.geometry("700x350") # Create a text widget text=Text(win, width=40, height=10) # justify the text ... Read More