SlideShare una empresa de Scribd logo
1 de 25
Descargar para leer sin conexión
Perguntas




        GD::Graph - Graph Plotting Module

       Jos´ Pedro Silva
          e                             Pedro Faria         Ulisses Costa

                              Engenharia de Linguagens
                                 Projecto integrado


                                 January 22, 2011




Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
   e                                           GD::Graph - Graph Plotting Module
Perguntas

Description



   GD::Graph is a perl5 module to create charts using the GD
   module. The following classes for graphs with axes are defined:
   GD::Graph::lines Create a line chart.
   GD::Graph::bars Create a bar chart with vertical or horizontal bars.
   GD::Graph::linespoints Combination of lines and points.
   GD::Graph::area Create a graph, representing the data as areas
                under a line.
   GD::Graph::pie Create a pie chart.




        Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
           e                                           GD::Graph - Graph Plotting Module
Perguntas

Bars


 1   sub plotPng {
 2       my $fileName = shift ;
 3       @data = ( ["1 st " ,"2 nd " ,"3 rd " ,"4 th " ,"5 th " ,"6 th " ,"7 th " , "8 th " , "9 th "] ,
 4                  [     1,       2,       5,       6,       3 , 1.5 ,         1,        3,        4]
 5               );
 6       my $mygraph = GD :: Graph :: bars - > new (600 , 400) ;
 7
 8        $mygraph - > set (
 9            x_label        = > " Contestant " ,
10            y_label        = > " Time " ,
11            title          = > " Times of the contestants " ,
12            dclrs          = > [ qw ( gold red green ) ] ,
13        ) or warn $mygraph - > error ;
14
15        my $myimage = $mygraph - > plot ( @data ) or warn $mygraph - > error ;
16
17        open ( IMG , ’>’ , $fileName ) ;
18        binmode IMG ;
19        print IMG $myimage - > png ;
20        close ( IMG ) ;
21   }




              Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
                 e                                             GD::Graph - Graph Plotting Module
Perguntas

Bars - Output




       Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
          e                                           GD::Graph - Graph Plotting Module
Perguntas

Pie


 1    sub plotPng {
 2        my $fileName = shift ;
 3        @data = ( ["1 st " ,"2 nd " ,"3 rd " ,"4 th " ,"5 th " ,"6 th " ,"7 th " , "8 th " , "9 th "] ,
 4                   [     1,       2,       5,       6,       3 , 1.5 ,         1,        3,        4]
 5                );
 6        my $mygraph = GD :: Graph :: pie - > new (600 , 400) ;
 7
 8         $mygraph - > set (
 9             title          = > " Times of the contestants " ,
10             dclrs          = > [ qw ( gold red green ) ] ,
11         ) or warn $mygraph - > error ;
12
13         my $myimage = $mygraph - > plot ( @data ) or warn $mygraph - > error ;
14
15         open ( IMG , ’>’ , $fileName ) ;
16         binmode IMG ;
17         print IMG $myimage - > png ;
18         close ( IMG ) ;
19    }




               Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
                  e                                             GD::Graph - Graph Plotting Module
Perguntas

Pie - Output




       Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
          e                                           GD::Graph - Graph Plotting Module
Perguntas

Line


 1   sub plotPng {
 2       my $fileName = shift ;
 3       @data = ( ["1 st " ,"2 nd " ,"3 rd " ,"4 th " ,"5 th " ,"6 th " ,"7 th " , "8 th " , "9 th "] ,
 4                  [     1,       2,       5,       6,       3 , 1.5 ,         1,        3,        4]
 5               );
 6       my $mygraph = GD :: Graph :: area - > new (600 , 400) ;
 7
 8        $mygraph - > set (
 9            title          = > " Times of the contestants " ,
10            dclrs          = > [ qw ( gold red green ) ] ,
11        ) or warn $mygraph - > error ;
12
13        my $myimage = $mygraph - > plot ( @data ) or warn $mygraph - > error ;
14
15        open ( IMG , ’>’ , $fileName ) ;
16        binmode IMG ;
17        print IMG $myimage - > png ;
18        close ( IMG ) ;
19   }




              Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
                 e                                             GD::Graph - Graph Plotting Module
Perguntas

