Posts mit dem Label tikz werden angezeigt. Alle Posts anzeigen
Posts mit dem Label tikz werden angezeigt. Alle Posts anzeigen

Donnerstag, 16. Juli 2015

cut out part of figure in tikz

To cut out a figure (here i used a rule instead) you can use a node shape as a cut out mask as shown in the following:

\begin{tikzpicture}
\node[regular polygon, path picture={
  \node at (path picture bounding box.center)
  { \rule{4cm}{3cm} };
}
,minimum width=2.5cm,minimum height=2cm] {};
\end{tikzpicture}

instead of \rule{width}{height} you can use a \includegraphics command.

For a rectangle be aware that you have to set the minimum width and minimum height the same size as the picture otherwise a white border will remain.


Mittwoch, 15. Juli 2015

3d plots in tikz

To plot a 3d plot with latex in tikz you should use the tikz3dplot package:
\usepackage{tikz-3dplot}

 you can define the coordinate system by using:
\tdplotsetmaincoords{70}{110}

after that you can use 3d coordinate definitions:
\begin{tikzpicture}[tdplot_main_coords]
\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};
\end{tikzpicture}

shift in nodes in tikz

for a shift in one direction use the option:

yshift=LENGTH
xshift=LENGTH

for a shift in both directions use:

shift=({XSHIFT,YSHIFT})

Example:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw [help lines] (0,0) grid (4,4);
\node (A) at (2,1) {A};
\path ([yshift=2cm]A) node {B};
\node (C) at ([yshift=1cm]A) {C};
\node (D) at ([shift=({1cm,1cm})]A) {D};
\end{tikzpicture}

\end{document}

Donnerstag, 15. Januar 2015

round numbers in tikz with pgfmath

To round numbers using pgfplots in the tikzpicture environment use \pgfmathparse to calculate the desired value and then print it to with \pgfmathprintnumber or print it to a variable with \pgfmathprintnumberto and use the optional parameter precision, as shown in the following:
\pgfmathparse{10.042/1.54}
\pgfmathprintnumberto[precision=2]{\pgfmathresult}{\value}
\value

Mittwoch, 17. Dezember 2014

layers in tikz in latex

To define a layer in tikz you would first in the preamble define a new layer with a defined name (here i chose "layer") and then set the order of the layers especially in comparison to the standard "main" layer.

\pgfdeclarelayer{layer}    % declare layer
\pgfsetlayers{layer,main}  % set the order of the layers (main is the standard layer)

in the plotting step you can then explicitly plot on a different layer by using the pgfonlayer environment

\begin{pgfonlayer}{layer}
      \draw[ultra thick] (0.0,0.0) -- ++ (1.0,0.0);
\end{pgfonlayer}

Donnerstag, 23. Oktober 2014

Latex (tikz) emphasize part of graphic

http://tex.stackexchange.com/questions/181098/semitransparent-outside-clipped-region

Montag, 18. November 2013

latex documentclass standalone

To create a standalone image with latex, e.g. using tikz or pstricks, one should use the documentclass standalone. The Standalone document just contains the figure itself without the rest of the document.

 \documentclass{standalone} 

additionally several options can be added:

[tikz]
sets the standalone package as multi images and set every new tikzpicture environment on a seperate page:

 \documentclass[tikz]{standalone} 




additional Infos via standalone documentation

Mittwoch, 31. Juli 2013

gnuplot tikz terminal

 Just now i found out about the tikz terminal in gnuplot 4.6 and just tried it out. It works very nicely, but I think I have to put a little bit of effort into it if its worth to change from pdflatex terminal to lua tikz.
But here is how it works:

Usage

 set terminal lua tikz standalone
 set output "test.tex"  
 plot sin(x)   

standalone/nostandalone/fulldoc

Compiling

 > pdflatex test.tex
immediate compiling only works as far as I saw for standalone and fulldoc

UPDATE COMING SOON