Rishikesh Kumar Rishi has Published 1156 Articles

What are the differences between add_axes and add_subplot in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Apr-2021 08:24:42

512 Views

Definingadd_axes − Add an axes to the figure.add_subplot − Add an axes to the figure as part of a subplot arrangement.StepsCreate a new figure, or activate an existing figure, using the figure() method.Add an axes to the figure as part of a subplot arrangement where nrows=2, ncols=2. At index 1, add ... Read More

How to change the curve using radiobuttons in Matplotlib?

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Apr-2021 08:21:36

380 Views

To change the color of a line using radiobuttons, we can take the following steps −Create x, sin and cos data points using numpy.Adjust the figure size and padding between and around the subplots.Create a figure and a set of subplots using the subplots() method.Plot curve with x and y ... Read More

Pythonic way of detecting outliers in one dimensional observation data using Matplotlib

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 09-Apr-2021 08:19:37

195 Views

To detect outliers in one dimensional observation data, we can take the following Steps −Create spread, center, flier_high and flier_low.Using the above data (Step 1), we can calculate data.Use the suplots() method to create a figure and a set of subplots, i.e., fig1 and ax1.Set the title of ax1.Now using ... Read More

Golang program to calculate the absolute and scale of a vertex.

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 12:27:19

270 Views

ExampleAbs(x, y) => √(x)2+(y)2Scale(f) => (x*f, y*f)ApproachDefine a vertex as a struct.Initialize the vertex with some x and value.Define a method to calculate absolute(x, y).Define a method to calculate scale(x*f, y*f).Example Live Demopackage main import (    "fmt"    "math" ) type Vertex struct {    X, Y float64 } func ... Read More

Golang program to traverse a given input array, with Boolean flag, using arrays and struct.

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 12:25:52

229 Views

ExampleApproachAsk the user to enter the size of array.Make a string array of given size.Ask the user to enter elements.At the end, print the array.Example Live Demopackage main import "fmt" func main(){    arr := []int{10, 20, 30, 60, 40, 50}    boolArr := []bool{true, false, true, false, true, false}   ... Read More

Golang Program to create a string array that takes inputs from users.

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 12:23:25

966 Views

ExampleApproachAsk the user to enter the size of array.Make a string array of given size.Ask the user to enter the elements.At the end, print the array.Example Live Demopackage main import (    "fmt" ) func main(){    fmt.Printf("Enter size of your array: ")    var size int    fmt.Scanln(&size)    var ... Read More

Golang program to create an integer array that takes inputs from users.

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 12:21:49

4K+ Views

ExampleApproachAsk the user to enter the size of array.Make an integer array of given size.Ask the user to enter elements.At the end, print the array.Example Live Demopackage main import (    "fmt" ) func main(){    fmt.Printf("Enter size of your array: ")    var size int    fmt.Scanln(&size)    var arr ... Read More

Golang program to count the number of nodes in a doubly linked list.

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 12:19:51

144 Views

ExamplesApproachStep 1 − Define a method that accepts the head of a doubly linked list.Step 2 − Initialize temp:=head, count:=0Step 3 − Iterate temp until it becomes nil.Step 4 − Increase count by 1.Step 5 − At the end, print count.Example Live Demopackage main import "fmt" type Node struct {   ... Read More

Golang Program to create a doubly linked list and traverse forward.

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 12:17:47

483 Views

A doubly linked list node contains three items, where two items point to the next and previous nodes, and the third item contains the value of that node.ExampleApproachStep 1 − Define a method that accepts the head of a doubly linked list.Step 2 − Initialize temp:=head.Step 3 − Iterate temp ... Read More

Golang program to insert a node at the ith index node, when the index is at the last position in the linked list.

Rishikesh Kumar Rishi

Rishikesh Kumar Rishi

Updated on 18-Mar-2021 12:16:15

166 Views

ExamplesExampleApproach to solve this problem Live Demopackage main import "fmt" type Node struct {    value int    next *Node } func NewNode(value int, next *Node) *Node{    var n Node    n.value = value    n.next = next    return &n } func TraverseLinkedList(head *Node){    temp := head   ... Read More

Advertisements