You are on page 1of 60

More

PGFplots

Jennifer Wang

Introduction
to 3D plots More PGFplots
using
PGFPLOTS

Draw backs of
using
PGFPLOTS
for three Jennifer Wang
dimensional
plots

addplot3[options]input
data; Department of Electrical and Computer Engineerig
Auburn University
reading in a
set of
coordinates as
input

reading in a
July 26, 2010
math
expression as
input

reading in a
file as input
Introduction to 3D plots using PGFPLOTS

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS Why using PGFPLOTS for 3D plots
Draw backs of
using
PGFPLOTS
Consistent fonts
for three
dimensional Consistent styles
plots
High-quality outputs
addplot3[options]input
data;

reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
Draw backs of using PGFPLOTS for three
dimensional plots
More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS
PGFPLOTS’ three dimensional routines are slow.
Draw backs of
using The plot complexity of three dimensional plots is
PGFPLOTS
for three limited to relatively coarse resolutions.
dimensional
plots PGFPLOTS supports z buffering techniques up to a
addplot3[options]input
data;
certain extend.
reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
addplot3 [options]{input data};

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using
The addplot3 command accepts the same input methods as
PGFPLOTS the addplot variant, including coordinates, expression
for three
dimensional plotting, files and tables.
plots

addplot3[options]input
data;

reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
\addplot3 coordinates {...};

More
PGFplots
coordinates in form of matrix
Jennifer Wang
seperated by a line space
Introduction Code
to 3D plots
using
PGFPLOTS
\begin{tikzpicture}
Draw backs of
\begin{axis}
using \addplot[surf] coordinates{
PGFPLOTS
for three
dimensional
(0,0,0) (1,0,0) (2,0,0) (3,0,0)
plots

addplot3[options]input
(0,1,0) (1,1,0.6) (2,1,0.7) (3,1,0.5)
data;

reading in a
set of
coordinates as
(0,2,0) (1,2,0.7) (2,2,0.8) (3,2,0.5)
input
};
reading in a
math \end{axis}
expression as
input
\end{tikzpicture}
reading in a
file as input
\addplot3 coordinates {...};

More
PGFplots

Jennifer Wang coordinates in form of matrix


Introduction
seperated by \par
to 3D plots
using Code
PGFPLOTS
\begin{tikzpicture}
Draw backs of
using \begin{axis}
PGFPLOTS
for three \addplot[surf] coordinates{
dimensional
plots (0,0,0) (1,0,0) (2,0,0) (3,0,0)\par
(0,1,0) (1,1,0.6) (2,1,0.7) (3,1,0.5)\par
addplot3[options]input
data;
(0,2,0) (1,2,0.7) (2,2,0.8) (3,2,0.5)\par
reading in a
set of };
coordinates as
input \end{axis}
reading in a \end{tikzpicture}
math
expression as
input

reading in a
file as input
\addplot3 coordinates {...};

More
PGFplots
coordinates in form of matrix
Jennifer Wang
mesh \rows = {interger}
Introduction mesh \cols = {interger}
to 3D plots
using Code
PGFPLOTS

Draw backs of
\begin{tikzpicture}
using \begin{axis}
PGFPLOTS
for three
dimensional
\addplot3[surf,mesh/rows=3] coordinates{
plots % this also yields a 3x4 matrix
addplot3[options]input
(0,0,0) (1,0,0) (2,0,0) (3,0,0)
data;

reading in a
(0,1,0) (1,1,0.6) (2,1,0.7) (3,1,0.5)
set of
coordinates as
(0,2,0) (1,2,0.7) (2,2,0.8) (3,2,0.5)
input
};
reading in a
math \end{axis}
expression as
input
\end{tikzpicture}
reading in a
file as input
\addplot3 coordinates {...};

More
PGFplots
Plot
Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using 0.8
PGFPLOTS
for three
0.6
dimensional
plots
0.4
addplot3[options]input
data;
0.2
reading in a 2
set of
coordinates as 0 1.5
input 1
0
0.5
reading in a 1
1.5 0.5
math 2
2.5
expression as 3 0
input

reading in a
file as input
\addplot3 {math expression};

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS
Code
Draw backs of \begin{tikzpicture}
using
PGFPLOTS
\begin{axis}
for three
dimensional
\addplot3{6-2*x-3*y};
plots \end{axis}
addplot3[options]input
data;
\end{tikzpicture}
reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
\addplot3 {math expression};