Line - Output




       Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
          e                                           GD::Graph - Graph Plotting Module
Perguntas

Area


 1   sub plotPng {
 2       my $fileName = shift ;
 3       @data = ( ["1 st " ,"2 nd " ,"3 rd " ,"4 th " ,"5 th " ,"6 th " ,"7 th " , "8 th " , "9 th "] ,
 4                  [     1,       2,       5,       6,       3 , 1.5 ,         1,        3,        4]
 5               );
 6       my $mygraph = GD :: Graph :: area - > new (600 , 400) ;
 7
 8        $mygraph - > set (
 9            title          = > " Times of the contestants " ,
10            dclrs          = > [ qw ( gold red green ) ] ,
11        ) or warn $mygraph - > error ;
12
13        my $myimage = $mygraph - > plot ( @data ) or warn $mygraph - > error ;
14
15        open ( IMG , ’>’ , $fileName ) ;
16        binmode IMG ;
17        print IMG $myimage - > png ;
18        close ( IMG ) ;
19   }




              Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
                 e                                             GD::Graph - Graph Plotting Module
Perguntas

Area - Output




       Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
          e                                           GD::Graph - Graph Plotting Module
Perguntas

Points and Lines


 1   sub plotPng {
 2       my $fileName = shift ;
 3       @data = ( ["1 st " ,"2 nd " ,"3 rd " ,"4 th " ,"5 th " ,"6 th " ,"7 th " , "8 th " , "9 th "] ,
 4                  [     1,       2,       5,       6,       3 , 1.5 ,         1,        3,        4]
 5               );
 6       my $mygraph = GD :: Graph :: points - > new (600 , 400) ;
 7
 8        $mygraph - > set (
 9            title          = > " Times of the contestants " ,
10            dclrs          = > [ qw ( gold red green ) ] ,
11        ) or warn $mygraph - > error ;
12
13        my $myimage = $mygraph - > linespoints ( @data ) or warn $mygraph - > error ;
14
15        open ( IMG , ’>’ , $fileName ) ;
16        binmode IMG ;
17        print IMG $myimage - > png ;
18        close ( IMG ) ;
19   }




              Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
                 e                                             GD::Graph - Graph Plotting Module
Perguntas

Points and Lines - Output




       Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
          e                                           GD::Graph - Graph Plotting Module
Perguntas

Examples of output formats




 1   print   IMG   $graph - > plot ( @data ) -> gif ;
 2   print   IMG   $graph - > plot ( @data ) -> png ;
 3   print   IMG   $graph - > plot ( @data ) -> gd ;
 4   print   IMG   $graph - > plot ( @data ) -> gd2 ;




             Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
                e                                           GD::Graph - Graph Plotting Module
Perguntas

Methods for all graphs


   GD :: Graph :: chart− > new (width, height) Create a new object
                graph with optional width and heigth. Default width
                = 400, default height = 300. chart is either bars,
                lines, points, linespoints, area, mixed or pie.
   graph− > set text clr (colourname) Set the colour of the text.
               This will set the colour of the titles, labels, and axis
               labels to colour name. Also see the options textclr ,
               labelclr and axislabelclr .
   graph− > set title font(fontspecification) Set the font that will
               be used for the title of the chart.
   graph− > plot(data) Plot the chart, and return the GD::Image
               object.


        Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
           e                                           GD::Graph - Graph Plotting Module
Perguntas

Methods for all graphs - 2



   graph− > set(attrib1 => value1, attrib2 => value2...) Set chart
               options.
   graph− > get(attrib1, attrib2) Returns a list of the values of the
               attributes. In scalar context returns the value of the
               first attribute only.
   graph− > gd() Get the GD::Image object that is going to be used
              to draw on. You can do this either before or after
              calling the plot method, to do your own drawing.




        Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
           e                                           GD::Graph - Graph Plotting Module
Perguntas

Methods for all graphs - 3



   graph− > export format() Query the export format of the GD
               library in use. In scalar context, it returns ’gif’, ’png’
               or undefined, which is sufficient for most people’s
               use. In a list context, it returns a list of all the
               formats that are supported by the current version of
               GD. It can be called as a class or object method
   graph− > can do ttf () Returns true if the current GD library
               supports TrueType fonts, False otherwise. Can also
               be called as a class method or static method.




         Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
            e                                           GD::Graph - Graph Plotting Module
