SlideShare a Scribd company logo
1 of 2
Download to read offline
How to Embedding R Code in L TEX
                                            A


                                            Lighton Phiri

                                      September 13, 2012

Sweave is a function built right within R to facilitate dynamic reporting. Figure
1 is an example of an R plot dynamically created with Sweave and the tikzDevice
package.




             5
                                                                                Intuitive
                                                                                Simple
             4                                                                  Satisfied
  Subjects




                                                                                Expected
             3                                                                  Response
                                                                                Effective
                                                                                Beneficial
             2


             1


             0
                 Search and Browse   Navigability        Similarity   General

                                           Average UX Ratings




                         Figure 1: An R Barplot Integrated with L TEX
                                                                A


Listing 1 is the R command used to produce the ux-evaluation.tex TEXfile that
is used within the main L TEXdocument; Listing 2 shows the Sweave code that
                        A

was used to generated the barplot in Figure 1; and Listing 3 shows the portion
of the LaTeX document that uses the Sweave output file as input.




                                                    1
Listing 1: R Command for Processing Sweave File
 R CMD Sweave ux−e v a l u l a t i o n . Rnw

 Listing 2: R Sweave Code - ux-evaluation.Rnw
<< f i g=FALSE, echo=FALSE>>=

# l o a d r e q u i r e d l i b r a r i e s and d e f i n e environment
require ( ’ t i k z D e v i c e ’ )
t i k z ( ’ ux−e v a l u a t i o n . t e x ’ , standAlone=FALSE, bareBones=FALSE,
          width =4.5 , h e i g h t =2.5)

# d e f i n e data source
b o n o l o u i <− read . table ( ” b o n o l o u i . dat ” , h e a d e r=T, s e p=” t ” )

# d e f i n e p l o t area
par ( xpd=T, mar=par ( ) $mar+c ( 0 , 0 , 0 , 3 ) , cex =0.6 , f o n t =2)
barplot ( as . matrix ( b o n o l o u i ) , b e s i d e=TRUE, x l a b=” Average UX R a t i n g s ” ,
               y l a b=” S u b j e c t s ” ,
               ylim=c ( 0 , 6 ) , col=rainbow ( 7 ) , l a s =1,
               s p a c e=c ( 0 , 3 ) , names . a r g=
                   c ( ” S e a r c h and Browse ” , ” N a v i g a b i l i t y ” ,
                       ” S i m i l a r i t y ” , ” G e n e r a l ” ) , a x e s=FALSE, ann=FALSE, f o n t . l a b =2)
axis ( 2 , l a s =1, a t =(seq ( 0 , 5 , by=1)))
legend ( 3 8 , 5 , c ( ” I n t u i t i v e ” , ” Simple ” ,
                                 ” S a t i s f i e d ” , ” Expected ” ,
                                 ” Response ” , ” E f f e c t i v e ” , ” B e n e f i c i a l ” ) ,
             f i l l =rainbow ( 7 ) , bty=” o ” , text . width =5);
abline ( h=(seq ( 0 , 5 , 0 . 5 ) ) , col=” l i g h t g r a y ” , l t y=” d o t t e d ” )
#box (” i n n e r ” , ” d o t t e d ”)
@

 Listing 3: Portion of LaTeX Document
 d o c u m e n t c l a s s [ a4paper , 1 0 pt ] { a r t i c l e }
 usepackage { t i k z }
:
 b e g i n { document }
:
 b e g i n { f i g u r e } [ ht ]
      centering
      framebox [  t e x t w i d t h ] {
             i n p u t {ux−e v a l u a t i o n . t e x }
       }
      c a p t i o n {An R B a r p l o t I n t e g r a t e d with LaTeX}
      l a b e l { r−b a r p l o t }
 end { f i g u r e }
:
 end { document }


                                             2

More Related Content

Similar to Latex Sweave tikZ Sample Output

Named entity recognition (ner) with nltk
Named entity recognition (ner) with nltkNamed entity recognition (ner) with nltk
Named entity recognition (ner) with nltkJanu Jahnavi
 
VCE Unit 01 (2).pptx
VCE Unit 01 (2).pptxVCE Unit 01 (2).pptx
VCE Unit 01 (2).pptxskilljiolms
 
Class 28: Entropy
Class 28: EntropyClass 28: Entropy
Class 28: EntropyDavid Evans
 
1_Introduction.pptx
1_Introduction.pptx1_Introduction.pptx
1_Introduction.pptxranapoonam1
 
Anomaly detection
Anomaly detectionAnomaly detection
Anomaly detection철 김
 