More
PGFplots
Plot
Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using 30
PGFPLOTS
for three 20
dimensional
plots 10
addplot3[options]input
data; 0

reading in a −10
set of 4
coordinates as −20 2
input 0
−5 −4 −3 −2
reading in a −1 0 −2
math 1 2 3 4 −4
expression as 5
input

reading in a
file as input
\addplot3 {math expression};

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
controling plotting area:
PGFPLOTS Interval[x1,x2]: domain
Draw backs of
using
Interval[y1,y2]: y domain
PGFPLOTS
for three
dimensional
plots

controling number of samples:


addplot3[options]input
data;
Number of samples in x direction: samples
reading in a
set of Number of samples in y direction: samples y
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
\addplot3 {math expression};

More
PGFplots

Jennifer Wang

Code
Introduction
to 3D plots
using
\begin{tikzpicture}
PGFPLOTS \begin{axis}[colorbar]
Draw backs of
using
\addplot3
PGFPLOTS
for three
[surf,faceted color=blue,
dimensional
plots
samples=15,
addplot3[options]input
domain=0:1,y domain=-1:1]
data; {xˆ2 - yˆ2};
reading in a
set of
\end{axis}
coordinates as \end{tikzpicture}
input

reading in a
math
expression as
input

reading in a
file as input
\addplot3 {math expression};

More
PGFplots
Plot
Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using 1
PGFPLOTS
for three
0.5
dimensional
plots
0
addplot3[options]input
data;
−0.5
reading in a 1
set of
coordinates as −1 0.5
input 0
0 0.1 0.2 0.3
reading in a 0.4 0.5 0.6 −0.5
math 0.7 0.8
expression as 0.9 1 −1
input

reading in a
file as input
\addplot file {file name};

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS generating file by notepad
Draw backs of
using saving as .dat file
PGFPLOTS
for three needing to have at least 2 columns for 2D and 3
dimensional
plots columns for 3D
addplot3[options]input
data; lines starting with % and # are ignored
reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
\addplot file {file name};

More
PGFplots

Jennifer Wang
Code
\begin{axis}
Introduction
to 3D plots \addplot file {plotdata.dat};
using
PGFPLOTS \end{axis}
Draw backs of \end{tikzpicture}
using
PGFPLOTS
for three
dimensional plotdata.dat
plots
0
addplot3[options]input
1
data;
1 2
reading in a
set of 2 3
coordinates as
input
3 4
reading in a 4 5
math
expression as 6 7
input

reading in a
file as input
\addplot file {file name};

More
PGFplots

Jennifer Wang

Introduction
to 3D plots Plot
using
PGFPLOTS

Draw backs of 6
using
PGFPLOTS
for three 4
dimensional
plots
2
addplot3[options]input
data;

reading in a 0 1 2 3 4 5 6
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
\addplot table [column selection] {file};

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS plot table similar to plot file .
Draw backs of
using
generating file by notepad
PGFPLOTS
for three saving as .dat file
dimensional
plots multiple columns
addplot3[options]input
data; plotting certain columns
reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
\addplot table [column selection] {file};

More
PGFplots

Jennifer Wang
Code
\begin{axis}
Introduction
to 3D plots \addplot table[x=a,y=c] {plottable.dat};
using
PGFPLOTS \end{axis}
Draw backs of \end{tikzpicture}
using
PGFPLOTS
for three
dimensional plottable.dat
plots
a
addplot3[options]input
b c
data;
0 1 2
reading in a
set of 2 3 4
coordinates as
input
4 5 6
reading in a 6 7 8
math
expression as 8 9 10
input

reading in a
file as input
\addplot table [column selection] {file};

More
PGFplots

Jennifer Wang

Introduction
to 3D plots Plot
using
PGFPLOTS 10

Draw backs of
using 8
PGFPLOTS
for three 6
dimensional
plots
4
addplot3[options]input
data; 2

reading in a 0 2 4 6 8
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
line plots for coordinates input

More
PGFplots

Jennifer Wang

Introduction
generated if input source has no matrix structure
to 3D plots
using
PGFPLOTS