Perguntas

Options for graphs with axes



   x label, y label The labels to be printed next to, or just below, the
                 axes. Note that if you use the two axes option that
                 you need to use y 1 label and y 2 label.
   show values Set this to 1 to display the value of each data point
               above the point or bar itself.
   values space Space to insert between the data point and the value
                to print. Default: 4.
   values format How to format the values for display.
   and many more. . .




        Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
           e                                           GD::Graph - Graph Plotting Module
Perguntas

Lines with show values




 1   $mygraph - > set (
 2       x_label = > " Contestant " ,
 3       y_label = > " Time " ,
 4       values_format = > sub { return sprintf ("% d " , shift ) ; } ,
 5       values_space = > 10 ,
 6       show_values = > 1 ,
 7       title           = > " Times of the contestants " ,
 8       dclrs           = > [ qw ( gold red green ) ]
 9   ) or warn $mygraph - > error ;




        Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
           e                                           GD::Graph - Graph Plotting Module
Perguntas

Lines with show values




       Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
          e                                           GD::Graph - Graph Plotting Module
Perguntas

Legends and multiple Y values


 1   my @legend_keys = (" Nr of lines " ," Nr of comments ") ;
 2   $mygraph - > set_legend ( @legend_keys ) ;
 3   $mygraph - > set (
 4       transparent      => 1,
 5       overwrite = > 0 ,
 6       fgclr = > black ,
 7       labelclr = > black ,
 8       axislabelclr = > black ,
 9       legendclr = > black ,
10       valuesclr = > black ,
11       textclr = > black ,
12       transparent      => 1,
13       overwrite = > 0 ,
14       b argroup_spacing = > 10 ,
15       show_values      => 1,
16       values_format = > sub { return sprintf ("% d " , shift ) ; } ,
17       values_space = > 10 ,
18       x_label          = > $x_label ,
19       y_label          = > $y_label ,
20       title            = > $title ,
21       dclrs            = > [ qw ( gold red green ) ] ,
22   ) or warn $mygraph - > error ;




        Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
           e                                           GD::Graph - Graph Plotting Module
Perguntas

Legends and multiple Y values - Output




       Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
          e                                           GD::Graph - Graph Plotting Module
Perguntas

Legends and multiple Y values 2 - Output




       Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
          e                                           GD::Graph - Graph Plotting Module
Perguntas

Overwrite bars


 1   my @legend_keys = (" Nr of lines " ," Nr of comments ") ;
 2   $mygraph - > set_legend ( @legend_keys ) ;
 3   $mygraph - > set (
 4       transparent      => 1,
 5       overwrite = > 2 ,
 6       fgclr = > black ,
 7       labelclr = > black ,
 8       axislabelclr = > black ,
 9       legendclr = > black ,
10       valuesclr = > black ,
11       textclr = > black ,
12       transparent      => 1,
13       overwrite = > 0 ,
14       b argroup_spacing = > 10 ,
15       show_values      => 1,
16       values_format = > sub { return sprintf ("% d " , shift ) ; } ,
17       values_space = > 10 ,
18       x_label          = > $x_label ,
19       y_label          = > $y_label ,
20       title            = > $title ,
21       dclrs            = > [ qw ( gold red green ) ] ,
22   ) or warn $mygraph - > error ;




        Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
           e                                           GD::Graph - Graph Plotting Module
Perguntas

Overwrite bars - Output




       Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
          e                                           GD::Graph - Graph Plotting Module
Perguntas

Perguntas




                                                      ?




       Jos´ Pedro Silva, Pedro Faria, Ulisses Costa
          e                                               GD::Graph - Graph Plotting Module

Más contenido relacionado

La actualidad más candente

Mobile Game and Application with J2ME - Collision Detection
Mobile Gameand Application withJ2ME  - Collision DetectionMobile Gameand Application withJ2ME  - Collision Detection
Mobile Game and Application with J2ME - Collision DetectionJenchoke Tachagomain
 
Mobile Game and Application with J2ME
Mobile Gameand Application with J2MEMobile Gameand Application with J2ME
Mobile Game and Application with J2MEJenchoke Tachagomain
 
