Lecture note Data visualization - Chapter 23
Số trang: 51
Loại file: pptx
Dung lượng: 4.14 MB
Lượt xem: 14
Lượt tải: 0
Xem trước 6 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
This chapter presents the following content: Chapter 5 “plotting”, two dimensional plots, simple x-y plots, titles, labels and grids, multiple plots, plots with more than one line, plots of complex arrays, line, color and mark style, axis scaling and annotating plots,...
Nội dung trích xuất từ tài liệu:
Lecture note Data visualization - Chapter 23Lecture23RecapChapter5“Plotting”TwoDimensionalPlotsSimplexyPlotsTitles,LabelsandGridsMultiplePlotsPlotswithMorethanOneLineAplotwithmorethanonelinecanbecreatedinseveral waysBydefault,theexecutionofasecondplotstatementwill erasethefirstplotHowever,youcanlayerplotsontopofoneanotherby usingtheholdoncommandExecutethefollowingstatementstocreateaplotwith bothfunctionsplottedonthesamegraph x=0:pi/100:2*pi; y1=cos(x*4); plot(x,y1)TheholdoncommandcanbeusedtolayerplotsonsamegraphContinued….Semicolonsareoptionalonboththeplotstatementand theholdonstatementMATLABwillcontinuetolayertheplotsuntilthehold offcommandisexecuted: holdoffAnotherwaytocreateagraphwithmultiplelinesisto requestbothlinesinasingleplotcommandMATLABinterpretstheinputtoplotasalternatingxand yvectors,asin plot(X1,Y1,X2,Y2)Continued….Iftheplotfunctioniscalledwithasinglematrix argument,MATLABdrawsaseparatelineforeach columnofthematrixThexaxisislabeledwiththerowindexvector,1:k, wherekisthenumberofrowsinthematrix.This producesanevenlyspacedplot,sometimescalledaline plotIfplotiscalledwithtwoarguments,oneavectorandthe otheramatrix,MATLABsuccessivelyplotsalinefor eachrowinthematrixForexample:wecancombiney1andy2intoasingleContinued….Here’sanothermorecomplicatedexample: X=0:pi/100:2*pi; Y1=cos(X)*2; Y2=cos(X)*3; Y3=cos(X)*4; Y4=cos(X)*5; Z=[Y1;Y2;Y3;Y4]; plot(X,Y1,X,Y2,X,Y3,X,Y4)ThiscodeproducesthesameresultasMultiplePlotsonSameGraphContinued….Afunctionoftwovariables,thepeaksfunctionproduces sampledatathatareusefulfordemonstratingcertain graphingfunctionsCallingpeakswithasingleargumentnwillcreateannxn matrixWecanusepeakstodemonstratethepowerofusinga matrixargumentintheplotfunctionThecommand plot(peaks(100))resultsintheimpressivegraphThepeakFunction,plottedwithsingleaugmentinplotCommandPlotsofComplexArraysIftheinputtotheplotcommandisasinglearrayof complexnumbers,MATLABplotstherealcomponenton thexaxisandtheimaginarycomponentontheyaxisForexample:if A=[0+0i,1+2i,2+5i,3+4i]then plot(A) title(PlotofaSingleComplexArray) xlabel(RealComponent)Continued….Ifweattempttousetwoarraysofcomplexnumbersinthe plotfunction,theimaginarycomponentsareignoredTherealportionofthefirstarrayisusedforthexvalues, andtherealportionofthesecondarrayisusedforthey– valuesToillustrate,firstcreateanotherarraycalledBbytaking thesineofthecomplexarrayA: B=sin(A)returns B=03.1658+1.9596i67.478930.8794i3.853727.0168iLine,ColorandMarkStyleTheappearanceofplotscanbechangedbyselectinguser definedlinestylesandlinecolorsandbychoosingto showthedatapointsonthegraphwithuserspecified markstylesThecommand helpplotreturnsalistoftheavailableoptionsContinued….Thefollowingcommandsillustratetheuseofline,color, andmarkstyles: x=[1:10]; y=[58.5,63.8,64.2,67.3,71.5,88.3,90.1,90.6, 89.5,90.4]; plot(x,y,:ok)Theresultingplot(showninnextslide)consistsofa dashedline,togetherwithdatapointsmarkedwithcirclesContinued….Tospecifyline,mark,andcolorstylesformultiplelines, addastringcontainingthechoicesaftereachpairofdata pointsIfthestringisnotincluded,thedefaultsareusedForexample: plot(x,y,:ok,x,y*2,xr,x,y/2,b)resultsinthegraphshowninnextslide
Nội dung trích xuất từ tài liệu:
Lecture note Data visualization - Chapter 23Lecture23RecapChapter5“Plotting”TwoDimensionalPlotsSimplexyPlotsTitles,LabelsandGridsMultiplePlotsPlotswithMorethanOneLineAplotwithmorethanonelinecanbecreatedinseveral waysBydefault,theexecutionofasecondplotstatementwill erasethefirstplotHowever,youcanlayerplotsontopofoneanotherby usingtheholdoncommandExecutethefollowingstatementstocreateaplotwith bothfunctionsplottedonthesamegraph x=0:pi/100:2*pi; y1=cos(x*4); plot(x,y1)TheholdoncommandcanbeusedtolayerplotsonsamegraphContinued….Semicolonsareoptionalonboththeplotstatementand theholdonstatementMATLABwillcontinuetolayertheplotsuntilthehold offcommandisexecuted: holdoffAnotherwaytocreateagraphwithmultiplelinesisto requestbothlinesinasingleplotcommandMATLABinterpretstheinputtoplotasalternatingxand yvectors,asin plot(X1,Y1,X2,Y2)Continued….Iftheplotfunctioniscalledwithasinglematrix argument,MATLABdrawsaseparatelineforeach columnofthematrixThexaxisislabeledwiththerowindexvector,1:k, wherekisthenumberofrowsinthematrix.This producesanevenlyspacedplot,sometimescalledaline plotIfplotiscalledwithtwoarguments,oneavectorandthe otheramatrix,MATLABsuccessivelyplotsalinefor eachrowinthematrixForexample:wecancombiney1andy2intoasingleContinued….Here’sanothermorecomplicatedexample: X=0:pi/100:2*pi; Y1=cos(X)*2; Y2=cos(X)*3; Y3=cos(X)*4; Y4=cos(X)*5; Z=[Y1;Y2;Y3;Y4]; plot(X,Y1,X,Y2,X,Y3,X,Y4)ThiscodeproducesthesameresultasMultiplePlotsonSameGraphContinued….Afunctionoftwovariables,thepeaksfunctionproduces sampledatathatareusefulfordemonstratingcertain graphingfunctionsCallingpeakswithasingleargumentnwillcreateannxn matrixWecanusepeakstodemonstratethepowerofusinga matrixargumentintheplotfunctionThecommand plot(peaks(100))resultsintheimpressivegraphThepeakFunction,plottedwithsingleaugmentinplotCommandPlotsofComplexArraysIftheinputtotheplotcommandisasinglearrayof complexnumbers,MATLABplotstherealcomponenton thexaxisandtheimaginarycomponentontheyaxisForexample:if A=[0+0i,1+2i,2+5i,3+4i]then plot(A) title(PlotofaSingleComplexArray) xlabel(RealComponent)Continued….Ifweattempttousetwoarraysofcomplexnumbersinthe plotfunction,theimaginarycomponentsareignoredTherealportionofthefirstarrayisusedforthexvalues, andtherealportionofthesecondarrayisusedforthey– valuesToillustrate,firstcreateanotherarraycalledBbytaking thesineofthecomplexarrayA: B=sin(A)returns B=03.1658+1.9596i67.478930.8794i3.853727.0168iLine,ColorandMarkStyleTheappearanceofplotscanbechangedbyselectinguser definedlinestylesandlinecolorsandbychoosingto showthedatapointsonthegraphwithuserspecified markstylesThecommand helpplotreturnsalistoftheavailableoptionsContinued….Thefollowingcommandsillustratetheuseofline,color, andmarkstyles: x=[1:10]; y=[58.5,63.8,64.2,67.3,71.5,88.3,90.1,90.6, 89.5,90.4]; plot(x,y,:ok)Theresultingplot(showninnextslide)consistsofa dashedline,togetherwithdatapointsmarkedwithcirclesContinued….Tospecifyline,mark,andcolorstylesformultiplelines, addastringcontainingthechoicesaftereachpairofdata pointsIfthestringisnotincluded,thedefaultsareusedForexample: plot(x,y,:ok,x,y*2,xr,x,y/2,b)resultsinthegraphshowninnextslide
Tìm kiếm theo từ khóa liên quan:
Data visualization Lecture note Data visualization Data structures Data Visualization with C Data visualization with matlab Effective graphical displayTài liệu liên quan:
-
Trực quan hóa dữ liệu: Vai trò & thử thách
10 trang 37 0 0 -
Ebook Eloquent JavaScript - A modern introduction to programming: Part 1
199 trang 33 0 0 -
Ebook Management support systems: Part 2 - Dr. Kamlesh Lakhwani
136 trang 31 0 0 -
Lecture Introduction to computing systems (2/e): Chapter 19 - Yale N. Patt, Sanjay J. Patel
28 trang 30 0 0 -
Ebook Introduction to algorithms (3rd edition)
1313 trang 28 0 0 -
Lecture Data Structures: Lesson 38
71 trang 27 0 0 -
Lecture Data structures and algorithms: Chapter 1 - Introduction
41 trang 26 0 0 -
Lecture note Data visualization - Chapter 22
21 trang 24 0 0 -
169 trang 24 0 0
-
Lecture Data Structures: Lesson 41
18 trang 23 0 0