Applied parallel coordinates for logs and network traffic attack analysis
Applied parallel coordinates for logs and network traffic attack analysisApplied parallel coordinates for logs and network traffic attack analysis
Applied parallel coordinates for logs and network traffic attack analysisUltraUploader
 
Csit77406
Csit77406Csit77406
Csit77406csandit
 
R basics for MBA Students[1].pptx
R basics for MBA Students[1].pptxR basics for MBA Students[1].pptx
R basics for MBA Students[1].pptxrajalakshmi5921
 
R Programming Language
R Programming LanguageR Programming Language
R Programming LanguageNareshKarela1
 
R Programming - part 1.pdf
R Programming - part 1.pdfR Programming - part 1.pdf
R Programming - part 1.pdfRohanBorgalli
 
Python for Scientific Computing
Python for Scientific ComputingPython for Scientific Computing
Python for Scientific ComputingAlbert DeFusco
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxLecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxjovannyflex
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxLecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxjovannyflex
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler DevelopmentLogan Chien
 

Similar to Latex Sweave tikZ Sample Output (20)

Named entity recognition (ner) with nltk
Named entity recognition (ner) with nltkNamed entity recognition (ner) with nltk
Named entity recognition (ner) with nltk
 
Searching.pptx
Searching.pptxSearching.pptx
Searching.pptx
 
Have you met Julia?
Have you met Julia?Have you met Julia?
Have you met Julia?
 
VCE Unit 01 (2).pptx
VCE Unit 01 (2).pptxVCE Unit 01 (2).pptx
VCE Unit 01 (2).pptx
 
Class 28: Entropy
Class 28: EntropyClass 28: Entropy
Class 28: Entropy
 
1_Introduction.pptx
1_Introduction.pptx1_Introduction.pptx
1_Introduction.pptx
 
Anomaly detection
Anomaly detectionAnomaly detection
Anomaly detection
 
Applied parallel coordinates for logs and network traffic attack analysis
Applied parallel coordinates for logs and network traffic attack analysisApplied parallel coordinates for logs and network traffic attack analysis
Applied parallel coordinates for logs and network traffic attack analysis
 
Csit77406
Csit77406Csit77406
Csit77406
 
Datamining with R
Datamining with RDatamining with R
Datamining with R
 
R basics for MBA Students[1].pptx
R basics for MBA Students[1].pptxR basics for MBA Students[1].pptx
R basics for MBA Students[1].pptx
 
R Programming Language
R Programming LanguageR Programming Language
R Programming Language
 
R Programming - part 1.pdf
R Programming - part 1.pdfR Programming - part 1.pdf
R Programming - part 1.pdf
 
Python for Scientific Computing
Python for Scientific ComputingPython for Scientific Computing
Python for Scientific Computing
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxLecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptx
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxLecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptx
 
R basics
R basicsR basics
R basics
 
Raster package jacob
Raster package jacobRaster package jacob
Raster package jacob
 
Climate data in R with the raster package
Climate data in R with the raster packageClimate data in R with the raster package
Climate data in R with the raster package
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler Development
 

More from Lighton Phiri

Enterprise Medical Imaging for Streamlined Radiological Diagnosis in Zambian...
Enterprise Medical Imaging for Streamlined Radiological Diagnosis  in Zambian...Enterprise Medical Imaging for Streamlined Radiological Diagnosis  in Zambian...
Enterprise Medical Imaging for Streamlined Radiological Diagnosis in Zambian...Lighton Phiri
 
User Centred Design and Implementation of Useful Picture Archiving and Commun...
User Centred Design and Implementation of Useful Picture Archiving and Commun...User Centred Design and Implementation of Useful Picture Archiving and Commun...
User Centred Design and Implementation of Useful Picture Archiving and Commun...Lighton Phiri
 
Enterprise Medical Imaging for Improved Radiological Workflows in Zambian Pub...
Enterprise Medical Imaging for Improved Radiological Workflows in Zambian Pub...Enterprise Medical Imaging for Improved Radiological Workflows in Zambian Pub...
Enterprise Medical Imaging for Improved Radiological Workflows in Zambian Pub...Lighton Phiri
 
Empirical Evaluation of ETD-ms Compliance for ETDs Harvested by the NDLTD Uni...
Empirical Evaluation of ETD-ms Compliance for ETDs Harvested by the NDLTD Uni...Empirical Evaluation of ETD-ms Compliance for ETDs Harvested by the NDLTD Uni...
Empirical Evaluation of ETD-ms Compliance for ETDs Harvested by the NDLTD Uni...Lighton Phiri
 
