
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 26504 Articles for Server Side Programming

757 Views
To set the log scale tick label number on the axes, we can take the following steps −Set x and y axis limits (1 to 100), using ylim and xlim, on both the axes.Using loglog() method, make a plot with log scaling on both the x and y axis.To display the figure, use the plot() method.Examplefrom matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True plt.ylim(1, 100) plt.xlim(1, 100) plt.loglog() plt.show()Output

6K+ Views
To plot a .wav file using matplotlib, we can take following the steps −To read a .wav file, we can use the read() method.After reading the .wav file, we will get a tuple. At the 0 th index, rate would be there and at the 1st index, array sample data.Use the plot() method to plot the .wav file.Set y and x labels using ylabel and xlabel with “Amplitude” and “Time” label, respectively.To display the figure, use the show() method.Examplefrom scipy.io.wavfile import read import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True input_data = read("my_audio.wav") audio = input_data[1] plt.plot(audio[0:1024]) plt.ylabel("Amplitude") plt.xlabel("Time") plt.show()OutputRead More

5K+ Views
To increase the distance between the title and the plot in matplotlib, we can take the following steps −Create point x using numpy.Create point y using numpy sin.Set the title of the plot. After changing the value y (in argument), we can increase or decrease the distance between the title and the plot.Plot x and y points using the plot() method, where color is red and line width is 2.Ti display the figure, use the 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 x = np.linspace(1, 10, 1000) y = np.sin(x) ttl = ... Read More

5K+ Views
LaTeX is a typesetting language for producing scientific documents. We use a very small part of the language for writing mathematical notation. Jupyter notebook recognizes LaTeX code written in markdown cells and renders the symbols in the browser using the MathJax JavaScript library.To write a LaTeX formula in the legend of a plot, we can take the following steps −Create data points for x.Create data point for y, i.e., y=sin(x).Plot the curve x and y with LaTex representation.To activate the label, use the legend() method.To display the figure, use the show() method.Exampleimport numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] ... Read More

3K+ Views
To draw grid lines behind matplotlib bar graph, we can take the following Steps −Make a list of numbers, i.e., data.Make a bar using the bar() method, by passing data, color='red' and alpha = 0.5. The alpha blending value should be between 0 (transparent) and 1 (opaque).To configure the grid lines, use the grid() method, with color='yellow', linewidth=1, axis='both' and alpha=0.5.To display the figure, show() method.Examplefrom matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True data = [3, 5, 9, 15, 12] plt.bar(range(len(data)), data, color='red', alpha=0.5) plt.grid(color='yellow', linewidth=1, axis='both', alpha=0.5) plt.show()OutputRead More

177 Views
In this tutorial, we are going to write a program that finds out the k-th missing element in the given unsorted array.Find the k-th number that is missing from min to max in the given unsorted array. Let's see the steps to solve the problem.Initialise the unsorted array.Insert all the elements into a set.Find the max and min elements from the array.Write a loop that iterates from min to max and maintain a variable for the count.If the current element is present in the set, then increment the count.If the count is equal to k, then return i.ExampleLet's see the ... Read More

1K+ Views
In this tutorial, we are going to write a program that finds the k-th largest element from the max-heap.We will use priority queue to solve the problem. Let's see the steps to complete the program.Initialise the max-heap with correct values.Create a priority queue and insert the root node of the max-heap.Write a loop that iterates k - 1 times.Pop the greatest element from the queue.Add the left and right nodes of the above node into the priority queue.The greatest element in priority queue is the k-th greatest element now.Return it.ExampleLet's see the code. Live Demo#include using namespace std; struct Heap ... Read More

172 Views
In this tutorial, we are going to write a program that finds the k-th element from thee merged array of two sorted arrays.Let's see the steps to solve the problem.Initialise the two sorted arrays.Initialise an empty array of size m + n.Merge the two arrays into the new array.Return the k - 1 element from the merged array.ExampleLet's see the code. Live Demo#include using namespace std; int findKthElement(int arr_one[], int arr_two[], int m, int n, int k) { int sorted_arr[m + n]; int i = 0, j = 0, index = 0; while (i < m && ... Read More

336 Views
In this tutorial, we are going to write a program that finds the k-th digit from the right side in the number abIt's a straightforward problem. Let's see the steps to solve it.Initialise the numbers a, b, and k.Find the value of abusing pow method.Write a loop that iterates until power value is less than zero or count is less than k.Get the last digit from the power value.Increment the counter.Check whether k and counter are equal or not.Return the digit if they are equalReturn -1.ExampleLet's see the code. Live Demo#include using namespace std; int getTheDigit(int a, int b, int ... Read More

478 Views
To plot parallel coordinates, we can take the following Steps −Load dataset iris using Seaborn (Need internet).Pass the loaded data into the parallel_coordinates() method, which will help in parallel plotting.To display the figure, use the show() method.Exampleimport matplotlib.pyplot as plt from pandas.plotting import parallel_coordinates import seaborn as sns plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True data = sns.load_dataset('iris') parallel_coordinates(data, 'species', colormap=plt.get_cmap("Set2")) plt.show()Output