Articles on Trending Technologies

Technical articles with clear explanations and examples

Automated legend creation in Matplotlib

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 10-Jun-2021 965 Views

To automate legend creation in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Initialize a variable, N, for number of sample data.Create x, y, c and s data using numpy.Create a figure and a set of subplots using subplots() method.Plot x and y data points with different colors and sizes.Place a legend on the axes.Add an artist to the figure.Create legend handles and labels for a PathCollection.Again, place a legend on the axes for sizes.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt import numpy as np ...

Read More

How to plot a nested pie chart in Matplotlib?

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 10-Jun-2021 2K+ Views

To plot a nested pie chart in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a figure and a set of subplots.Initialize a variable size, create vals, cmap, outer_colors, inner_colors data using numpy.Use pie() function to make pie charts.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig, ax = plt.subplots() size = 0.3 vals = np.array([[60., 32.], [37., 40.], [29., 10.]]) cmap = plt.get_cmap("tab20c") outer_colors = cmap(np.arange(3)*4) inner_colors = cmap([1, 2, 5, 6, 9, ...

Read More

How to refresh text in Matplotlib?

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 10-Jun-2021 2K+ Views

To refresh text in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a figure and a set of subplots.Add text to the axes.Write customized method to update text based on the keys "z" and "c".Bind the function action with key_press_event.Draw the canvas that contains the figure.Animate the figure with texts.To display the figure, use show() method.Examplefrom matplotlib import pyplot as plt, animation plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig, ax = plt.subplots() text = ax.text(.5, .5, 'First Text') def action(event):    if event.key == "z":   ...

Read More

How to make xticks evenly spaced despite their values? (Matplotlib)

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 10-Jun-2021 4K+ Views

To make xticks evenly spaced despite their values, we can use set_ticks() and set_ticklabels() methods.StepsSet the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Create a figure and a set of subplots using subplots() method.Plot x and y data points on axis 1.Set xticks using xaxis.set_ticks() method.Plot x and y data points on axis 2.Set xticks and ticklabels using xaxis.set_ticks() and xaxis.set_ticklabels() method.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 x = np.array([1, 1.5, ...

Read More

Stuffing a Pandas DataFrame.plot into a Matplotlib subplot

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 10-Jun-2021 2K+ Views

To stuff a Pandas dataframe plot into a Matplotlib subplot, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a figure and a set of subplots, two axes.Create a Pandas dataframe using DataFrame.Use DataFrame.plot() method to plot.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 fig, (ax1, ax2) = plt.subplots(2) df = pd.DataFrame(dict(name=["Joe", "James", "Jack"], age=[23, 34, 26])) df.set_index("name").plot(ax=ax1) df.set_index("name").plot(ax=ax2) plt.show()Output

Read More

Average and RMS Value of Alternating Current and Voltage

Manish Kumar Saini
Manish Kumar Saini
Updated on 10-Jun-2021 49K+ Views

Average Value of Alternating QuantityThe arithmetical average of all the instantaneous values of an alternating quantity over one cycle is known as the "Average Value of Alternating Quantity".$$Average\:value=\frac{Sum\:of\:all\:instantaneous\:values\:over\:one\:cycle}{Number\:of\:instants}$$$$=\frac{Total\:are\:under\:the\:curve\:for\:time\:period\:T}{Time\:Period\:(T)} $$$$=\frac{i_{1}+i_{2}+i_{3}+...+i_{n}}{n}$$Average Value of Symmetrical WavesIn case of symmetrical waves like sinusoidal voltage or current, the average value over one cycle is zero. It is because the positive half cycle is exactly equal to the negative half cycle. But the average value of positive or negative half cycle is not zero. Therefore, in case of symmetrical waves, the average value is calculated for half cycle.$$Avg\:value = \frac{Sum\:of\:all\:instantaneous\:values\:over\:half\:cycle}{Number\:of\:instants\:of\:half\:cycle}$$Average Value of Unsymmetrical WaveIn case of ...

Read More

What is Static Testing & Testing Review?

Vineet Nanda
Vineet Nanda
Updated on 09-Jun-2021 2K+ Views

What is Static Testing?Static testing is a software testing methodology used to look for faults in software applications without running the program. Static testing is used to prevent problems at an early stage of development since it is easier to notice and correct faults at this point. It also aids in the detection of faults that Dynamic Testing may miss.Dynamic Testing, on the other hand, examines an application while the code is executed.Static testing methodologies are classified into two groups −Manual examinations − Manual examinations contain manual code analysis, often called REVIEWS.Automated analysis using tools − Automated analysis is essentially ...

Read More

What is Interface Testing(Types & Example)?

Vineet Nanda
Vineet Nanda
Updated on 09-Jun-2021 5K+ Views

What is Interface Testing?Interface testing is a sort of software testing that confirms the proper connectivity between two separate software systems.An interface is a link that connects two components. In the computer world, this interface might be anything from APIs to web services. Interface testing is the process of evaluating these connected services or interfaces.An interface is a software program that contains a collection of instructions, communications, and other properties that allow a device and a user to communicate with one another.How to do Interface Testing?Interface testing consists of two major sections −Interface between a web server and an application ...

Read More

What is Functional Testing (Types & Examples)?

Vineet Nanda
Vineet Nanda
Updated on 09-Jun-2021 2K+ Views

What is Functional Testing?Functional Testing is a form of software testing in which the software system is validated against the functional requirements/specifications. The goal of functional testing is to test each feature of a software program by giving adequate data and comparing the outcome to the Functional requirements.Functional testing is particularly concerned with black-box testing and is unconcerned with the application's source code. This testing examines the Application Under Test's User Interface, APIs, Database, Security, Client/Server connection, and other features. Testing can be performed automatically or manually.What do you test in Functional Testing?The primary goal of functional testing is to ...

Read More

What is Storage Testing Tutorial with Type & Concepts?

Vineet Nanda
Vineet Nanda
Updated on 09-Jun-2021 790 Views

Storage TestingStorage testing is a form of software testing which is used to ensure that the software program under test saves necessary data in the correct folders and has adequate capacity to avoid unanticipated cancellations due to a lack of storage capacity. Storage Performance Testing is another name for it.Why Storage Testing?Slow storage causes slower responsiveness, longer query times, and worse application availability.Poor memory adds to the cost of server infrastructure upkeep.It aids in determining its actual storage limits prior to implementation.It is beneficial to comprehend how the system behaves when a fresh hardware device is installed or updated.Types of ...

Read More
Showing 30871–30880 of 61,248 articles
Advertisements