ماترێکس به‌ کوردی ئارام
ماترێکس به‌ کوردی ئارامماترێکس به‌ کوردی ئارام
ماترێکس به‌ کوردی ئارامAram Jamal
 
computer graphics practicals
computer graphics practicalscomputer graphics practicals
computer graphics practicalsManoj Chauhan
 
FANNY HANIFAH (208700530)_INVENTORY_T1
FANNY HANIFAH (208700530)_INVENTORY_T1FANNY HANIFAH (208700530)_INVENTORY_T1
FANNY HANIFAH (208700530)_INVENTORY_T1Nifya Nafhhan
 

La actualidad más candente (7)

MS2 POwer Rules
MS2 POwer RulesMS2 POwer Rules
MS2 POwer Rules
 
662305 LAB13
662305 LAB13662305 LAB13
662305 LAB13
 
Mobile Game and Application with J2ME - Collision Detection
Mobile Gameand Application withJ2ME  - Collision DetectionMobile Gameand Application withJ2ME  - Collision Detection
Mobile Game and Application with J2ME - Collision Detection
 
Mobile Game and Application with J2ME
Mobile Gameand Application with J2MEMobile Gameand Application with J2ME
Mobile Game and Application with J2ME
 
ماترێکس به‌ کوردی ئارام
ماترێکس به‌ کوردی ئارامماترێکس به‌ کوردی ئارام
ماترێکس به‌ کوردی ئارام
 
computer graphics practicals
computer graphics practicalscomputer graphics practicals
computer graphics practicals
 
FANNY HANIFAH (208700530)_INVENTORY_T1
FANNY HANIFAH (208700530)_INVENTORY_T1FANNY HANIFAH (208700530)_INVENTORY_T1
FANNY HANIFAH (208700530)_INVENTORY_T1
 

Similar a GD::Graph - Graph Plotting Module

R visualization: ggplot2, googlevis, plotly, igraph Overview
R visualization: ggplot2, googlevis, plotly, igraph OverviewR visualization: ggplot2, googlevis, plotly, igraph Overview
R visualization: ggplot2, googlevis, plotly, igraph OverviewOlga Scrivner
 
Getting more out of Matplotlib with GR
Getting more out of Matplotlib with GRGetting more out of Matplotlib with GR
Getting more out of Matplotlib with GRJosef Heinen
 
An Introduction to Tinkerpop
An Introduction to TinkerpopAn Introduction to Tinkerpop
An Introduction to TinkerpopTakahiro Inoue
 
Python tools to deploy your machine learning models faster
Python tools to deploy your machine learning models fasterPython tools to deploy your machine learning models faster
Python tools to deploy your machine learning models fasterJeff Hale
 
Graph analysis platform comparison, pregel/goldenorb/giraph
Graph analysis platform comparison, pregel/goldenorb/giraphGraph analysis platform comparison, pregel/goldenorb/giraph
Graph analysis platform comparison, pregel/goldenorb/giraphAndrew Yongjoon Kong
 
K means clustering
K means clusteringK means clustering
K means clusteringAhmedasbasb
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2goMoriyoshi Koizumi
 
Digital Differential Analyzer Line Drawing Algorithm
Digital Differential Analyzer Line Drawing AlgorithmDigital Differential Analyzer Line Drawing Algorithm
Digital Differential Analyzer Line Drawing AlgorithmKasun Ranga Wijeweera
 
The Web map stack on Django
The Web map stack on DjangoThe Web map stack on Django
The Web map stack on DjangoPaul Smith
 
Seaborn graphing present
Seaborn graphing presentSeaborn graphing present
Seaborn graphing presentYilin Zeng
 

Similar a GD::Graph - Graph Plotting Module (12)

R visualization: ggplot2, googlevis, plotly, igraph Overview
R visualization: ggplot2, googlevis, plotly, igraph OverviewR visualization: ggplot2, googlevis, plotly, igraph Overview
R visualization: ggplot2, googlevis, plotly, igraph Overview
 
Getting more out of Matplotlib with GR
Getting more out of Matplotlib with GRGetting more out of Matplotlib with GR
Getting more out of Matplotlib with GR
 
An Introduction to Tinkerpop
An Introduction to TinkerpopAn Introduction to Tinkerpop
An Introduction to Tinkerpop
 
