Found 33676 Articles for Programming

Haskell program to check armstrong number between two integers

Potti Chandra Sekhar sai
Updated on 27-Oct-2022 07:20:08

390 Views

This tutorial will discuss writing a program to display Armstrong numbers between two Integers. Haskell is a Functional, Declarative, and Strongly Typed Language. Computations in Haskell are Mathematical Functions. Armstrong Number is a number that is equal to the sum of its raised to the power of the number of digits in that number. Example 9474 is an Armstrong Number because 9474 = 9^4 + 4^7 + 7^4 + 4^4. 153 is an Armstrong Number because 153 = 1^3 + 5^3 + 3^3. Algorithm steps Implement a function to check whether a number is an Armstrong number. Implement a ... Read More

Haskell program to add binary strings

Potti Chandra Sekhar sai
Updated on 27-Oct-2022 05:36:16

474 Views

This tutorial will discuss writing a program to add binary Strings in Haskell Programming Language. The computations in Haskell are Mathematical functions. Binary Strings represent a number in binary form but with String data type. Example: 5 is described as “0101”. Algorithmic steps Take Binary Strings as input. Implement the logic for adding binary Strings Print the resultant Binary String. Program to add Binary Strings We break the program into simpler functions Syntax Importing essential Packages/Modules import Data.Char Data.Char is a useful module for having functions to type cast Character to Integer and Integer to ... Read More

Haskell program to display all prime numbers from 1 to n

Potti Chandra Sekhar sai
Updated on 27-Oct-2022 05:32:09

2K+ Views

This tutorial will discuss writing a program to display all prime numbers from 1 to N in Haskell Programming Language. Haskell is a declarative, strongly typed, and functional language. The computations in Haskell are mathematical functions. A prime number is one that must have two positive factors 1 and the number itself. Example 2, 3, 5, 7, .. Note 1 is not a prime number because it has only one factor. Algorithm steps Implementing a function to check whether a number is prime. Implementing a function to generate all prime in a range. Display the prime numbers. Program to ... Read More

How to display a variable as tooltip in ggplotly using R language?

Vani Nalliappan
Updated on 26-Oct-2022 11:58:52

1K+ Views

R is a programming language for statistical computing and graphics. ggplotly() is a function used to convert static plots to web-based plots. ggplotly() returns a Plotly object. In this tutorial, we will see how to display a variable as tooltip in ggplotly using R language. Here, we will use the aes() function that is used for aesthetic mapping between visual cue and a variable. It contains the following arguments: position (X and Y axes), color, fill, shape, line type, and size. To set the tooltip text, we will use the ggplotly(tooltip = " ") method. Follow the steps ... Read More

How to show multiple ggplot2 plots with Plotly using R?

Vani Nalliappan
Updated on 26-Oct-2022 11:56:55

514 Views

R is a programming language for statistical computing and graphics. ggplotly() is a function used to convert static plots to web-based plots. ggplotly() returns a Plotly object. In this tutorial, we will see how to show multiple ggplot2 plots with Plotly using R. Here, we will use the aes() function that is used for aesthetic mapping between visual cue and a variable. It contains the following arguments: position (X and Y axes), color, fill, shape, line type, and size. To display multiple ggplot2 plots, we will use the facet_grid() function. Follow the steps given below to show multiple ... Read More

How to remove option bar from ggplotly using R?

Vani Nalliappan
Updated on 26-Oct-2022 11:55:03

543 Views

R is a programming language for statistical computing and graphics. ggplotly() is a function that is used to convert a static plot to an interactive web-based version. ggplotly() returns a Plotly object. In this tutorial, we will see how to remove the option bar from ggplotly using R. Here, we will use the aes() function that is used for aesthetic mapping between visual cue and a variable. It contains the following arguments: position (X and Y axes), color, fill, shape, line type, and size. To remove the option bar from ggplotly, we will set "config(displayModeBar = FALSE)". Follow ... Read More

How to format mouse over labels using ggplotly in R?

Vani Nalliappan
Updated on 26-Oct-2022 11:52:04

1K+ Views

R is a programming language for statistical computing and graphics. ggplotly() is a function that is used to convert a static plot to an interactive web-based version. ggplotly() returns a Plotly object. In this tutorial, we will see how to format mouse over labels using ggplotly in R. Here, we will use the aes() function that is used for aesthetic mapping between visual cue and a variable. It contains the following arguments: position (X and Y axes), color, fill, shape, line type, and size. In addition, we will use geom_line() function to set the color and the ggplotly(tooltip="") function ... Read More

How to plot on secondary Y-Axis with Python Plotly?

Vani Nalliappan
Updated on 26-Oct-2022 11:44:38

7K+ Views

Plotly is an open-source, interactive, and browser-based charting library for Python. Python users can use Plotly to generate different types of charts including scientific charts, 3D graphs, statistical charts, financial charts, etc. In this tutorial, we will show how you can use Plotly to plot data on the secondary Y-Axis. Here we will use the plotly.graph_objects module to generate figures. It contains a lot of methods to customize the charts and render them into HTML format. We will plot two bar charts using the add_trace() method and then use the update_layout() method to set a property with dict arguments. Follow ... Read More

How to add multiple text labels from DataFrame columns in Python Plotly?

Vani Nalliappan
Updated on 26-Oct-2022 11:42:49

2K+ Views

Plotly is an open-source plotting library in Python that can generate several different types of charts. Python users can use Plotly to create interactive web-based visualizations. In this tutorial, we will see how you can use Plotly to add multiple text labels in a chart from DataFrame columns. Here, we will use the plotly.graph_objects module to generate figures. It contains a lot of methods to customize charts and render them into HTML format. Then, we will use the Scatter() method of this module to generate a scatter plot. The "line" attribute of Scatter() contains a parameter "color" that we ... Read More

Python Program to Calculate Standard Deviation

Alekhya Nagulavancha
Updated on 26-Oct-2022 10:07:50

14K+ Views

In this article, we will learn how to implement a python program to calculate standard deviation on a dataset. Consider a set of values plotted on any coordinate axes. Standard deviation of these set of values, called population, is defined as the variation seen among them. If the standard deviation is low, the values are plotted closely to the mean. But if the standard deviation is high, the values are dispersed farther from the mean. It is denoted by square root of the variance of a dataset. There are two types of standard deviations − The population standard deviation is ... Read More

Advertisements