Draw backs of
using Code
PGFPLOTS
for three \begin{tikzpicture}
dimensional
plots \begin{axis}[xlabel=$x$,ylabel=$y$]
\addplot3 coordinates{(0,0,0)(0,0.5,1)(0,1,0)};
addplot3[options]input
data;
\addplot3 coordinates{(0,1,0)(0.5,1,1)(1,1,0)};
reading in a
set of
\end{axis}
coordinates as \end{tikzpicture}
input

reading in a
math
expression as
input

reading in a
file as input
line plots:generated if input source has no
matrix structure
More
PGFplots
Plot
Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using 1
PGFPLOTS
for three 0.8
dimensional
plots 0.6

addplot3[options]input
data; 0.4

reading in a 0.2 1
set of
0.8
coordinates as 0
input 0.6
0 0.1 0.2 0.4 y
reading in a 0.3 0.4 0.5 0.6 0.2
math 0.7
x 0.8 0.9
expression as 1 0
input

reading in a
file as input
line plots for expression input

More
PGFplots

Jennifer Wang
set samples y=0 to disable the generation of a mesh
Introduction
to 3D plots
using
PGFPLOTS

Draw backs of Code


using
PGFPLOTS \begin{tikzpicture}
for three
dimensional
\begin{axis}[view={60}{30}]
plots \addplot3+[domain=0:5*pi,samples=60,samples y=0]
({sin(deg(x))},
addplot3[options]input
data;
{cos(deg(x))},
reading in a
set of {2*x/(5*pi)});
coordinates as
input
\end{axis}
reading in a
\end{tikzpicture}
math
expression as
input

reading in a
file as input
line plots for expression input

More
PGFplots
Plot
Jennifer Wang

Introduction
to 3D plots
using 2
PGFPLOTS

Draw backs of 1.5


using
PGFPLOTS
for three 1
dimensional
plots
0.5
addplot3[options]input
data;
0
reading in a
set of
coordinates as −0.5
input 0.8
1
0
0.2 0.4 0.6
reading in a 0.5 0
math −0.6 −0.4 −0.2
expression as 1 −1 −0.8
input

reading in a
file as input
More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
addplot + [options] does the same as addplot [options];
using
PGFPLOTS
except that [options] are appended to the arguments which
for three would have been taken for addplot (the element of the
dimensional
plots default list).
addplot3[options]input
data;

reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
How does mesh plot work

More
PGFplots

Jennifer Wang

Introduction A mesh plot uses different color for each mesh


to 3D plots
using segment. Each mesh segment gets the same color.
PGFPLOTS

Draw backs of
The colour is determined using a color coordinate. In
using
PGFPLOTS
the initial configuration, the color coordinate is the z
for three
dimensional
axis.
plots
This color coordinate is mapped linearly into the
addplot3[options]input
data; current color map to determine the color for each mesh
reading in a segment.
set of
coordinates as
input
This works the same for surface plots and scatter plots.
reading in a
math
expression as
input

reading in a
file as input
addplot3[mesh]

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS
Code
Draw backs of \begin{tikzpicture}
using
PGFPLOTS
\begin{axis}[colorbar]
for three
dimensional
\addplot3[mesh] {xˆ2};
plots \end{axis}
addplot3[options]input
data;
\end{tikzpicture}
reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
addplot3[mesh]

More
PGFplots
Plot
Jennifer Wang
24
Introduction 22
to 3D plots
using 20
PGFPLOTS
18
Draw backs of
using 25 16
PGFPLOTS
for three 20 14
dimensional
plots 12
15

addplot3[options]input 10
10
data;
8
reading in a 5
set of 4 6
coordinates as 0 2
4
input 0
−5 −4 −3 −2 2
reading in a −1 0 −2
math 1 2 3 4 −4 0
expression as 5
input

reading in a
file as input
addplot3[mesh]

More
PGFplots

Jennifer Wang A mesh plot can be combined with markers or with the
Introduction
scatter key to draw markers in different colors.
to 3D plots
using
PGFPLOTS

Draw backs of
using Code
PGFPLOTS
for three \begin{tikzpicture}
dimensional
plots \begin{axis}
\addplot3+[mesh,scatter,
addplot3[options]input
data;
samples=10,domain=0:1]
reading in a
set of {x*(1-x)*y*(1-y)};
coordinates as
input \end{axis}
reading in a \end{tikzpicture}
math
expression as
input

reading in a
file as input
addplot3[mesh]

More
PGFplots
Plot
Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using 6 · 10−2
PGFPLOTS
for three 5 · 10−2
dimensional
plots 4 · 10−2

addplot3[options]input 3 · 10−2
data;
2 · 10−2
reading in a 1
1 · 10−2
set of 0.8
coordinates as 0
input 0.6
0 0.1 0.2 0.4
reading in a 0.3 0.4 0.5 0.6 0.2
math 0.7 0.8
expression as 0.9 1 0
input

reading in a
file as input
addplot3[surf]

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS
Code
Draw backs of \begin{tikzpicture}
using
PGFPLOTS
\begin{axis}
for three
dimensional
\addplot3[surf,faceted color=blue] {x+y};
plots \end{axis}
addplot3[options]input
data;
\end{tikzpicture}
reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
addplot3[surf]

More
PGFplots
Plot
Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using 10
PGFPLOTS
for three
5
dimensional
plots
0
addplot3[options]input
data;
−5
reading in a
set of 4
coordinates as −10 2
input 0
−5 −4 −3 −2
reading in a −1 0 −2
math 1 2 3 4 −4
expression as 5
input

reading in a
file as input
How does z buffer work

More
PGFplots

Jennifer Wang
A z buffer determines which parts of an image should
Introduction be drawn in front of other parts.
to 3D plots
using The z buffering algorithms of pgfplots apply only to a
PGFPLOTS
single addplot command. Different addplot commands
Draw backs of
using will be drawn on top of each other, in the order of
PGFPLOTS
for three appearance.
dimensional
plots
The choice default checks if we are currently working
addplot3[options]input
data; with a mesh or surface plot and uses auto in this case.
reading in a If not, it sets z buffer=none .
set of
coordinates as The choice none disables z buffering. This is also the
input

reading in a
case for two dimensional axes which don’t need z
math buffering.
expression as
input

reading in a
file as input
Different styles of markers

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using
PGFPLOTS
for three
dimensional
plots

addplot3[options]input
data;

reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
More styles of markers

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using
PGFPLOTS
for three
dimensional
plots

addplot3[options]input
data;

reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
An example of using different marks

More
PGFplots Code
Jennifer Wang \begin{tikzpicture}
Introduction
\begin{axis}[y=2cm]
to 3D plots
using
\addplot [mark=otimes] coordinates
PGFPLOTS {(-2,0) (-1,1) (0,0) (1,1) (2,0)};
Draw backs of
using
\end{axis}
PGFPLOTS
for three
\end{tikzpicture}
dimensional
plots
\tikzset{every mark/.append style={scale=2,
mark=otimes}}
addplot3[options]input
data; \begin{tikzpicture}
reading in a
set of
\begin{axis}[y=2cm,mark=otimes]
coordinates as \addplot coordinates
input

reading in a
{(-2,0) (-1,1) (0,0) (1,1) (2,0)};
math
expression as
\end{axis}
input
\end{tikzpicture}
reading in a
file as input
An example of using different marks

More
PGFplots
Plot
Jennifer Wang
1
Introduction
to 3D plots
using
PGFPLOTS 0.5
Draw backs of
using
PGFPLOTS 0
for three
dimensional −2 −1 0 1 2
plots

addplot3[options]input
1
data;

reading in a
set of 0.5
coordinates as
input

reading in a 0
math
expression as −2 −1 0 1 2
input

reading in a
file as input
Different styles of lines

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using
PGFPLOTS
for three
dimensional
plots

addplot3[options]input
data;

reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
An example of using different line styles

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
Code
PGFPLOTS
\begin{tikzpicture}
Draw backs of
using \begin{axis}[y=2cm]
PGFPLOTS
for three \addplot[mark=otimes,dashed] coordinates
dimensional
plots {(-2,0) (-1,1) (0,0) (1,1) (2,0)};
\end{axis}
addplot3[options]input
data;
\end{tikzpicture}
reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
An example of using different line styles

More
PGFplots

Jennifer Wang

Introduction
to 3D plots Plot
using
PGFPLOTS
1
Draw backs of
using
PGFPLOTS
for three 0.5
dimensional
plots

addplot3[options]input 0
data;

reading in a
−2 −1 0 1 2
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
Line width

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
thin
PGFPLOTS
ultra thin
Draw backs of
using very thin
PGFPLOTS
for three
dimensional semithick
plots
thick
addplot3[options]input
data;
very thick
reading in a
set of ultra thick
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
Font size

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
Sets the font which is to be used for text in nodes (like
using
PGFPLOTS
tick labels, legends or descriptions).
for three
dimensional A font can be any LATEX argument like footnotesize or
plots
small \bfseries.
addplot3[options]input
data;

reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
Colors

More
PGFplots

Jennifer Wang The package xcolor defines a set of predefined colors,


namely red, green, blue, cyan,magenta, yellow, black,
Introduction
to 3D plots gray, white, darkgray, lightgray, brown, lime,olive,
using
PGFPLOTS orange, pink, purple, teal, violet.
Draw backs of
using
Besides predefined colors, it is possible to mix two (or
PGFPLOTS
for three
more) colors. For example, red!30!white contains 30%
dimensional
plots
of red and 70% of white. Consequently, one can build
addplot3[options]input
red!70!white to get 70% red and 30% white or
data;
red!10!white for 10% red and 90% white.
reading in a
set of A different type of color mixing is supported, which
coordinates as
input allows to take 100% of each component. For example,
reading in a rgb,2:red,1;green,1 will add 1/2 part red and 1/2 part
math
expression as green.
input

reading in a
file as input
Color Maps

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS
By using commands
Draw backs of
using colormap name = {color map name} or colormap \a
PGFPLOTS
for three kind of colormap, it changes the current color map to
dimensional
plots
the already defined map named.
addplot3[options]input The predefined color map is hot.
data;

reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
Different color maps

More
PGFplots

Jennifer Wang
hot
Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using
PGFPLOTS
for three
dimensional
bluered
plots
cool
addplot3[options]input
data; greenyellow
reading in a
set of redyellow
coordinates as
input violet
reading in a
math blackwhite
expression as
input

reading in a
file as input
An example of using a different axis
background
More
PGFplots

Jennifer Wang

Introduction
to 3D plots Code
using
PGFPLOTS \begin{tikzpicture}
Draw backs of \begin{axis}[
using
PGFPLOTS axis background/.style={fill=red!30!white}]
for three
dimensional \addplot3[surf,y domain=0:1]
plots
{sin(deg(x)) * y*(1-y)};
addplot3[options]input
data; \end{axis}
reading in a \end{tikzpicture}
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
An example of using a different axis
background
More
PGFplots Plot
Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using
PGFPLOTS 0.2
for three
dimensional
plots

addplot3[options]input
0
data;

reading in a 1
set of
coordinates as
−0.2
input
−4 0.5
reading in a −2 0
math 2 4
expression as
input
0
reading in a
file as input
width={ }

More
PGFplots
Sets the width of the final picture to { }. If no height is
Jennifer Wang
specified, scaling will respect aspect ratios.
Introduction
to 3D plots
using
Code
PGFPLOTS
\begin{tikzpicture}
Draw backs of
using \begin{axis}[width=3cm]
PGFPLOTS
for three \addplot3{6-2*x-3*y};
dimensional
plots \end{axis}
\end{tikzpicture}
addplot3[options]input
data;
\begin{tikzpicture}
reading in a
set of \begin{axis}[width=6cm]
coordinates as
input \addplot3{6-2*x-3*y};
reading in a \end{axis}
math
expression as \end{tikzpicture}
input

reading in a
file as input
width={ }

More
PGFplots

Jennifer Wang
Plot
Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using
PGFPLOTS
for three 20
dimensional
plots 0
addplot3[options]input 5
data;
20 −20
0 −5 0
reading in a
−20
set of
coordinates as
−5 0 5 −05 5 0
5 −5
input

reading in a
math
expression as
input

reading in a
file as input
scale={number}

More
PGFplots width={ } only affects the width of one unit in x-direction
Jennifer Wang or the height for one unit in y-direction. Axis labels and tick
labels won’t be resized.
Introduction
to 3D plots We can use the scale={number} option to scale the complete
using
PGFPLOTS
picture.
Draw backs of
using Code
PGFPLOTS
for three \begin{tikzpicture}[scale=2]
dimensional
plots \begin{axis}
\addplot3{6-2*x-3*y};
addplot3[options]input
data; \end{axis}
reading in a \end{tikzpicture}
set of
coordinates as \begin{tikzpicture}
input
\begin{axis}
reading in a
math
\addplot3{6-2*x-3*y};
expression as \end{axis}
input
\end{tikzpicture}
reading in a
file as input
scale={number}