Python tools to deploy your machine learning models faster
Python tools to deploy your machine learning models fasterPython tools to deploy your machine learning models faster
Python tools to deploy your machine learning models faster
 
Graph analysis platform comparison, pregel/goldenorb/giraph
Graph analysis platform comparison, pregel/goldenorb/giraphGraph analysis platform comparison, pregel/goldenorb/giraph
Graph analysis platform comparison, pregel/goldenorb/giraph
 
K means clustering
K means clusteringK means clustering
K means clustering
 
Transmogrify
TransmogrifyTransmogrify
Transmogrify
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
 
Digital Differential Analyzer Line Drawing Algorithm
Digital Differential Analyzer Line Drawing AlgorithmDigital Differential Analyzer Line Drawing Algorithm
Digital Differential Analyzer Line Drawing Algorithm
 
The Web map stack on Django
The Web map stack on DjangoThe Web map stack on Django
The Web map stack on Django
 
C arrays
C arraysC arrays
C arrays
 
Seaborn graphing present
Seaborn graphing presentSeaborn graphing present
Seaborn graphing present
 

Más de Ulisses Costa

Automatic Test Generation for Space
Automatic Test Generation for SpaceAutomatic Test Generation for Space
Automatic Test Generation for SpaceUlisses Costa
 
Automatic Test Generation for Space
Automatic Test Generation for SpaceAutomatic Test Generation for Space
Automatic Test Generation for SpaceUlisses Costa
 
Static Code Analyzer - Part IV
Static Code Analyzer - Part IVStatic Code Analyzer - Part IV
Static Code Analyzer - Part IVUlisses Costa
 
Specifying and Implementing SNOW3G with Cryptol
Specifying and Implementing SNOW3G with CryptolSpecifying and Implementing SNOW3G with Cryptol
Specifying and Implementing SNOW3G with CryptolUlisses Costa
 
Static Code Analyzer - Part III
Static Code Analyzer - Part IIIStatic Code Analyzer - Part III
Static Code Analyzer - Part IIIUlisses Costa
 
Static Code Analyzer - Part II
Static Code Analyzer - Part IIStatic Code Analyzer - Part II
Static Code Analyzer - Part IIUlisses Costa
 
Static Code Analyzer - Part I
Static Code Analyzer - Part IStatic Code Analyzer - Part I
Static Code Analyzer - Part IUlisses Costa
 
Captura de Informação em Rede
Captura de Informação em RedeCaptura de Informação em Rede
Captura de Informação em RedeUlisses Costa
 
Correct sorting with Frama-C
Correct sorting with Frama-CCorrect sorting with Frama-C
Correct sorting with Frama-CUlisses Costa
 
The Cryptol Epilogue: Swift and Bulletproof VHDL
The Cryptol Epilogue: Swift and Bulletproof VHDLThe Cryptol Epilogue: Swift and Bulletproof VHDL
The Cryptol Epilogue: Swift and Bulletproof VHDLUlisses Costa
 
Splint the C code static checker
Splint the C code static checkerSplint the C code static checker
Splint the C code static checkerUlisses Costa
 
Exploring the Cryptol Toolset
Exploring the Cryptol ToolsetExploring the Cryptol Toolset
Exploring the Cryptol ToolsetUlisses Costa
 
Specification of SNOW 3G in Cryptol
Specification of SNOW 3G in CryptolSpecification of SNOW 3G in Cryptol
Specification of SNOW 3G in CryptolUlisses Costa
 
Snort - capturar e dissecar o tráfego da rede
Snort - capturar e dissecar o tráfego da redeSnort - capturar e dissecar o tráfego da rede
Snort - capturar e dissecar o tráfego da redeUlisses Costa
 
Uso de Honeypots com Honeyd
Uso de Honeypots com HoneydUso de Honeypots com Honeyd
Uso de Honeypots com HoneydUlisses Costa
 

Más de Ulisses Costa (20)

Automatic Test Generation for Space
Automatic Test Generation for SpaceAutomatic Test Generation for Space
Automatic Test Generation for Space
 
Automatic Test Generation for Space
Automatic Test Generation for SpaceAutomatic Test Generation for Space
Automatic Test Generation for Space
 
