Latex 绘图小清新

发一颗圣诞树供大家学习哟。


code:

\documentclass[11pt]{scrartcl} 
\usepackage[dvipsnames,svgnames]{xcolor}  
\usepackage{tikz}
\usetikzlibrary{shapes,decorations.shapes}
\newsavebox{\mycandle}
\savebox{\mycandle}{ 
\begin{tikzpicture}[scale=.1]
\shade[top color=yellow,bottom color=red] (0,0) .. controls (1,.2) and (1,.5) .. (0,2) .. controls (-1,.5)  and  (-1,.2) .. (0,0);
\fill[yellow!90!black] (.8,0) rectangle (-.8,-5); 
\end{tikzpicture} } 

\tikzset{
  paint/.style={draw=#1!50!black, fill=#1!50},
  my star/.style={decorate,decoration={shape backgrounds,shape=star},
                  star points=#1}
}  

\begin{document}
\begin{tikzpicture} 
   \draw[fill=Maroon,ultra thick] 
   (.75,-1)  ..  controls (.5,.5)  and   (.5,3)    .. (0.5,4) 
-- (-0.5,4)  ..  controls (-.5,3) and (-.5,.5)     .. (-.75,-1) ;
\draw[ultra thick,fill=green!50!black] 
      (0,10) .. controls  (0,8)     and   (1,7)    .. (1.5,7) 
             ..  controls (1,7)     and   (1,7)    .. (0.5,7.25) 
             ..  controls (1.5,5)   and   (2.5,4)  .. (3,4)
             ..  controls (2,4)     and   (1.25,4) .. (1,4.5)
             ..  controls (2,2)     and   (3.5,2)  .. (4,2)
             ..  controls (1,1)     and   (-1,1)   .. (-4,2) 
             ..  controls (-3.5,2)  and   (-2,2)   .. (-1,4.5)
             ..  controls (-1.25,4) and   (-2,4)   .. (-3,4) 
             ..  controls (-2.5,4)  and   (-1.5,5) .. (-0.5,7.25) 
             ..  controls  (-1,7)   and   (-1,7)   .. (-1.5,7)
             ..  controls  (-1,7)   and   (0,8)    .. (0,10)
              ;
\foreach \candle in {(2,5),(-2,5),(0.5,7.5),(-0.5,7.5),(-3,2.5), (3,2.5),
                    (1.5,1.75),(-1.5,1.75)}
\node at \candle {\usebox{\mycandle}} ; 
 \node [star, star point height=.5cm, minimum size=.5cm, draw,fill=yellow,thick]
       at (0,10) {};
       \begin{scope}[decoration={shape sep=.2cm, shape size=.25cm}] 
    \draw [my star=6, paint=red]  (-4,2)
             ..  controls (0,2)     and   (1,3.5)   .. (1,4.5)
             ..  controls (1,6)     and   (0.5,6)      .. (0.5,7.25); 
    \draw [my star=6, paint=blue]  (4,2)
             ..  controls  (0,2) and (-1,3.5)      .. (-1,4.5)             
             ..  controls (-1,6)     and   (-0.5,6)      .. (-0.5,7.25);    
       \end{scope}  
\end{tikzpicture}

\end{document} 

效果:Latex 绘图小清新_第1张图片



code2:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{lindenmayersystems}
\begin{document}
\begin{tikzpicture}
\draw [color=green!50!black, l-system={rule set={S -> [+++G][---G]TS,
  G -> +H[-G]L, H -> -G[+H]L, T -> TL, L -> [-FFF][+FFF]F}, step=4pt, angle=18,
 axiom=+++++SLFFF, order=11}] lindenmayer system -- cycle;
\end{tikzpicture}
\end{document}

效果:


code3:

\documentclass[11pt]{scrartcl} 
\usepackage[dvipsnames,svgnames]{xcolor}  
\usepackage{tikz}
\usetikzlibrary{%
  shapes,
  decorations.shapes,
  decorations.fractals,
  decorations.markings,
  shadows
}

\newsavebox{\mycandle}
\savebox{\mycandle}{ 
\begin{tikzpicture}[scale=.1]
\shade[top color=yellow,bottom color=red] (0,0) .. controls (1,.2) and (1,.5) .. (0,2) .. controls (-1,.5)  and  (-1,.2) .. (0,0);
\fill[yellow!90!black] (.8,0) rectangle (-.8,-5); 
\end{tikzpicture} } 

\tikzset{
  paint/.style={draw=#1!50!black, fill=#1!50},
  my star/.style={decorate,decoration={shape backgrounds,shape=star},
                  star points=#1}
}  

\begin{document}
  \begin{tikzpicture}[  ball red/.style={
    decorate,
    decoration={
      markings,
      mark=between positions .2 and 1 step 3cm
      with
      {
        \pgfmathsetmacro{\sz}{2 + .5 * rand}
        \path[shading=ball,ball color=red] (0,0) circle[radius=\sz mm];
      }
    }
  } ,ball blue/.style={
    decorate,
    decoration={
      markings,
      mark=between positions 0.1 and .9 step 3cm
      with
      {
        \pgfmathsetmacro{\sz}{2 + .5 * rand}
        \path[shading=ball,ball color=blue] (0,0) circle[radius=\sz mm];
      }
    }
  }   
]

\draw[fill=Maroon,ultra thick] 
      (.75,-1)  ..  controls (.5,.5)  and   (.5,3)    .. (0.5,4) 
   -- (-0.5,4)  ..  controls (-.5,3) and (-.5,.5)     .. (-.75,-1) ;
\shade[ultra thick, top color=green!90!black,bottom color=green!10!black] 
      (0,10) .. controls  (0,8)     and   (1,7)    .. (1.5,7) 
             ..  controls (1,7)     and   (1,7)    .. (0.5,7.25) 
             ..  controls (1.5,5)   and   (2.5,4)  .. (3,4)
             ..  controls (2,4)     and   (1.25,4) .. (1,4.5)
             ..  controls (2,2)     and   (3.5,2)  .. (4,2)
             ..  controls (1,1)     and   (-1,1)   .. (-4,2) 
             ..  controls (-3.5,2)  and   (-2,2)   .. (-1,4.5)
             ..  controls (-1.25,4) and   (-2,4)   .. (-3,4) 
             ..  controls (-2.5,4)  and   (-1.5,5) .. (-0.5,7.25) 
             ..  controls  (-1,7)   and   (-1,7)   .. (-1.5,7)
             ..  controls  (-1,7)   and   (0,8)    .. (0,10)
              ;

\foreach \candle in {(2,5),(-2,5),(0.5,7.5),(-0.5,7.5),(-3,2.5), (3,2.5),
                    (1.5,1.75),(-1.5,1.75)}
\node at \candle {\usebox{\mycandle}} ; 
\node [star, star point height=.5cm, minimum size=.5cm,draw,fill=yellow,thick]
      at (0,10) {};
\begin{scope}[decoration={shape sep=.2cm, shape size=.25cm}] 
    \draw [my star=6, paint=red]  (-4,2)
             ..  controls (0,2)     and   (1,3.5)   .. (1,4.40); 
    \draw [my star=6, paint=red]  (-1.5,5.40)
             ..  controls (0,5.40)     and   (0.5,6.5)      .. (0.5,7);  
    \draw [my star=6, paint=blue]  (4,2)
             ..  controls  (0,2) and (-1,3.5)      .. (-1,4.40);             
    \draw [my star=6, paint=blue]  (1.5,5.40)
             ..  controls (0,5.40)     and   (-0.5,6.5)      .. (-0.5,7);     
\end{scope} 
% the balls
\path[ball red] 
      (0,10) .. controls  (0,8)     and   (1,7)    .. (1.5,7) 
             ..  controls (1,7)     and   (1,7)    .. (0.5,7.25) 
             ..  controls (1.5,5)   and   (2.5,4)  .. (3,4)
             ..  controls (2,4)     and   (1.25,4) .. (1,4.5)
             ..  controls (2,2)     and   (3.5,2)  .. (4,2)
             ..  controls (1,1)     and   (-1,1)   .. (-4,2) 
             ..  controls (-3.5,2)  and   (-2,2)   .. (-1,4.5)
             ..  controls (-1.25,4) and   (-2,4)   .. (-3,4) 
             ..  controls (-2.5,4)  and   (-1.5,5) .. (-0.5,7.25) 
             ..  controls  (-1,7)   and   (-1,7)   .. (-1.5,7)
             ..  controls  (-1,7)   and   (0,8)    .. (0,10)
              ; 
\path[ball blue] 
      (0,10) .. controls  (0,8)     and   (1,7)    .. (1.5,7) 
             ..  controls (1,7)     and   (1,7)    .. (0.5,7.25) 
             ..  controls (1.5,5)   and   (2.5,4)  .. (3,4)
             ..  controls (2,4)     and   (1.25,4) .. (1,4.5)
             ..  controls (2,2)     and   (3.5,2)  .. (4,2)
             ..  controls (1,1)     and   (-1,1)   .. (-4,2) 
             ..  controls (-3.5,2)  and   (-2,2)   .. (-1,4.5)
             ..  controls (-1.25,4) and   (-2,4)   .. (-3,4) 
             ..  controls (-2.5,4)  and   (-1.5,5) .. (-0.5,7.25) 
             ..  controls  (-1,7)   and   (-1,7)   .. (-1.5,7)
             ..  controls  (-1,7)   and   (0,8)    .. (0,10)
              ; 
 % the snow
\foreach \i in {0.5,0.6,...,1.6}
     \fill [white!80!blue,decoration=Koch snowflake,opacity=.9]
           [shift={(rand*5,rnd*8)},scale=\i]
           [double copy shadow={opacity=0.2,shadow xshift=0pt,
           shadow yshift=3*\i pt,fill=white,draw=none}]
        decorate {
          decorate {
            decorate {
              (0,0) -- ++(60:1) -- ++(-60:1) -- cycle
            }
          }
        };                  
\end{tikzpicture}

\end{document} 


效果:


code 4:

\documentclass{article}
\usepackage{listings}
\usepackage{tikz}
\usetikzlibrary{%
  lindenmayersystems,
  decorations.pathmorphing,
  decorations.markings,
  shapes.geometric,
  calc%
}
\tikzset{
  tinsel/.style={
    #1,
    rounded corners=10mm,
    ultra thin,
    decorate,
    decoration={
      snake,
      amplitude=.1mm,
      segment length=10,
    }
  },
  baubles/.style={
    decorate,
    decoration={
      markings,
      mark=between positions .3 and 1 step 2cm
      with
      {
        \pgfmathsetmacro{\brad}{2 + .5 * rand}
        \path[shading=ball,ball color=#1] (0,0) circle[radius=\brad mm];
      }
    }
  },
  lights/.style={
    decorate,
    decoration={
      markings,
      mark=between positions 0 and 1 step 1cm
      with
      {
        \pgfmathparse{rand > 0 ? "dart" : "kite"}
        \let\lshape\pgfmathresult
         \pgfmathsetmacro{\tint}{100*rnd}
        \node[rotate=90,\lshape,shading=ball,inner sep=1pt,ball color=red!\tint!yellow] {};
      }
    }
  }
}

\begin{document}
\begin{center}
\tikz[remember picture,overlay] \coordinate (star) at (0,-1);
\end{center}

\lstinputlisting[
  breaklines=true,
  language=TeX,
  basicstyle=\tiny,
  firstline=63,
  lastline=103]{\jobname.tex}

\begin{tikzpicture}[overlay,remember picture]
\path (star) +(-50:7) coordinate (rhs) +(-130:7) coordinate (lhs);
\draw[brown!50!black,line width=5mm,line cap=round] (star) ++(-90:6.8) -- ++(0,-1) coordinate (base);
\node[scale=-1,trapezium,fill=black,minimum size=1cm] at (base) {};
\foreach \height/\colour in {%
  .2/blue,
  .4/yellow,
  .6/red,
  .8/orange,
  1/pink%
} {
  \draw[tinsel=\colour] ($(star)!\height!(lhs)$) to[bend right] ($(star)!\height!(rhs)$);
}
\path (star);
\pgfgetlastxy{\starx}{\stary}
\begin{scope}[xshift=\starx,yshift=\stary,yshift=-7cm]
\draw[color=green!50!black, l-system={rule set={S -> [+++G][---G]TS,  G -> +H[-G]L, H -> -G[+H]L, T -> TL, L -> [-FFF][+FFF]F}, step=4pt, angle=18, axiom=+++++SLFFF, order=11}] lindenmayer system -- cycle;
\end{scope}
\foreach \height/\colour in {%
  .1/pink,
  .3/red,
  .5/yellow,
  .7/blue,
  .9/orange%
} {
  \draw[tinsel=\colour] ($(star)!\height!(lhs)$) to[bend right] ($(star)!\height!(rhs)$);
}
\foreach \height in {.15,.35,...,1} {
  \draw[lights]  ($(star)!\height!(lhs)$) to[bend right] ($(star)!\height!(rhs)$);
}
\foreach \angle/\colour in {
  -50/red,
  -70/yellow,
  -90/blue,
  -110/pink,
  -130/purple%
} {
  \draw[baubles=\colour] (star) -- ++(\angle:7);
}
\node[star,star point ratio=2.5,fill=yellow,minimum size=1cm] at (star) {};
\end{tikzpicture}
\end{document}


效果:

Latex 绘图小清新_第2张图片



code 5:

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}

\begin{document}
%
\begin{tikzpicture}
\begin{axis}[
    hide axis, clip=false,
    y domain=0:2*pi,
    samples=30,axis equal, view={45}{20}]

\addplot3 [domain=0:4,surf,shader=flat,z buffer=sort,fill=green!50!brown, draw=green!50!black, line join=bevel] 
    ({(1.3*x-floor(x))*x^0.5*cos(deg(y))},
     {(1.3*x-floor(x))*x^0.5*sin(deg(y))},
     {-5*x});

\addplot3 [domain=0:4.5, samples=10, samples y=0, fill=yellow!85!red, draw=yellow!55!red] ({0},{sin(x/5*360) * (1 - x + floor(x)) },{cos(x/5*360) * (1 - x + floor(x) )  + 0.5}) -- cycle;
\end{axis}
\end{tikzpicture}%
%
\end{document}


效果:



code 6:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{scopes,svg.path,shapes.geometric,shadows}
\begin{document}
\begin{tikzpicture}[
  mystar/.style={star, minimum size=2cm, star point ratio=2.5, shade, thick,
    line join=round, color=yellow!80!black, draw=red!20!black,
    top color=yellow!80!white, bottom color=yellow!60!black},
  mytree/.style={scale=0.5, rotate=180, draw=green!60!black, thick,
    line join=round, inner color=green!60!yellow, outer color=green!50!black},
  myball/.style={shade, ball color=#1, circular drop shadow={
    shadow xshift=0pt, shadow yshift=-.5ex, fill=green!40!black}}
  ]
  {[mytree]
  \shadedraw svg "M355,430
    q90,10 105,-85 30,0 50,-30 20,30 50,30 50,-20 100,0 10,88 105,85
    -45,90 -205,25 Q400,520 355,430";
  \shadedraw svg "M380,325
    q83,10 105,-80 25,0 35,-30 20,25 40,30 20,-10 35,-25 20,20 40,25
    25,90 105,82 -15,50 -120,15 -30,-2 -60,12 -30,0 -52,-28
    C490,370 380,360 380,325";
  \shadedraw svg "M435,225
    q65,-8 90,-70 35,40 70,0 25,60 90,70 -30,52 -90,5 -36,48 -73,-3
    C520,254 445,265 435,225";
  \shadedraw svg "M470,139
    q50,5 90,-80 50,90 90,80 -30,30 -50,20 -40,45 -78,0
    Q500,170 470,139";
  }
  %\shadedraw svg[scale=0.5,rotate=180]
  %"M460,532 q50,-8 q77,-45 v-20 a20,13 0 1 1 48,0 v20 q30,40 77,45";
  %pgf/tikz doesn't like the arc operation, as stated in manual

  \node[mystar] at (-9.85,-1) {$\lambda$};

  \shade[myball=blue]   (-9.7,-2.2)   circle (.2cm);
  \shade[myball=red]    (-9.2,-3.8)   circle (.2cm);
  \shade[myball=green]  (-10.3,-4)    circle (.4cm);
  \shade[myball=yellow] (-8.95,-5.4)  circle (.4cm);
  \shade[myball=red]    (-10.7,-6.1)  circle (.4cm);
  \shade[myball=blue]   (-10.8,-5)    circle (.2cm);
  \shade[myball=yellow] (-9.5,-6.7)   circle (.2cm);
  \shade[myball=green]  (-8.3,-7.6)   circle (.4cm);
  \shade[myball=yellow] (-11.7,-7.6)  circle (.4cm);
  \shade[myball=blue]   (-10.5,-7.8)  circle (.2cm);
\end{tikzpicture}
\end{document}

效果:

Latex 绘图小清新_第3张图片

你可能感兴趣的:(Latex 绘图小清新)