R 그래픽스 5 : R을 이용한 도형그리기 (1) 원(circle) 그리기

Slides:



Advertisements
Similar presentations
Objective: Convert between degrees and radians. Draw angles in standard form. Warm up Fill in the blanks. An angle is formed by two_____________ that have.
Advertisements

Geometry 5 Level 1. Interior angles in a triangle.
Definition of Trigonometric Functions With trigonometric ratios of acute angles in triangles, we are limited to angles between 0 and 90 degrees. We now.
Perimeter Rectangles, Squares, and Triangles Perimeter Measures the distance around the edge of any flat object. To find the perimeter of any figure,
13.3 Radian Measure A central angle of a circle is an angle with a vertex at the center of the circle. An intercepted arc is the portion of the circle.
2 D shapes only have two dimensions, such as width and length Some are: Polygons and Some are: Not Polygons.
Area of a Circular Segment Objectives: Review Area of Circles & Sectors Find the Area of a Circular Segment Anthony E. Davis Summer 2003.
© 2008 Pearson Addison-Wesley. All rights reserved Chapter 1 Section 9-3 Perimeter, Area, and Circumference.
Graphics in R. X
R Graphics Lori Shepherd-Kirchgraber May 22, 2012.
R-Graphics Day 2 Stephen Opiyo. Basic Graphs One of the main reasons data analysts turn to R is for its strong graphic capabilities. R generates publication-ready.
4.2 Day 1 Trigonometric Functions on the Unit Circle Pg. 472 # 6-10 evens, evens, 46, 54, 56, 60 For each question (except the 0 o, 90 o, 180 o,
Trigonometry The science of studying angle measure.
Warm-Up Find the following. 1.) sin 30 ◦ 2.) cos 270 ◦ 3.) cos 135 ◦
Trigonometry #3 Radian Measures. Converting Degrees to Radians Angle measure In degrees.
30º 60º 1 45º 1 30º 60º 1 Do Now: Find the lengths of the legs of each triangle.
Jeopardy Geometry Circles 1 Triangles 2 Polygons 3 Formulas 4 Angles 5 Pot Luck
10.3 Areas of Regular Polygons
9-2 Area of Regular Polygons The center of a regular polygon is equidistant from its vertices. Radius- the distance from the center to a vertex. Apothem-
POLYGONS. BUILDING POLYGONS We use line segments to build polygons. A polygon is a closed shape with straight sides.
Introduction to the Unit Circle in Trigonometry. What is the Unit Circle? Definition: A unit circle is a circle that has a radius of 1. Typically, especially.
Geometry Review AREA 1. Find the measure of each interior angle of the regular polygon shown below. 2.
1.8: Perimeter, Circumference, and Area
13-3 Radian Measure Today’s Objective: I can measure an angle in radians.
Terms to know going forward Angle: 2 rays an initial side and a terminal side. Initial side Terminal side Positive angle goes counter clockwise. Negative.
Our learning objectives today: To be able to recognise and name 2D shapes. To know about quadrilaterals.
Here are the eight semi-regular tessellations:
Areas of Regular Polygons Section Theorem 11.3 Area of an Equilateral Triangle: The area of an EQUILATERAL triangle is one fourth the square of.
Is this a square or a pentagon? It is a square.
Lesson Handout #1-7 (ODD), (ODD) ** For each question:  BOX the exact value  CIRCLE the approximate value (.01)
TRIGONOMETRY - Angles Trigonometry began as a study of the right triangle. It was discovered that certain relationships between the sides of the right.
11.3 Areas of Regular Polygons and Circles What you’ll learn: 1.To find areas of regular polygons. 2.To find areas of circles.
By Mr. Dunfee THE SUM OF THE ANGLES OF A TRIANGLE IS 180 DEGREES.
Different types of Shapes By: Raquel Rebbe We can make different shapes!! Circles Triangles Quadrilaterals And so much more!
RADIANS Radians, like degrees, are a way of measuring angles.
Jeopardy Terminology Geometry This PowerPoint was revised from the original version from; geometry.ppt.
By Ashley McCaw. Mrs. Burk’s Perimeter Rap /view_video.php?viewkey=73 4fe93831e3fb400ce8www.teachertube.com /view_video.php?viewkey=73.
Definition: Rectangle A rectangle is a quadrilateral with four right angles.
Section 6.1 Notes Special Angles of the Unit Circle in degrees and radians.
A polygon is a closed figure made by joining line segments, where each line segment intersects exactly two others. Polygons.
Find the area of the triangle below. 3/24 with review 7.4 and 7.5 on 3/ Areas of Regular Polygons.
And because we are dealing with the unit circle here, we can say that for this special case, Remember:
Radians and Degrees. What the heck is a radian? The radian is a unit of angular measure defined such that an angle of one radian subtended from the center.
Arc Length Start with the formula for radian measure … … and multiply both sides by r to get … Arc length = radius times angle measure in radians.
R-Graphics Stephen Opiyo. Basic Graphs One of the main reasons data analysts turn to R is for its strong graphic capabilities. R generates publication-ready.
R (3) Introduction to Graphics. The main guide R in Action Data Analysis and Graphics with R Robert I. Kabacoff
Basic Geometry Review-Shapes and Angles. Review Topics Squares Triangles Rectangles Polygons Obtuse Angle Acute Angle Right Angle Finished?
11.1 Areas of Polygons. Area of a Square = _______________________ Area of a Rectangel = ____________________ Postulate 18: ___________________________.
Radian and Degree Measure. Radian Measure A radian is the measure of a central angle that intercepts an arc length equal to the radius of the circle Radians.
What is a “polygon”? = a closed shape with straight line segments.
To find the perimeter of a rectangle, just add up all the lengths of the sides: Perimeter = L + w + L + w         = 2L + 2w To find the area of a rectangle,
COM366 Interactive Computer Graphics Topic 1 : Introduction.
A) Find the measure of
S-PLUS Lecture 6 Jaeyong Lee. Graphical Parameters type = “c”: c =p (default), l, b,s,o,h,n. pch=“+” : character or numbers 1 – 18 lty=1 : numbers lwd=2.
Geometric Shapes Sam Pfleger Math Grades Shapes TriangleQuadrilateral Pentagon Hexagon Heptagon Octagon Decagon CircleTo Quiz.
Section 11.6: Areas of Regular Polygons Definitions – Given a regular polygon inscribed in a circle, the center and radius of the polygon is the center.
Section 4.1.  A ray is a part of a line that has only one endpoint and extends forever in the opposite direction.  An angle is formed by two rays that.
Trigonometric Function: The Unit circle Trigonometric Function: The Unit circle SHS Spring 2014.
Trigonometric Function: The Unit circle. The Unit Circle A circle with radius of 1 Equation x 2 + y 2 = 1.
Unit Circle. Special Triangles Short Long Hypotenuse s s 2s Hypotenuse 45.
Jeopardy Terminology Quiz Geometry All points on a circle are the same distance from this point. (100)
Plane Figures. What are the types of figures? A closed figure begins and ends at the same end point. An open figure has ends that do not meet.
Find the area of the triangle. POLYGONS Find the area of the triangle.
A geometric shape is the geometric information which remains when location, scale, orientation and reflection are removed from the description of a geometric.
47.75⁰ Convert to radians: 230⁰.
All About Shapes! Let’s Go!.
SHAPES By: Ms. Conquest.
( , ) ( , ) ( , ) ( , ) ( , ) ( , ) ( , ) ( , ) ( , ) ( , ) ( , )
Introduction to R plot Instructor: Li, Han
2D shapes.
Presentation transcript:

