code-rag-bench/online-tutorials huggingface dataset:
Matplotlib.figure.Figure.suptitle() in Python

03 May, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The figure module provides the top-level Artist, the Figure, which contains all the plot elements. This module is used to control the default spacing of the subplots and top level container for all plot elements.
The suptitle() method figure module of matplotlib library is used to Add a centered title to the figure.
Syntax: suptitle(self, t, **kwargs)
Parameters: This method accept the following parameters that are discussed below:
t : This parameter is the title text.
x: This parameter is the x location of the text in figure coordinates.
y: This parameter is the y location of the text in figure coordinates.
horizontalalignment, ha : This parameter is the horizontal alignment of the text relative to (x, y).
verticalalignment, va : This parameter is the vertical alignment of the text relative to (x, y).
fontsize, size : This parameter is the font size of the text.
fontweight, weight : This parameter is the font weight of the text.
Returns: This method returns the Text instance of the title.
Below examples illustrate the matplotlib.figure.Figure.suptitle() function in matplotlib.figure:
Example 1:
# Implementation of matplotlib functionimport matplotlib.pyplot as pltimport numpy as npimport matplotlib.gridspec as gridspec     fig = plt.figure(tight_layout = True)gs = gridspec.GridSpec(1, 1)   ax = fig.add_subplot(gs[0, :])ax.plot(np.arange(0, 1e6, 1000))ax.set_ylabel('YLabel0')ax.set_xlabel('XLabel0')   fig.suptitle('matplotlib.figure.Figure.suptitle()\ function Example\n\n', fontweight ="bold")  plt.show()
Output:
Example 2:
# Implementation of matplotlib functionimport matplotlib.pyplot as pltimport numpy as np      np.random.seed(19680801)   xdata = np.random.random([2, 10])   xdata1 = xdata[0, :]xdata2 = xdata[1, :]   ydata1 = xdata1 ** 2ydata2 = 1 - xdata2 ** 3    fig = plt.figure()ax = fig.add_subplot(1, 1, 1)ax.plot(xdata1, ydata1, color ='tab:blue')ax.plot(xdata2, ydata2, color ='tab:orange')    ax.set_xlim([0, 1])ax.set_ylim([0, 1])  fig.suptitle('matplotlib.figure.Figure.suptitle()\ function Example\n\n', fontweight ="bold")  plt.show()
Output:
Matplotlib figure-class
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
iptables-restore command in Linux with examples

05 Mar, 2019
iptables-restore and ip6tables-restore commands are used to restore IP and IPv6 Tables from data being specified on the STDIN or in the file. Use I/O redirection provided by default from your shell to read from a file or specify the file as an argument.
Syntax:
iptables-restore [-chntv] [-M modprobe] [-T name] [file]

ip6tables-restore [-chntv] [-M modprobe] [-T name] [file]

Options:
-c, –counters : This option restores the values of all packet and byte counters.
-h, –help : This option prints a short option summary.
-n, –noflush : This option doesn’t flush the previous contents of the table. If it is not specified, both the commands flush (delete) all previous contents of the respective table.
-t, –test : This option only parses and construct the ruleset, but do not commit it.
-v, –verbose : This option prints additional debug info during ruleset processing.
-M, –modprobe modprobe_program : This option Specifies the path to the modprobe program. By default, the iptables-restore will going to inspect /proc/sys/kernel/modprobe to determine the executable’s path.
-T, –table name : This option restores only the named table even if the input stream contains other ones.
Examples:
1) Create a new iptable which helps in restoring.
2) It will create a new file named iptableslist.txt. To see the contents of file run the following command on the terminal:
3) The content of the file is:
4) Now the last step is to restore from that file we just created. We can simply restore iptables using the following command.
linux-command
Picked
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
ZIP command in Linux with examples
tar command in Linux with examples
curl command in Linux with Examples
Tail command in Linux with examples
Conditional Statements | Shell Script
TCP Server-Client implementation in C
Docker - COPY Instruction
scp command in Linux with Examples
UDP Server-Client implementation in C
echo command in Linux with Examples
How to search a MySQL table for a specific string?

Use equal to operator for an exact match −
select *from yourTableName where yourColumnName=yourValue;
Let us first create a table −
mysql> create table DemoTable
-> (
-> FirstName varchar(100),
-> LastName varchar(100)
-> );
Query OK, 0 rows affected (0.70 sec
Insert some records in the table using insert command −
mysql> insert into DemoTable values('John','Smith');
Query OK, 1 row affected (0.14 sec)

mysql> insert into DemoTable values('John','Doe');
Query OK, 1 row affected (0.19 sec)

mysql> insert into DemoTable values('Chris','Brown');
Query OK, 1 row affected (0.13 sec)

mysql> insert into DemoTable values('Carol','Taylor');
Query OK, 1 row affected (0.29 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+-----------+----------+
| FirstName | LastName |
+-----------+----------+
| John      | Smith    |
| John      | Doe      |
| Chris     | Brown    |
| Carol     | Taylor   |
+-----------+----------+
4 rows in set (0.00 sec)
Following is the query to search a MySQL table for a specific string −
mysql> select *from DemoTable where LastName='Doe';
This will produce the following output −
+-----------+----------+
| FirstName | LastName |
+-----------+----------+
| John      | Doe      |
+-----------+----------+
1 row in set (0.00 sec)
Python - Stack and StackSwitcher in GTK+ 3 - GeeksforGeeks

31 Dec, 2020
A Gtk.Stack is a container which allows visibility to one of its child at a time. Gtk.Stack does not provide any direct access for users to change the visible child. Instead, the Gtk.StackSwitcher widget can be used with Gtk.Stack to obtain this functionality.In Gtk.Stack transitions between pages can be done by means of slides or fades. This can be controlled with Gtk.Stack.set_transition_type().
The Gtk.StackSwitcher widget acts as a controller for a Gtk.Stack ; it shows a row of buttons to switch between the various pages of the associated stack widget. The content for the buttons comes from the child properties of the Gtk.Stack.
Follow below steps:
import GTK+ 3 module.Create main window.Implement Stack.Implement Button.Implement Label.Implement StackSwitcher.
import GTK+ 3 module.
Create main window.
Implement Stack.
Implement Button.
Implement Label.
Implement StackSwitcher.
import gi# Since a system can have multiple versions# of GTK + installed, we want to make # sure that we are importing GTK + 3.gi.require_version("Gtk", "3.0")from gi.repository import Gtk    class StackWindow(Gtk.Window):    def __init__(self):        Gtk.Window.__init__(self, title ="Geeks for Geeks")        self.set_border_width(10)          # Creating a box vertically oriented with a space of 100 pixel.        vbox = Gtk.Box(orientation = Gtk.Orientation.VERTICAL, spacing = 100)        self.add(vbox)          # Creating stack, transition type and transition duration.        stack = Gtk.Stack()        stack.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)        stack.set_transition_duration(1000)          # Creating the check button.        checkbutton = Gtk.CheckButton("Yes")        stack.add_titled(checkbutton, "check", "Check Button")          # Creating label .        label = Gtk.Label()        label.set_markup("<big>Hello World</big>")        stack.add_titled(label, "label", "Label")          # Implementation of stack switcher.        stack_switcher = Gtk.StackSwitcher()        stack_switcher.set_stack(stack)        vbox.pack_start(stack_switcher, True, True, 0)        vbox.pack_start(stack, True, True, 0)    win = StackWindow()win.connect("destroy", Gtk.main_quit)win.show_all()Gtk.main()
Output :
Python DSA-exercises
Python-GTK
Python-gui
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install PIP on Windows ?
Selecting rows in pandas DataFrame based on conditions
How to drop one or multiple columns in Pandas Dataframe
Python | Get unique values from a list
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Defaultdict in Python
Python | os.path.join() method
Create a directory in Python
Bar Plot in Matplotlib
Angular Material 7 - Tooltip

The <MatTooltip>, an Angular Directive, is used to show a material styled tooltip.
In this chapter, we will showcase the configuration required to show a tooltip using Angular Material.
Following is the content of the modified module descriptor app.module.ts.
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {MatButtonModule,MatTooltipModule} from '@angular/material'
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
@NgModule({
   declarations: [
      AppComponent
   ],
   imports: [
      BrowserModule,
      BrowserAnimationsModule,
      MatButtonModule,MatTooltipModule,
      FormsModule,
      ReactiveFormsModule
   ],
   providers: [],
   bootstrap: [AppComponent]
})
export class AppModule { }
Following is the content of the modified HTML host file app.component.html.
<button mat-raised-button
   matTooltip = "Sample Tooltip"
   aria-label = "Sample Tooltip">
   Click Me!
</button>
Verify the result.
Here, we've created a button using mat-button on hover, we'll show a tooltip.

    16 Lectures 
     1.5 hours 

 Anadi Sharma

    28 Lectures 
     2.5 hours 

 Anadi Sharma

    11 Lectures 
     7.5 hours 

 SHIVPRASAD KOIRALA

    16 Lectures 
     2.5 hours 

 Frahaan Hussain

    69 Lectures 
     5 hours 

 Senol Atac

    53 Lectures 
     3.5 hours 

 Senol Atac
 Print
 Add Notes
 Bookmark this page