Enterprise Medical Imaging in Public Health Facilities in Zambia: Towards a U...
Enterprise Medical Imaging in Public Health Facilities in Zambia: Towards a U...Enterprise Medical Imaging in Public Health Facilities in Zambia: Towards a U...
Enterprise Medical Imaging in Public Health Facilities in Zambia: Towards a U...Lighton Phiri
 
Enterprise Medical Imaging in the Global South: Challenges and Opportunities
Enterprise Medical Imaging in the Global South: Challenges and OpportunitiesEnterprise Medical Imaging in the Global South: Challenges and Opportunities
Enterprise Medical Imaging in the Global South: Challenges and OpportunitiesLighton Phiri
 
Factors Influencing Co-Creation of Open Education Resources Using Learning Ob...
Factors Influencing Co-Creation of Open Education Resources Using Learning Ob...Factors Influencing Co-Creation of Open Education Resources Using Learning Ob...
Factors Influencing Co-Creation of Open Education Resources Using Learning Ob...Lighton Phiri
 
Discovering Insight from Scholarly Research Output in Higher Educational Inst...
Discovering Insight from Scholarly Research Output in Higher Educational Inst...Discovering Insight from Scholarly Research Output in Higher Educational Inst...
Discovering Insight from Scholarly Research Output in Higher Educational Inst...Lighton Phiri
 
DRGS OJS Training: Electronic Publishing Using Open Journal Systems
DRGS OJS Training: Electronic Publishing Using Open Journal SystemsDRGS OJS Training: Electronic Publishing Using Open Journal Systems
DRGS OJS Training: Electronic Publishing Using Open Journal SystemsLighton Phiri
 
OJS Training: Users and User Roles
OJS Training: Users and User RolesOJS Training: Users and User Roles
OJS Training: Users and User RolesLighton Phiri
 
OJS Training: Journal Settings and Configuration
OJS Training: Journal Settings and ConfigurationOJS Training: Journal Settings and Configuration
OJS Training: Journal Settings and ConfigurationLighton Phiri
 
OJS Training: Managing The Submission Process
OJS Training: Managing The Submission ProcessOJS Training: Managing The Submission Process
OJS Training: Managing The Submission ProcessLighton Phiri
 
OJS Training: Creating and Managing Journal Issues
OJS Training: Creating and Managing Journal IssuesOJS Training: Creating and Managing Journal Issues
OJS Training: Creating and Managing Journal IssuesLighton Phiri
 
Improved Discoverability of Digital Objects in Institutional Repositories Usi...
Improved Discoverability of Digital Objects in Institutional Repositories Usi...Improved Discoverability of Digital Objects in Institutional Repositories Usi...
Improved Discoverability of Digital Objects in Institutional Repositories Usi...Lighton Phiri
 
Using Machine Learning Techniques for Solving Locally Relevant Problems
Using Machine Learning Techniques for Solving Locally Relevant ProblemsUsing Machine Learning Techniques for Solving Locally Relevant Problems
Using Machine Learning Techniques for Solving Locally Relevant ProblemsLighton Phiri
 
Effective Ingestion of Digital Objects in Institutional Repositories Using Su...
Effective Ingestion of Digital Objects in Institutional Repositories Using Su...Effective Ingestion of Digital Objects in Institutional Repositories Using Su...
Effective Ingestion of Digital Objects in Institutional Repositories Using Su...Lighton Phiri
 
Institutional Repository Single Sources of Truth
Institutional Repository Single Sources of TruthInstitutional Repository Single Sources of Truth
Institutional Repository Single Sources of TruthLighton Phiri
 
Improved Scholarly Communication Using Machine Learning
Improved Scholarly Communication Using Machine LearningImproved Scholarly Communication Using Machine Learning
Improved Scholarly Communication Using Machine LearningLighton Phiri
 
Open Access Electronic Publishing for Increased Online Visibility: Tooling Ch...
Open Access Electronic Publishing for Increased Online Visibility: Tooling Ch...Open Access Electronic Publishing for Increased Online Visibility: Tooling Ch...
Open Access Electronic Publishing for Increased Online Visibility: Tooling Ch...Lighton Phiri
 
A Multi-Faceted Multi-Stakeholder Approach for Increased Visibility of ETDs i...
A Multi-Faceted Multi-Stakeholder Approach for Increased Visibility of ETDs i...A Multi-Faceted Multi-Stakeholder Approach for Increased Visibility of ETDs i...
A Multi-Faceted Multi-Stakeholder Approach for Increased Visibility of ETDs i...Lighton Phiri
 

