In this article, we will see how to create an interface on which a user can create drawings, write names, and pretty much any artistic work. You can use this feature to allow users to sign on a page. Here we will use the "react-hooks-svgdrawing" package.First create a React project −npx create-react-app tutorialpurposeGo to the project directory −cd tutorialpurposeExampleInstall the react-hooks-svgdrawing package −npm i --save react-hooks-svgdrawingThis library will be used to implement the container which will allow us to make a drawing or anything in the form of SVG using mouse or touchpad.Add the following lines of code in App.js ... Read More
To plot multiple columns, we will be plotting a Bar Graph. Use the plot() method and set the kind parameter to bar for Bar Graph. Let us first import the required libraries −import pandas as pd import matplotlib.pyplot as mpFollowing is our data with Team Records −data = [["Australia", 2500, 2021], ["Bangladesh", 1000, 2021], ["England", 2000, 2021], ["India", 3000, 2021], ["Srilanka", 1500, 2021]]Set the data as Pandas DataFrame and add columns −dataFrame = pd.DataFrame(data, columns=["Team", "Rank_Points", "Year"]) Plot multiple columns in a bar graph. We have set the “kind” parameter as “bar” for this −dataFrame.plot(x="Team", y=["Rank_Points", "Year" ], kind="bar", figsize=(10, ... Read More
In this article, we will see how to zoom SVG images in React JS. It is really useful in some cases. We will use the react-svg-pan-zoom package to create a feature that will zoom-in or rotate our SVG image.First create a React project −npx create-react-app tutorialpurposeGo to the project directory −cd tutorialpurposeExampleInstall the react-svg-pan-zoom package −npm i --save react-svg-pan-zoomThis package will allow us to implement an area over which we can zoom-in and zoom-out and even rotate an image.Add the following lines of code in App.js −import React, { useRef, useEffect } from "react"; import { UncontrolledReactSVGPanZoom } from "react-svg-panzoom"; ... Read More
Bar Plot in Seaborn is used to show point estimates and confidence intervals as rectangular bars. The seaborn.barplot() is used for this. Plotting horizontal bar plots with dataset columns as x and y values. Use the estimator parameter to set median as the estimate of central tendency.Let’s say the following is our dataset in the form of a CSV file − Cricketers2.csvAt first, import the required libraries −import seaborn as sb import pandas as pd import matplotlib.pyplot as plt from numpy import medianLoad data from a CSV file into a Pandas DataFrame −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers2.csv") Plotting horizontal bar plots with ... Read More
Bar Plot in Seaborn is used to show point estimates and confidence intervals as rectangular bars. The seaborn.barplot() is used for creating horizontal bar plots.Let’s say the following is our dataset in the form of a CSV file − Cricketers2.csvAt first, import the required libraries −import seaborn as sb import pandas as pd import matplotlib.pyplot as pltLoad data from a CSV file into a Pandas DataFrame −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers2.csv") Plotting horizontal bar plots −sb.barplot(x = "Matches", y = "Academy", data= dataFrame)ExampleFollowing is the code −import seaborn as sb import pandas as pd import matplotlib.pyplot as plt # Load data ... Read More
In this article, we will see how to use a different type of light in react-three-fiber to make our objects look better. It will mainly act as a torch light that point toward an object. Three.js needs light to show colors, shadow effect, and many different kinds of effects.We will make a cube and then we will add the pointer light to it.ExampleFirst of all, install the following packages −npm i --save @react-three/fiber threethreejs and react-three/fiber will be used to add webGL renderer to the website and three-fiber will be used to connect threejs and ReactNow, insert the following lines ... Read More
Bar Plot in Seaborn is used to show point estimates and confidence intervals as rectangular bars. The seaborn.barplot() is used for this. Plotting vertical bar plots grouped by a categorical variable, by passing categorical variables using x, y or hue parameter.Let’s say the following is our dataset in the form of a CSV file − Cricketers2.csvAt first, import the required libraries −import seaborn as sb import pandas as pd import matplotlib.pyplot as pltLoad data from a CSV file into a Pandas DataFrame −dataFrame = pd.read_csv("C:\Users\amit_\Desktop\Cricketers2.csv") Plotting vertical bar plots grouped by two categorical variables. The hue parameter also setsb.barplot(x = ... Read More
In this article, we will see how to create a PDF using React JS. PDFs are versatile document formats which are used for various purposes like reporting, data sharing, data storage, etc. It is really a great help if we can a PDF in React through simple CSS.ExampleFirst create a React app −npx create-react-app pdfviewerInstall the react-pdf packagenpm i @react-pdf/renderer We will use this package to create a PDF inside our React frontend using DOM elements and CSS.Insert the following piece of code in in App.js −import React from "react"; import { Document, Page, Text, View, ... Read More
In this article, we will see how to render a page according to device but without using if-else clause. For this, we will use the react-device-detect package. This feature can help us create responsive webpages without using any media queries. So, let's get started.ExampleFirst create a React project −npx create-react-app tutorialpurposeGo to the project directory −cd tutorialpurpose Download the react-device-detect package −npm install react-device-detect --saveWe will use this package to add default media queries or default conditional rendering which are premade inside the package.Add the following lines of code in App.js −import { BrowserView, ... Read More
Append a list of dictionaries to an existing Pandas DataFrame, use the append() method. At first, create a DataFrame −dataFrame = pd.DataFrame( { "Car": ['BMW', 'Audi', 'XUV', 'Lexus', 'Volkswagen'], "Place": ['Delhi', 'Bangalore', 'Pune', 'Chandigarh', 'Mumbai'], "Units": [100, 150, 50, 110, 90] } ) Create list of Dictionaries − d = [{'Car': 'Mustang', 'Place': 'Hyderabad', 'Units': 60}, {'Car': 'Tesla', 'Place': 'Kerala', 'Units': 30}, {'Car': 'RollsRoyce', 'Place': 'Punjab', 'Units': 70}, {'Car': 'Bentley', 'Place': 'Gujarat', 'Units': 80} ] Now, append list of Dictionaries to an already created DataFrame −dataFrame = dataFrame.append(d, ignore_index=True, ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP