Difference between revisions of "Pgfplot"

From Wiki
Jump to navigation Jump to search
(Created page - to be enriched...)
 
m
 
(3 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
It is now included as a (third party) [http://modules.contextgarden.net module]  
 
It is now included as a (third party) [http://modules.contextgarden.net module]  
 
for ConTeXt (with [http://modules.contextgarden.net/TikZ TikZ])
 
for ConTeXt (with [http://modules.contextgarden.net/TikZ TikZ])
 +
 +
An alternative package is [[MPgraph]] using [[MetaPost]].
  
 
== Example ==
 
== Example ==
Line 9: Line 11:
 
(Data on low-temperature thermal expansion coefficients downloaded from [http://cryogenics.nist.gov/]).
 
(Data on low-temperature thermal expansion coefficients downloaded from [http://cryogenics.nist.gov/]).
  
<context source="yes">
+
<texcode>
 
\setupcolors[state=start]
 
\setupcolors[state=start]
 
\usemodule[tikz]
 
\usemodule[tikz]
 
\usemodule[pgfplots]
 
\usemodule[pgfplots]
 +
 +
\starttext
  
 
\starttikzpicture
 
\starttikzpicture
Line 35: Line 39:
 
         \stopaxis
 
         \stopaxis
 
\stoptikzpicture
 
\stoptikzpicture
</context>
 
  
{{todo|Download data files or locally processed result.}}
+
\stoptext
 +
</texcode>
 +
 
 +
[[Image:Pgfplot_example.png]]
  
 
[[Category:Modules]]
 
[[Category:Modules]]
 
[[Category:Graphics]]
 
[[Category:Graphics]]
[[Category:Math]]
+
[[Category:Sciences]]

Latest revision as of 17:29, 8 June 2020

< Modules | Graphics | Math >

Pgfplots is a data plotting package based on PGF/TikZ. It is now included as a (third party) module for ConTeXt (with TikZ)

An alternative package is MPgraph using MetaPost.

Example

(Data on low-temperature thermal expansion coefficients downloaded from [1]).

\setupcolors[state=start]
\usemodule[tikz]
\usemodule[pgfplots]

\starttext

\starttikzpicture
        \startaxis[     xmin=0,xmax=300,
                        title=http://cryogenics.nist.gov/,
                        xlabel=$T$ (K),
                        ylabel=$(L-L_{293})/L_{293}$,
                        legend style={at={(0.95,0.05)},anchor=south east},
                        width=16cm ]
                \addplot[mark=none,color=red] plot file {sapphire.dat};
                \addlegendentry{sapphire}
                \addplot[mark=none,color=green] plot file {Be.dat};
                \addlegendentry{Be}
                \addplot[mark=none,color=blue] plot file {BeCu.dat};
                \addlegendentry{BeCu}
                \addplot[mark=none,color=cyan] plot file {SS304.dat};
                \addlegendentry{SS304}
                \addplot[mark=none,color=magenta] plot file {Al6061-T6.dat};
                \addlegendentry{Al6061-T6}
                \addplot[mark=none,color=orange] plot file {nylon.dat};
                \addlegendentry{nylon}
        \stopaxis
\stoptikzpicture

\stoptext

Pgfplot example.png