R 그래픽스 5 : R을 이용한 도형그리기 (1) 원(circle) 그리기 par(pty="s") # “s” for small angle <- (0:360)*pi/180 # method 1 angle <- seq(-pi, pi, length=361) # method 2 x <- 3+5*cos(angle) y <- 4+5*sin(angle) plot(x,y, type="l", main= + "circle with radius 5 and center (3,4)") R Graphics : Device 2 (ACTIVE)

R 그래픽스 5 : R을 이용한 도형그리기 (2) 대칭이동 그래프 그리기 par(oma=c(0,0,2,0)) plot(-5:5, -5:5, type="n", xlab="", ylab="") abline(v=0) abline(h=0) mtext("y", side=3, line=1, cex=2) mtext("x", side=4, line=1, cex=2) # original x1 <- 1:4 y1 <- c(1,4,2,3) lines(x1,y1, lty=1, col=1) text(4,4, "original", cex=2) # wrt x x2 <- x1 y2 <- -y1 lines(x2,y2, lty=2, col=2) text(4,-4, "wrt x", cex=2) # wrt y x3 <- -x1 y3 <- y1 lines(x3,y3, lty=3, col=3) text(-4,4, "wrt y", cex=2) # wrt (0,0) x4 <- -x1 y4 <- -y1 lines(x4,y4, lty=4, col=4) text(-4,-4, "wrt (0,0)", cex=2) title(main="symmetry", line=0, outer=T) R Graphics : Device 2 (ACTIVE)

R 그래픽스 5 : R을 이용한 도형그리기 (3) 좌표 회전(rotation)하기 par(oma=c(0,0,2,0)) plot(-5:5, -5:5, type="n", xlab="", ylab="") abline(v=0) abline(h=0) mtext("y", side=3, line=1, cex=2) mtext("x", side=4, line=1, cex=2) lines(x1, y1, lty=1, col=1) text(4,4, "original", cex=1.5) # 90 degrees rotation angle1 <- 90/180*pi # radian angle x2 <- x1*cos(angle1)- y1*sin(angle1) y2 <- x1*sin(angle1)+ y1*cos(angle1) lines(x2, y2, lty=2, col=2) text(-4,4, "90 degrees", cex=1.5) # 180 degrees rotation angle2 <- 180/180*pi # radian angle x3 <- x1*cos(angle2)- y1*sin(angle2) y3 <- x1*sin(angle2)+ y1*cos(angle2) lines(x3, y3, lty=3, col=3) text(-4,-4, "180 degrees", cex=1.5) # 270 degrees rotation angle3 <- 270/180*pi # radian angle x4 <- x1*cos(angle3)- y1*sin(angle3) y4 <- x1*sin(angle3)+ y1*cos(angle3) lines(x4, y4, lty=4, col=4) text(4,-4, "270 degrees", cex=1.5) title(main="rotation",line=0, outer=T) R Graphics : Device 2 (ACTIVE)