More from Lighton Phiri (20)

Enterprise Medical Imaging for Streamlined Radiological Diagnosis in Zambian...
Enterprise Medical Imaging for Streamlined Radiological Diagnosis  in Zambian...Enterprise Medical Imaging for Streamlined Radiological Diagnosis  in Zambian...
Enterprise Medical Imaging for Streamlined Radiological Diagnosis in Zambian...
 
User Centred Design and Implementation of Useful Picture Archiving and Commun...
User Centred Design and Implementation of Useful Picture Archiving and Commun...User Centred Design and Implementation of Useful Picture Archiving and Commun...
User Centred Design and Implementation of Useful Picture Archiving and Commun...
 
Enterprise Medical Imaging for Improved Radiological Workflows in Zambian Pub...
Enterprise Medical Imaging for Improved Radiological Workflows in Zambian Pub...Enterprise Medical Imaging for Improved Radiological Workflows in Zambian Pub...
Enterprise Medical Imaging for Improved Radiological Workflows in Zambian Pub...
 
Empirical Evaluation of ETD-ms Compliance for ETDs Harvested by the NDLTD Uni...
Empirical Evaluation of ETD-ms Compliance for ETDs Harvested by the NDLTD Uni...Empirical Evaluation of ETD-ms Compliance for ETDs Harvested by the NDLTD Uni...
Empirical Evaluation of ETD-ms Compliance for ETDs Harvested by the NDLTD Uni...
 
Enterprise Medical Imaging in Public Health Facilities in Zambia: Towards a U...
Enterprise Medical Imaging in Public Health Facilities in Zambia: Towards a U...Enterprise Medical Imaging in Public Health Facilities in Zambia: Towards a U...
Enterprise Medical Imaging in Public Health Facilities in Zambia: Towards a U...
 
Enterprise Medical Imaging in the Global South: Challenges and Opportunities
Enterprise Medical Imaging in the Global South: Challenges and OpportunitiesEnterprise Medical Imaging in the Global South: Challenges and Opportunities
Enterprise Medical Imaging in the Global South: Challenges and Opportunities
 
Factors Influencing Co-Creation of Open Education Resources Using Learning Ob...
Factors Influencing Co-Creation of Open Education Resources Using Learning Ob...Factors Influencing Co-Creation of Open Education Resources Using Learning Ob...
Factors Influencing Co-Creation of Open Education Resources Using Learning Ob...
 
Discovering Insight from Scholarly Research Output in Higher Educational Inst...
Discovering Insight from Scholarly Research Output in Higher Educational Inst...Discovering Insight from Scholarly Research Output in Higher Educational Inst...
Discovering Insight from Scholarly Research Output in Higher Educational Inst...
 
DRGS OJS Training: Electronic Publishing Using Open Journal Systems
DRGS OJS Training: Electronic Publishing Using Open Journal SystemsDRGS OJS Training: Electronic Publishing Using Open Journal Systems
DRGS OJS Training: Electronic Publishing Using Open Journal Systems
 
OJS Training: Users and User Roles
OJS Training: Users and User RolesOJS Training: Users and User Roles
OJS Training: Users and User Roles
 
OJS Training: Journal Settings and Configuration
OJS Training: Journal Settings and ConfigurationOJS Training: Journal Settings and Configuration
OJS Training: Journal Settings and Configuration
 
OJS Training: Managing The Submission Process
OJS Training: Managing The Submission ProcessOJS Training: Managing The Submission Process
OJS Training: Managing The Submission Process
 
OJS Training: Creating and Managing Journal Issues
OJS Training: Creating and Managing Journal IssuesOJS Training: Creating and Managing Journal Issues
OJS Training: Creating and Managing Journal Issues
 
Improved Discoverability of Digital Objects in Institutional Repositories Usi...
Improved Discoverability of Digital Objects in Institutional Repositories Usi...Improved Discoverability of Digital Objects in Institutional Repositories Usi...
Improved Discoverability of Digital Objects in Institutional Repositories Usi...
 
Using Machine Learning Techniques for Solving Locally Relevant Problems
Using Machine Learning Techniques for Solving Locally Relevant ProblemsUsing Machine Learning Techniques for Solving Locally Relevant Problems
Using Machine Learning Techniques for Solving Locally Relevant Problems
 
Effective Ingestion of Digital Objects in Institutional Repositories Using Su...
Effective Ingestion of Digital Objects in Institutional Repositories Using Su...Effective Ingestion of Digital Objects in Institutional Repositories Using Su...
Effective Ingestion of Digital Objects in Institutional Repositories Using Su...
 