Static Code Analyzer - Part IV
Static Code Analyzer - Part IVStatic Code Analyzer - Part IV
Static Code Analyzer - Part IV
 
Specifying and Implementing SNOW3G with Cryptol
Specifying and Implementing SNOW3G with CryptolSpecifying and Implementing SNOW3G with Cryptol
Specifying and Implementing SNOW3G with Cryptol
 
Static Code Analyzer - Part III
Static Code Analyzer - Part IIIStatic Code Analyzer - Part III
Static Code Analyzer - Part III
 
Static Code Analyzer - Part II
Static Code Analyzer - Part IIStatic Code Analyzer - Part II
Static Code Analyzer - Part II
 
Static Code Analyzer - Part I
Static Code Analyzer - Part IStatic Code Analyzer - Part I
Static Code Analyzer - Part I
 
logCesium01
logCesium01logCesium01
logCesium01
 
Cesium Log ed2
Cesium Log ed2Cesium Log ed2
Cesium Log ed2
 
Captura de Informação em Rede
Captura de Informação em RedeCaptura de Informação em Rede
Captura de Informação em Rede
 
Cryptol experience
Cryptol experienceCryptol experience
Cryptol experience
 
Correct sorting with Frama-C
Correct sorting with Frama-CCorrect sorting with Frama-C
Correct sorting with Frama-C
 
The Cryptol Epilogue: Swift and Bulletproof VHDL
The Cryptol Epilogue: Swift and Bulletproof VHDLThe Cryptol Epilogue: Swift and Bulletproof VHDL
The Cryptol Epilogue: Swift and Bulletproof VHDL
 
Splint the C code static checker
Splint the C code static checkerSplint the C code static checker
Splint the C code static checker
 
Exploring the Cryptol Toolset
Exploring the Cryptol ToolsetExploring the Cryptol Toolset
Exploring the Cryptol Toolset
 
Specification of SNOW 3G in Cryptol
Specification of SNOW 3G in CryptolSpecification of SNOW 3G in Cryptol
Specification of SNOW 3G in Cryptol
 
Snort - capturar e dissecar o tráfego da rede
Snort - capturar e dissecar o tráfego da redeSnort - capturar e dissecar o tráfego da rede
Snort - capturar e dissecar o tráfego da rede
 
LDAP em VDM++
LDAP em VDM++LDAP em VDM++
LDAP em VDM++
 
Uso de Honeypots com Honeyd
Uso de Honeypots com HoneydUso de Honeypots com Honeyd
Uso de Honeypots com Honeyd
 
Apresentacao JML
Apresentacao JMLApresentacao JML
Apresentacao JML
 