More Plot scale=2


PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using
PGFPLOTS
for three
dimensional
20
plots

addplot3[options]input
data;
0
reading in a
set of
coordinates as −20 5
input
−5 0
reading in a
math 0
expression as
input 5 −5
reading in a
file as input
scale={number}

More
PGFplots Plot no scaling
Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using
PGFPLOTS
for three
dimensional
20
plots

addplot3[options]input
data; 0
reading in a
set of
5
coordinates as
input
−20
−4 0
reading in a −2 0
math
expression as
2 4
input −5
reading in a
file as input
3D view configuration

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS
use command view = { azimuth } { elevation }.
Draw backs of The azimuth (first argument) is the horizontal angle
using
PGFPLOTS which is rotated around the z axis.
for three
dimensional
plots
The elevation (second argument) is the vertical rotation
addplot3[options]input
around the (rotated) x axis.
data;
Default value is {25}{30}.
reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
view = { azimuth } { elevation }

More
PGFplots

Jennifer Wang

Introduction Code
to 3D plots
using \begin{tikzpicture}
PGFPLOTS
\begin{axis}[view={0}{0},
Draw backs of
using xlabel=$x$,
PGFPLOTS
for three zlabel=$z$,
dimensional
plots title=View along the positive $y$ axis]
\addplot3[surf] {x};
addplot3[options]input
data;

reading in a
\end{axis}
set of
coordinates as
\end{tikzpicture}
input

reading in a
math
expression as
input

reading in a
file as input
view = { azimuth } { elevation }

More Plot
PGFplots

Jennifer Wang View along the positive y axis


Introduction
6
to 3D plots
using
PGFPLOTS 4
Draw backs of
using
PGFPLOTS
for three
2
dimensional
plots
0
z

addplot3[options]input
data;

reading in a
set of
−2
coordinates as
input

reading in a
−4
math
expression as
input −6
reading in a
−4 −2 0 2 4
file as input
view = { azimuth } { elevation }

More
PGFplots

Jennifer Wang

Introduction Code
to 3D plots
using \begin{tikzpicture}
PGFPLOTS
\begin{axis}[view={0}{90},
Draw backs of
using xlabel=$x$,
PGFPLOTS
for three ylabel=$y$,
dimensional
plots title=View from top]
\addplot3[surf] {x};
addplot3[options]input
data;

reading in a
\end{axis}
set of
coordinates as
\end{tikzpicture}
input

reading in a
math
expression as
input

reading in a
file as input
view = { azimuth } { elevation }

More Plot
PGFplots

Jennifer Wang View from top


Introduction
to 3D plots
using 4
PGFPLOTS

Draw backs of
using
PGFPLOTS 2
for three
dimensional
plots
0
y

addplot3[options]input
data;

reading in a
set of −2
coordinates as
input

reading in a
math −4
expression as
input

reading in a −4 −2 0 2 4
file as input
view = { azimuth } { elevation }

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
Code
PGFPLOTS
\begin{tikzpicture}
Draw backs of
using \begin{axis}[view={-45}{45},
PGFPLOTS
for three xlabel=$x$,ylabel=$y$,zlabel=$z$]
dimensional
plots \addplot3[surf] {x};
\end{axis}
addplot3[options]input
data;
\end{tikzpicture}
reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
view = { azimuth } { elevation }

More
PGFplots
Plot
Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using
5
PGFPLOTS
for three
0
z

dimensional
plots

addplot3[options]input
data; −5
reading in a
set of
coordinates as
4 4
input
2 2
0 0
reading in a
math −2 −2
expression as y −4 −4 x
input

reading in a
file as input
3D view configuration

More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using
use view \h = { } to change only horizontal rotating
PGFPLOTS angle.
for three
dimensional
plots
use view \v = { } to change only vertical rotating angle.
addplot3[options]input
data;

reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input
More
PGFplots

Jennifer Wang

Introduction
to 3D plots
using
PGFPLOTS

Draw backs of
using
PGFPLOTS
for three Questions
dimensional
plots

addplot3[options]input
data;

reading in a
set of
coordinates as
input

reading in a
math
expression as
input

reading in a
file as input

You might also like