Institutional Repository Single Sources of Truth
Institutional Repository Single Sources of TruthInstitutional Repository Single Sources of Truth
Institutional Repository Single Sources of Truth
 
Improved Scholarly Communication Using Machine Learning
Improved Scholarly Communication Using Machine LearningImproved Scholarly Communication Using Machine Learning
Improved Scholarly Communication Using Machine Learning
 
Open Access Electronic Publishing for Increased Online Visibility: Tooling Ch...
Open Access Electronic Publishing for Increased Online Visibility: Tooling Ch...Open Access Electronic Publishing for Increased Online Visibility: Tooling Ch...
Open Access Electronic Publishing for Increased Online Visibility: Tooling Ch...
 
A Multi-Faceted Multi-Stakeholder Approach for Increased Visibility of ETDs i...
A Multi-Faceted Multi-Stakeholder Approach for Increased Visibility of ETDs i...A Multi-Faceted Multi-Stakeholder Approach for Increased Visibility of ETDs i...
A Multi-Faceted Multi-Stakeholder Approach for Increased Visibility of ETDs i...
 

Recently uploaded

ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxleah joy valeriano
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 

Recently uploaded (20)

ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 

Latex Sweave tikZ Sample Output

  • 1. How to Embedding R Code in L TEX A Lighton Phiri September 13, 2012 Sweave is a function built right within R to facilitate dynamic reporting. Figure 1 is an example of an R plot dynamically created with Sweave and the tikzDevice package. 5 Intuitive Simple 4 Satisfied Subjects Expected 3 Response Effective Beneficial 2 1 0 Search and Browse Navigability Similarity General Average UX Ratings Figure 1: An R Barplot Integrated with L TEX A Listing 1 is the R command used to produce the ux-evaluation.tex TEXfile that is used within the main L TEXdocument; Listing 2 shows the Sweave code that A was used to generated the barplot in Figure 1; and Listing 3 shows the portion of the LaTeX document that uses the Sweave output file as input. 1
  • 2. Listing 1: R Command for Processing Sweave File R CMD Sweave ux−e v a l u l a t i o n . Rnw Listing 2: R Sweave Code - ux-evaluation.Rnw << f i g=FALSE, echo=FALSE>>= # l o a d r e q u i r e d l i b r a r i e s and d e f i n e environment require ( ’ t i k z D e v i c e ’ ) t i k z ( ’ ux−e v a l u a t i o n . t e x ’ , standAlone=FALSE, bareBones=FALSE, width =4.5 , h e i g h t =2.5) # d e f i n e data source b o n o l o u i <− read . table ( ” b o n o l o u i . dat ” , h e a d e r=T, s e p=” t ” ) # d e f i n e p l o t area par ( xpd=T, mar=par ( ) $mar+c ( 0 , 0 , 0 , 3 ) , cex =0.6 , f o n t =2) barplot ( as . matrix ( b o n o l o u i ) , b e s i d e=TRUE, x l a b=” Average UX R a t i n g s ” , y l a b=” S u b j e c t s ” , ylim=c ( 0 , 6 ) , col=rainbow ( 7 ) , l a s =1, s p a c e=c ( 0 , 3 ) , names . a r g= c ( ” S e a r c h and Browse ” , ” N a v i g a b i l i t y ” , ” S i m i l a r i t y ” , ” G e n e r a l ” ) , a x e s=FALSE, ann=FALSE, f o n t . l a b =2) axis ( 2 , l a s =1, a t =(seq ( 0 , 5 , by=1))) legend ( 3 8 , 5 , c ( ” I n t u i t i v e ” , ” Simple ” , ” S a t i s f i e d ” , ” Expected ” , ” Response ” , ” E f f e c t i v e ” , ” B e n e f i c i a l ” ) , f i l l =rainbow ( 7 ) , bty=” o ” , text . width =5); abline ( h=(seq ( 0 , 5 , 0 . 5 ) ) , col=” l i g h t g r a y ” , l t y=” d o t t e d ” ) #box (” i n n e r ” , ” d o t t e d ”) @ Listing 3: Portion of LaTeX Document d o c u m e n t c l a s s [ a4paper , 1 0 pt ] { a r t i c l e } usepackage { t i k z } : b e g i n { document } : b e g i n { f i g u r e } [ ht ] centering framebox [ t e x t w i d t h ] { i n p u t {ux−e v a l u a t i o n . t e x } } c a p t i o n {An R B a r p l o t I n t e g r a t e d with LaTeX} l a b e l { r−b a r p l o t } end { f i g u r e } : end { document } 2