Último

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Último (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

GD::Graph - Graph Plotting Module

  • 1. Perguntas GD::Graph - Graph Plotting Module Jos´ Pedro Silva e Pedro Faria Ulisses Costa Engenharia de Linguagens Projecto integrado January 22, 2011 Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 2. Perguntas Description GD::Graph is a perl5 module to create charts using the GD module. The following classes for graphs with axes are defined: GD::Graph::lines Create a line chart. GD::Graph::bars Create a bar chart with vertical or horizontal bars. GD::Graph::linespoints Combination of lines and points. GD::Graph::area Create a graph, representing the data as areas under a line. GD::Graph::pie Create a pie chart. Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 3. Perguntas Bars 1 sub plotPng { 2 my $fileName = shift ; 3 @data = ( ["1 st " ,"2 nd " ,"3 rd " ,"4 th " ,"5 th " ,"6 th " ,"7 th " , "8 th " , "9 th "] , 4 [ 1, 2, 5, 6, 3 , 1.5 , 1, 3, 4] 5 ); 6 my $mygraph = GD :: Graph :: bars - > new (600 , 400) ; 7 8 $mygraph - > set ( 9 x_label = > " Contestant " , 10 y_label = > " Time " , 11 title = > " Times of the contestants " , 12 dclrs = > [ qw ( gold red green ) ] , 13 ) or warn $mygraph - > error ; 14 15 my $myimage = $mygraph - > plot ( @data ) or warn $mygraph - > error ; 16 17 open ( IMG , ’>’ , $fileName ) ; 18 binmode IMG ; 19 print IMG $myimage - > png ; 20 close ( IMG ) ; 21 } Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 4. Perguntas Bars - Output Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 5. Perguntas Pie 1 sub plotPng { 2 my $fileName = shift ; 3 @data = ( ["1 st " ,"2 nd " ,"3 rd " ,"4 th " ,"5 th " ,"6 th " ,"7 th " , "8 th " , "9 th "] , 4 [ 1, 2, 5, 6, 3 , 1.5 , 1, 3, 4] 5 ); 6 my $mygraph = GD :: Graph :: pie - > new (600 , 400) ; 7 8 $mygraph - > set ( 9 title = > " Times of the contestants " , 10 dclrs = > [ qw ( gold red green ) ] , 11 ) or warn $mygraph - > error ; 12 13 my $myimage = $mygraph - > plot ( @data ) or warn $mygraph - > error ; 14 15 open ( IMG , ’>’ , $fileName ) ; 16 binmode IMG ; 17 print IMG $myimage - > png ; 18 close ( IMG ) ; 19 } Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 6. Perguntas Pie - Output Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 7. Perguntas Line 1 sub plotPng { 2 my $fileName = shift ; 3 @data = ( ["1 st " ,"2 nd " ,"3 rd " ,"4 th " ,"5 th " ,"6 th " ,"7 th " , "8 th " , "9 th "] , 4 [ 1, 2, 5, 6, 3 , 1.5 , 1, 3, 4] 5 ); 6 my $mygraph = GD :: Graph :: area - > new (600 , 400) ; 7 8 $mygraph - > set ( 9 title = > " Times of the contestants " , 10 dclrs = > [ qw ( gold red green ) ] , 11 ) or warn $mygraph - > error ; 12 13 my $myimage = $mygraph - > plot ( @data ) or warn $mygraph - > error ; 14 15 open ( IMG , ’>’ , $fileName ) ; 16 binmode IMG ; 17 print IMG $myimage - > png ; 18 close ( IMG ) ; 19 } Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 8. Perguntas Line - Output Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 9. Perguntas Area 1 sub plotPng { 2 my $fileName = shift ; 3 @data = ( ["1 st " ,"2 nd " ,"3 rd " ,"4 th " ,"5 th " ,"6 th " ,"7 th " , "8 th " , "9 th "] , 4 [ 1, 2, 5, 6, 3 , 1.5 , 1, 3, 4] 5 ); 6 my $mygraph = GD :: Graph :: area - > new (600 , 400) ; 7 8 $mygraph - > set ( 9 title = > " Times of the contestants " , 10 dclrs = > [ qw ( gold red green ) ] , 11 ) or warn $mygraph - > error ; 12 13 my $myimage = $mygraph - > plot ( @data ) or warn $mygraph - > error ; 14 15 open ( IMG , ’>’ , $fileName ) ; 16 binmode IMG ; 17 print IMG $myimage - > png ; 18 close ( IMG ) ; 19 } Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 10. Perguntas Area - Output Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 11. Perguntas Points and Lines 1 sub plotPng { 2 my $fileName = shift ; 3 @data = ( ["1 st " ,"2 nd " ,"3 rd " ,"4 th " ,"5 th " ,"6 th " ,"7 th " , "8 th " , "9 th "] , 4 [ 1, 2, 5, 6, 3 , 1.5 , 1, 3, 4] 5 ); 6 my $mygraph = GD :: Graph :: points - > new (600 , 400) ; 7 8 $mygraph - > set ( 9 title = > " Times of the contestants " , 10 dclrs = > [ qw ( gold red green ) ] , 11 ) or warn $mygraph - > error ; 12 13 my $myimage = $mygraph - > linespoints ( @data ) or warn $mygraph - > error ; 14 15 open ( IMG , ’>’ , $fileName ) ; 16 binmode IMG ; 17 print IMG $myimage - > png ; 18 close ( IMG ) ; 19 } Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 12. Perguntas Points and Lines - Output Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 13. Perguntas Examples of output formats 1 print IMG $graph - > plot ( @data ) -> gif ; 2 print IMG $graph - > plot ( @data ) -> png ; 3 print IMG $graph - > plot ( @data ) -> gd ; 4 print IMG $graph - > plot ( @data ) -> gd2 ; Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 14. Perguntas Methods for all graphs GD :: Graph :: chart− > new (width, height) Create a new object graph with optional width and heigth. Default width = 400, default height = 300. chart is either bars, lines, points, linespoints, area, mixed or pie. graph− > set text clr (colourname) Set the colour of the text. This will set the colour of the titles, labels, and axis labels to colour name. Also see the options textclr , labelclr and axislabelclr . graph− > set title font(fontspecification) Set the font that will be used for the title of the chart. graph− > plot(data) Plot the chart, and return the GD::Image object. Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 15. Perguntas Methods for all graphs - 2 graph− > set(attrib1 => value1, attrib2 => value2...) Set chart options. graph− > get(attrib1, attrib2) Returns a list of the values of the attributes. In scalar context returns the value of the first attribute only. graph− > gd() Get the GD::Image object that is going to be used to draw on. You can do this either before or after calling the plot method, to do your own drawing. Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 16. Perguntas Methods for all graphs - 3 graph− > export format() Query the export format of the GD library in use. In scalar context, it returns ’gif’, ’png’ or undefined, which is sufficient for most people’s use. In a list context, it returns a list of all the formats that are supported by the current version of GD. It can be called as a class or object method graph− > can do ttf () Returns true if the current GD library supports TrueType fonts, False otherwise. Can also be called as a class method or static method. Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 17. Perguntas Options for graphs with axes x label, y label The labels to be printed next to, or just below, the axes. Note that if you use the two axes option that you need to use y 1 label and y 2 label. show values Set this to 1 to display the value of each data point above the point or bar itself. values space Space to insert between the data point and the value to print. Default: 4. values format How to format the values for display. and many more. . . Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 18. Perguntas Lines with show values 1 $mygraph - > set ( 2 x_label = > " Contestant " , 3 y_label = > " Time " , 4 values_format = > sub { return sprintf ("% d " , shift ) ; } , 5 values_space = > 10 , 6 show_values = > 1 , 7 title = > " Times of the contestants " , 8 dclrs = > [ qw ( gold red green ) ] 9 ) or warn $mygraph - > error ; Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 19. Perguntas Lines with show values Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 20. Perguntas Legends and multiple Y values 1 my @legend_keys = (" Nr of lines " ," Nr of comments ") ; 2 $mygraph - > set_legend ( @legend_keys ) ; 3 $mygraph - > set ( 4 transparent => 1, 5 overwrite = > 0 , 6 fgclr = > black , 7 labelclr = > black , 8 axislabelclr = > black , 9 legendclr = > black , 10 valuesclr = > black , 11 textclr = > black , 12 transparent => 1, 13 overwrite = > 0 , 14 b argroup_spacing = > 10 , 15 show_values => 1, 16 values_format = > sub { return sprintf ("% d " , shift ) ; } , 17 values_space = > 10 , 18 x_label = > $x_label , 19 y_label = > $y_label , 20 title = > $title , 21 dclrs = > [ qw ( gold red green ) ] , 22 ) or warn $mygraph - > error ; Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 21. Perguntas Legends and multiple Y values - Output Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 22. Perguntas Legends and multiple Y values 2 - Output Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 23. Perguntas Overwrite bars 1 my @legend_keys = (" Nr of lines " ," Nr of comments ") ; 2 $mygraph - > set_legend ( @legend_keys ) ; 3 $mygraph - > set ( 4 transparent => 1, 5 overwrite = > 2 , 6 fgclr = > black , 7 labelclr = > black , 8 axislabelclr = > black , 9 legendclr = > black , 10 valuesclr = > black , 11 textclr = > black , 12 transparent => 1, 13 overwrite = > 0 , 14 b argroup_spacing = > 10 , 15 show_values => 1, 16 values_format = > sub { return sprintf ("% d " , shift ) ; } , 17 values_space = > 10 , 18 x_label = > $x_label , 19 y_label = > $y_label , 20 title = > $title , 21 dclrs = > [ qw ( gold red green ) ] , 22 ) or warn $mygraph - > error ; Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 24. Perguntas Overwrite bars - Output Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module
  • 25. Perguntas Perguntas ? Jos´ Pedro Silva, Pedro Faria, Ulisses Costa e GD::Graph - Graph Plotting Module