R 그래픽스 5 : R을 이용한 도형그리기 (4) 다각형(polygon) 그리기 par(oma=c(0,0,2,0), mfrow=c(2,2),pty="s") # triangle theta <- seq(pi/2, pi/2+2*pi, by=2*pi/3) tri.x <- cos(theta) tri.y <- sin(theta) plot(tri.x, tri.y, type="l", xlim=c(-1,1), ylim=c(-1,1), + main="triangle") # square theta <- seq(pi/4, pi/4+2*pi, by=2*pi/4) sq.x <- cos(theta) sq.y <- sin(theta) plot(sq.x, sq.y, type="l", xlim=c(-1,1), ylim=c(-1,1), + main="square") # pentagon theta <- seq(pi/2, pi/2+2*pi, by=2*pi/5) pent.x <- cos(theta) pent.y <- sin(theta) plot(pent.x, pent.y, type="l", xlim=c(-1,1), ylim=c(-1,1), + main="pentagon") # star s <- seq(length(pent.x)) s <- c(s[s%%2==1], s[s%%2==0]) + # line 순서를 지정하는 벡터 plot(pent.x, pent.y, type="n", xlim=c(-1,1), ylim=c(-1,1), main="star shape") lines(pent.x[s], pent.y[s]) title(main="drawing polygon", line=0, outer=T) # main title R Graphics : Device 2 (ACTIVE)

R 그래픽스 5 : R을 이용한 도형그리기 (5) 확대(enlargement) 하기 R Graphics : Device 2 (ACTIVE) par(oma=c(0,0,0,0), mfrow=c(1,1), pty="s") angle <- (0:360)*pi/180 x1 <- 3+5*cos(angle) y1 <- 4+5*sin(angle) x2 <- (x1-1)*3+1 y2 <- (y1-2)*3+2 x3 <- (x1-1)*sqrt(3)+1 y3 <- (y1-2)*sqrt(3)+2 plot(x1, y1, type="l", xlim=c(-10,25), + ylim=c(-10,25)) lines(x2,y2, lty=2) lines(x3,y3, lty=3) points(1,2, pch=3, cex=2) title("Enlargement of Circle")

R 그래픽스 5 : R을 이용한 도형그리기 (6) 타원(ellipse) 그리기 par(mfrow=c(1,1), pty="s") x1 <- (-20:80)/10 y1 <- sqrt(1-(x1-3)^2/25)*3+4 y2 <- -sqrt(1-(x1-3)^2/25)*3+4 plot(x1,y1, type="l", ylim=c(-1,9)) lines(x1,y2, lty=2) points(3,4, pch=3) title("Ellipse1“) theta <- seq(-pi, pi, length=181) theta <- seq(-pi, pi, by=2*pi/181) theta <- (0:180)*pi/90 x <- 5*cos(theta) y <- 3*sin(theta) plot(x,y, type="l", ylim=c(-5,5),main="Ellipse2") theta <- 45*pi/180 x1 <- x*cos(theta)-y*sin(theta) y1 <- x*sin(theta)+y*cos(theta) plot(x,y, type="l", xlim=c(-5,5),ylim=c(-5,5)) abline(h=0) lines(x1,y1, lty=2) abline(a=0,b=1, lty=1) title(expression(45*degree~~"rotation"))

R 그래픽스 5 : R을 이용한 도형그리기 (7) curve 함수 par(mfrow=c(2,2)) curve(x^3-3*x, -2, 2) title(main="User defined expression") myfun <- function(x) {x^2+2} curve(myfun, -pi, pi) #(2) User Function title(main="User defined function") curve(dnorm, from=-3, to=3) #(3) R function title(main="Normal distribution density") plot(dnorm, from=-3, to=3) #(4) plot R function title(main="curve by plot function") curve(sin, from=-2*pi, to=2*pi, lty=1, col="red") curve(cos, from=-2*pi, to=2*pi, lty=2, col="blue", + add=T) title("add=TRUE") curve(dnorm, from=-3, to=3, log="y") title(main="dnorm by log=\"y\"") R Graphics : Device 2 (ACTIVE)

R 그래픽스 5 : R을 이용한 도형그리기 (8) persp 함수 x <- seq(-10,10, length=30) y <- x f <- function(x,y){r <- sqrt(x^2+y^2); 10*sin(r)/r} z <- outer(x,y,f) z[is.na(z)] <- 1 #결측치를 1로 바꾼다. persp(x,y,z, theta=30, phi=30, expand=0.5, + col="lightblue", ltheta=120, shade=0.75, + ticktype="detailed", xlab="X", ylab="Y", + zlab="Sinc(r)") -> res title(main="Perspective Plots with Sinc Function") R Graphics : Device 2 (ACTIVE)