46

I'm currently reading Sparks of Artificial General Intelligence: Early experiments with GPT-4. This paper by Microsoft employees experiments with the capabilities of GPT-4, a successor of ChatGPT. One task is to draw a unicorn with tikz.ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ

They claim:

GPT-4 produces impressive outputs that are [...] at least comparable (if not superior) to what a human would do.

Who wants to prove them wrong?

edit: Please don't include PNG / JPG / other pixel image formats. MS-SPO is the only one allowed to do that (as a grandfathering-rule) - kudos for finding the loophole in this question and for thinking outside of the box

edit: We now have 200 questions!

Martin Thoma
  • 18,799

18 Answers18

51

Well, a little late for the party but, ladies and gentlemen let me introduce you my unicorn, Clavileño, my faithful companion for all these years:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{3d,perspective}

\colorlet{brownxy}{brown!40!red} \colorlet{brownxz}{brown!65!red} \colorlet{brownyz}{brown!90!red}

\tikzset {% declare function={ rh=4*(1-cos(30)); % runner height }, xy/.style={canvas is xy plane at z=#1}, xz/.style={canvas is xz plane at y=#1}, yz/.style={canvas is yz plane at x=#1}, pics/runner/.style={ code={% \draw[xz=0 ,fill=brownxz] (0,4) ++ (240:4) arc (240:300:4) -- cycle; \draw[xy=rh,fill=brownxy] (2,0) rectangle (-2,-0.2); }}, pics/leg/.style={ code={% \path[xz=0] (0,0) --++ (0,1.5) arc (0:135:0.15) coordinate (aux) ; \draw[xz=-0.4,fill=brownyz] (0,0) --++ (0,1.5) arc (0:135:0.15) -- (aux) arc (135:0:0.15) --++ (0,-1.5) -- cycle; \draw[xz=0,fill=brownxz] (0,0) --++ (0,1.5) arc (0:180:0.15) |- cycle; \fill[fill opacity=0.5] (0,0,0) --++ (-0.3,0,0) --++ (0,0,0.2) --++ (0.3,0,0) --++ (0,-0.4,0) --++ (0,0,-0.2) -- cycle; \draw (0,-0.2,0) --++ (0,0,0.2); \foreach\i in {-0.1,-0.2} \fill[xz=0,black] (\i,1.5) circle (0.2mm); }}, pics/body/.style={ code={% \draw[xz=0,pic actions] (-1.3,1.5) coordinate (-A) --++ (2.6,0) coordinate (-B) --++ (70:1.2) coordinate (-C) arc (160:60:0.2) coordinate (-D) --++ (-30:0.6) coordinate (-E) arc (240:390:0.3) coordinate (-F) --++ (120:1.2) coordinate (-G) arc (30:140:0.5) coordinate (-H) --++ (230:1.5) coordinate (-I) arc (-40:-90:0.2) coordinate (-J) --++ (-1.9,0) coordinate (-K) |- cycle; % mouth \fill[xz,black,fill opacity=0.5] (-E) ++ (60:0.3) coordinate (aux) circle (0.3); \draw[xz] (aux) --++ (10:0.3); % eye \fill[xz=0,black] (2.1,3.5) circle (0.1); }}, pics/ear/.style={ code={% \draw[xz=0,rotate=-15,pic actions] (0,0) -- (240:0.4) arc (150:390:0.2) -- cycle; }}, }

\begin{document} \begin{tikzpicture}[line cap=round,line join=round,isometric view,rotate around z=180] % runners \pic at (0,-0.8,0) {runner}; \foreach\i in {1.3,-1} { \draw[xy=rh,fill=brownxy] (\i,0.8) rectangle++ (-0.3,-1.6); \draw[yz=\i,fill=brownyz] (0.8,rh) rectangle++ (-1.6,-0.2); } \pic at (0,1,0) {runner}; \node[xz=1,anchor=south,yshift=.5mm,xscale=-1,fill=none,text=yellow] at (0,0) {\bfseries Clavileño}; \foreach\i in {1.1,1.2,-1.1,-1.2} \fill[xz=1,fill=black] (\i,rh-0.1) circle (0.2mm); % legs \pic at (1.3,-0.4,rh) {leg}; \pic at (-1 ,-0.4,rh) {leg}; % body coordinates \pic[fill=none,draw=none] (back) at (0,-0.4,0) {body}; \pic[fill=none,draw=none] (front) at (0, 0.4,0) {body}; % tail \path (front-K) -- (back-K) coordinate[pos=0.5] (aux); \draw[xz,xscale=-1,shift={(aux)},fill=brownxz] (0,-0.2) to[out=10,in=180] (0.5,0) to[out=0,in=140] (1,-2) to[out=200,in=270] (0.3,-0.8) arc(0:90:0.3) -- cycle; % saddle \draw[xy=0,fill=brownxy] (back-K) ++ (2,0) -- (back-K) -- (front-K) -| cycle; \path (front-K) ++ (0.5,0,0) coordinate (aux1) --++ (0.1,0,0) coordinate (aux2); \path[yz=0] (aux2) arc (0:135:0.4) coordinate (aux3); \draw[fill=gray!70!black] (aux2) {[yz=0] arc (0:180:0.4)} {[xy=0] arc (-90:90:0.8 and 0.4)}; \draw (aux2) --++ (0,-0.8,0); \draw[yz=0,fill=gray] (aux1) arc (0:135:0.4) -- (aux3) arc (135:0:0.4) -- cycle; % body and ears \path[xz=0,fill=none] (front-G) arc (30:135:0.5) coordinate (aux1); \path[xz=0,fill=none] (front-F) arc (390:315:0.3) coordinate (aux2); \path (back-B) -- (back-C) coordinate[pos=1.1] (aux3); \pic[fill=brown!30!orange] at (2.2,-0.4,4.4) {ear}; \draw[fill=brown] (front-B) --++ (0,-0.8,0) -- (aux3) --++ (0,0.8,0) -- cycle; \draw[fill=brown!70!red] (aux1) --++ (0,-0.8,0) {[xz=0] arc (135:30:0.5) -- (back-F) arc (390:315:0.3) -- (aux2)} -- cycle; \pic[fill=brownxz] at (0,0.4,0) {body}; \pic[fill=brown!30!orange] at (2.2,0.4,4.4) {ear}; \pic[draw=none,fill=black!60!brown,scale=0.6] at (2.15,0.4,4.25) {ear}; % more legs \pic at (1.3,0.8,rh) {leg}; \pic at (-1,0.8 ,rh) {leg}; % handle \path[xz=0.4,draw=red] (1.4,3.5) coordinate (aux1) ++ (135:0.1) coordinate (aux2) arc (135:-45:0.1) coordinate (aux3); \path (aux3) --++ (0,0.4,0) coordinate (aux4); \path (aux1) --++ (0,0.4,0) coordinate (aux5); \draw[fill=gray,xz=0.4] (aux1) circle (0.15); \draw[fill=gray!50!black,xz=0] (aux2) arc (135:-45:.1) -- (aux4) arc (-45:135:0.1) -- cycle; \draw[xz=0,fill=gray] (aux5) circle (0.1); % unicorn \path (front-F) -- (back-G) coordinate[pos=0.5] (aux); \draw[shift={(aux)},rotate around y=60,fill=yellow] (4:0.1) arc (4:190:0.1) -- (0,0,1) -- cycle; \end{tikzpicture} \end{document}

enter image description here

Update: Here you can see him galloping without fear. enter image description here

Juan Castaño
  • 28,426
50
\documentclass{standalone}
\usepackage{tikzducks}
\usepackage{pgf-spectra}
\pgfspectrashade[v](380,780){myShadeC}

\begin{document}

\begin{tikzpicture}[shading=myShadeC]
 \duck[body=pink]
 \shade[shading angle=45] \duckpathlonghair;
 \duck[invisible,body=pink,unicorn=magenta!60!violet]
\end{tikzpicture}

\end{document}

enter image description here

  • 2
    I love it And it's already way better than any of the GPT-4 examples – Martin Thoma Mar 31 '23 at 14:59
  • 2
  • 15
    You do realise this code is already being used to train ChatGPT to generate unicorns, and based on the "is already way better" comment, in a few days all of the internet will be baffled by how all of the sudden all unicorns began showing duck-y traits in their physical appearance – Phelype Oleinik Mar 31 '23 at 15:03
  • 15
    @PhelypeOleinik ... that's part of the plan for duck world domination :) – samcarter_is_at_topanswers.xyz Mar 31 '23 at 15:04
  • @PhelypeOleinik, just a thought: if AI is what it pretends to be … why does it need our human input? (Please try thinking in terms, which remove all humanized terms, like „learning“, „being or doing sth intelligent“ etc. to perceive the technology as it is.) – MS-SPO Apr 01 '23 at 06:49
  • 1
    @MS-SPO Well, in our specific example of drawing a unicorn in TikZ... any kind of intelligence, whether human, artificial, alien, or supernatural, would need human input just to know what "unicorn" and "TikZ" are, no? – Misha Lavrov Apr 01 '23 at 17:28
  • Please see 3 comments above, that‘s what I refer to: „unicorns“ are already known, and yet the machine needs more human input to excel human ideas … Let‘s wait for results: I don‘t expect much. // And again, „knowing“ is a human property. Just to remind you of an effective trap for our perception. // For discussions somebody should open a chat, BTW. – MS-SPO Apr 01 '23 at 17:57
33

Clearly use of tikz is sign of mere automation.

Discerning artists use latex picture mode for planes or donkeys or unicorns which are horned donkeys

\setlength{\unitlength}{0.00083333in}
\usepackage{epic}
\begin{document}

\begin{picture}(4974,3714)(0,-10) \drawline(2037,1362)(1962,12)(2112,1362) \drawline(1887,2412)(4437,2412)(4437,1437) (1887,1437)(837,2262)(462,1812) (12,2187)(687,3012)(837,3687) (837,3087)(1812,2412) \drawline(1887,1437)(1512,12)(1962,1437) \put(687,2637){\circle{150}} \drawline(4362,1437)(4287,162)(4287,1437) \drawline(4137,1437)(3987,162)(3987,1437) \drawline(4437,2412)(4962,1587) \drawline(580,2900)(-200,3300)(660,3010) \end{picture}

\end{document}

enter image description here

David Carlisle
  • 757,742
32
\documentclass{standalone}
\usepackage{tikz}
\usepackage{ducksay}

\begin{document}

\begin{tikzpicture}
    \node {\ducksay[unicorn]{I'm an unicorn}};
\end{tikzpicture}   

\end{document}

enter image description here

25

Merger of MS-SPO's nice idea and an older answer of mine:

\documentclass[border=10Mm]{standalone}
\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}

% Original Image: Hszone/Wirestock Creators / stock.adobe.com % https://stock.adobe.com/de/images/unicorn-pixel-art-vector/501392488 \begin{filecontents}{image.dat} .2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .2 .2 0 0 0 0 0 0 0 0 0 .5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .2 .2 .2 0 0 0 0 0 0 .5 0 .5 0 0 0 0 0 0 0 0 0 0 0 0 0 .2 .2 .2 .2 0 0 0 0 0 .5 0 .5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .2 .2 .2 .2 .8 .8 .8 .8 0 0 0 .8 .8 .8 .8 0 0 0 0 0 0 0 0 0 0 0 .2 .8 .8 .8 .8 .8 .8 0 0 .8 .8 .8 .8 .8 .8 .8 0 0 0 0 0 0 0 0 0 0 .8 .8 .8 0 0 0 0 0 .8 .8 .8 .8 .8 .8 .8 .8 0 0 0 0 0 0 .8 0 .8 .8 .8 0 0 0 0 0 0 0 .8 .8 .8 .8 .8 .8 .8 .8 0 0 0 0 0 0 .8 .8 0 0 0 0 0 0 0 0 0 0 .6 .6 .6 .8 .8 .8 .8 .8 0 0 0 0 0 0 .5 0 0 0 0 0 0 0 0 0 0 0 .6 .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0 0 0 .4 .4 .4 .6 .6 0 0 0 .8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 .4 .6 .6 0 0 0 0 .8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 .6 0 0 0 0 0 0 0 0 0 0 0 \end{filecontents}

\pgfplotstableread{image.dat}{\pixeldata}

\begin{document} \begin{tikzpicture}

\pgfplotstablegetcolsof{\pixeldata} \pgfmathsetmacro{\datacols}{\pgfplotsretval-1} \pgfplotstablegetrowsof{\pixeldata} \pgfmathsetmacro{\datarows}{\pgfplotsretval-1} \foreach \i in {0,...,\datarows} { \foreach \j in {0,...,\datacols} { \pgfplotstablegetelem{\i}{\j}\of{\pixeldata} \pgfmathsetmacro{\pixelvalue}{\pgfplotsretval*100} \fill[black!\pixelvalue] (\j,-\i) rectangle +(1,1); } } \end{tikzpicture} \end{document}

enter image description here


Let's add some sprinkle of Sebastiano's answer to it:

\documentclass[border=10Mm]{standalone}
\usepackage{emoji}
\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}

% Original Image: Hszone/Wirestock Creators / stock.adobe.com % https://stock.adobe.com/de/images/unicorn-pixel-art-vector/501392488 \begin{filecontents}{image.dat} .2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .2 .2 0 0 0 0 0 0 0 0 0 .5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .2 .2 .2 0 0 0 0 0 0 .5 0 .5 0 0 0 0 0 0 0 0 0 0 0 0 0 .2 .2 .2 .2 0 0 0 0 0 .5 0 .5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .2 .2 .2 .2 .8 .8 .8 .8 0 0 0 .8 .8 .8 .8 0 0 0 0 0 0 0 0 0 0 0 .2 .8 .8 .8 .8 .8 .8 0 0 .8 .8 .8 .8 .8 .8 .8 0 0 0 0 0 0 0 0 0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6 .6 .6 .6 .8 .8 0 0 0 0 0 0 0 0 0 0 0 .4 .4 .4 .4 .6 .6 .6 .6 .6 .6 .6 .8 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 .4 .4 .6 .6 .6 .6 .6 .6 .8 .8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 .4 .4 .6 .6 .6 0 0 .8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 .4 .4 .6 .6 0 0 0 .8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 .4 .6 .6 0 0 0 0 .8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 .6 0 0 0 0 0 0 0 0 0 0 0 \end{filecontents}

\pgfplotstableread{image.dat}{\pixeldata}

\begin{document} \begin{tikzpicture}[x=0.33cm, y=0.33cm]

\pgfplotstablegetcolsof{\pixeldata} \pgfmathsetmacro{\datacols}{\pgfplotsretval-1} \pgfplotstablegetrowsof{\pixeldata} \pgfmathsetmacro{\datarows}{\pgfplotsretval-1} \foreach \i in {0,...,\datarows} { \foreach \j in {0,...,\datacols} { \pgfplotstablegetelem{\i}{\j}\of{\pixeldata} \pgfmathsetmacro{\pixelvalue}{\pgfplotsretval} \ifdim\pixelvalue pt>0pt\relax \node[scale=\pixelvalue] at (\j,-\i) {\emoji{unicorn}}; \fi } } \end{tikzpicture} \end{document}

enter image description here

Variation with mirrored "eye pixel":

\documentclass[border=10Mm]{standalone}
\usepackage{emoji}
\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}

% Original Image: Hszone/Wirestock Creators / stock.adobe.com % https://stock.adobe.com/de/images/unicorn-pixel-art-vector/501392488 \begin{filecontents}{image.dat} .2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .2 .2 0 0 0 0 0 0 0 0 0 .5 0 0 0 0 0 0 0 0 0 0 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.6 .6 .8 .8 0 0 0 0 0 0 0 0 0 0 0 .5 .4 .4 .4 .4 .4 .4 .6 .6 .6 .6 .6 .8 .8 0 0 0 0 0 0 0 0 0 0 .4 .4 .4 .4 .4 .4 .4 .6 .6 .6 .6 .6 .8 .8 0 0 0 0 0 0 0 0 0 0 .4 .4 .4 .4 .4 .4 .6 .6 .6 .6 .6 .6 .6 .8 .8 0 0 0 0 0 0 0 0 0 0 .4 .4 .4 .4 .4 .6 .6 .6 .6 .6 .6 .6 .8 .8 0 0 0 0 0 0 0 0 0 0 0 .4 .4 .4 .4 .6 .6 .6 .6 .6 .6 .6 .8 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 .4 .4 .6 .6 .6 .6 .6 .6 .8 .8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 .4 .4 .6 .6 .6 0 0 .8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 .4 .4 .6 .6 0 0 0 .8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 .4 .6 .6 0 0 0 0 .8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 .6 0 0 0 0 0 0 0 0 0 0 0 \end{filecontents}

\pgfplotstableread{image.dat}{\pixeldata}

\begin{document} \begin{tikzpicture}[x=0.33cm, y=0.33cm]

\pgfplotstablegetcolsof{\pixeldata} \pgfmathsetmacro{\datacols}{\pgfplotsretval-1} \pgfplotstablegetrowsof{\pixeldata} \pgfmathsetmacro{\datarows}{\pgfplotsretval-1} \foreach \i in {0,...,\datarows} { \foreach \j in {0,...,\datacols} { \pgfplotstablegetelem{\i}{\j}\of{\pixeldata} \pgfmathsetmacro{\pixelvalue}{\pgfplotsretval} \pgfmathsetmacro{\pixelmirror}{(\i == 11 && \j == 7 ? 1 : 0)} \ifdim\pixelvalue pt>0pt\relax \ifnum\pixelmirror=1\relax \node[xscale=-\pixelvalue, yscale=\pixelvalue] at (\j,-\i) {\emoji{unicorn}}; \else \node[scale=\pixelvalue] at (\j,-\i) {\emoji{unicorn}}; \fi \fi } } \end{tikzpicture} \end{document}

enter image description here

  • 1
    Accoding to the licence, it take it that it is allowed to use the original file like this. If I misread the terms or if they changed, please notify me. If somebody has some nice similar pixel art that is in the Public Domain, let me know. – Jasper Habicht Mar 31 '23 at 23:49
  • Very nice. +1, but exhausted my upvote already. – MS-SPO Apr 01 '23 at 12:20
  • 1
    Just for fun: Perhaps some non-conforming "individuals" should look into the opposite direction? Like the eye or similar? – MS-SPO Apr 02 '23 at 14:13
  • Minor difference, but visible. +1 – MS-SPO Apr 02 '23 at 16:42
18

Approach:

  • find a drawing
  • digitize it, i.e. draw relevant coordinates and lines
  • artistic touch: use thicker lines

Some directions for further improvements:

  • modify arrow tips, e.g. triangular or curved
  • use some kind of fill or texture, e.g. to mimick charcol strokes
  • do some fine tuning, e.g. for the ears

unicorn

\documentclass[10pt, border=3mm]{standalone}
\usepackage{tikz}

\begin{document}

\tikz[line width=4.5pt]{ % ~~~ head ~~~~~~~~ \draw (2.96, 4.67) to [out=88, in=95] (3.22, 4.78); \draw (3.13, 4.63) to [out=55, in=85] (3.22, 4.43) to [out=-45, in=105] (3.57, 3.79) to [out=288, in=85] (3.88, 2.86); \draw (3.77, 2.82) to [out=230, in=280] (3.32, 2.73) to [out=90, in=300] (2.79, 3.34); \draw (2.84, 3.28) to [out=185, in=270] (2.20, 3.92)
to [out=250, in=160] (2.67, 2.83); % ~~~ eye ~~~~~~~~ \draw (3.30, 4.10) to [out=190, in=160] (3.04, 4.04) to [out=300, in=190] (3.32, 3.93); % ~~~ nose ~~~~~~~~ \draw (3.84, 2.83) -- (3.70, 3.00); % ~~~ hair ~~~~~~~ \draw (2.89, 4.83) to [out=180, in=90] (1.78, 3.69) to [out=270, in=160] (2.90, 2.50); \draw (1.63, 4.24) to [out=230, in=80] (2.14, .76); \draw (1.73, .45) to [out=70, in=270] (1.03, 3.04); \draw (1.61, 3.65) to [out=260, in=140] (2.31, 2.29) to [out=-40, in=105] (3.34, 1.54); % ~~~ horn ~~~~~~ \draw (3.48, 4.19) to [out=35, in=30] (4.67, 5.22) to [out=35, in=30](3.65, 4.82); \draw (3.65, 4.34) to [out=90 , in=280] (3.59, 4.69); \draw (3.85, 4.51) to [out=90 , in=290] (3.79, 4.75); \draw (4.00, 4.64) to [out=95 , in=290] (3.96, 4.83); \draw (4.19, 4.77) to [out=95 , in=300] (4.16, 4.89); }

\end{document}

P.S.: Again for the artistic touch, this is how it can appear when using dashed lines everywhere:

dashed

(Might be a zebra-corn ...)

P.S.2: More artistic, which makes it look more godzillian:

decorated

\tikz[line width=2pt,
    decoration={random steps,segment length=3pt}]{
    % ~~~ head ~~~~~~~~
    \draw [decorate] (2.96, 4.67)   to [out=88, in=95]   (3.22, 4.78);
...
MS-SPO
  • 11,519
17

Two unicorns....

enter image description here

\documentclass[12pt]{article}
\usepackage{twemojis}
\usepackage{scalerel}

\begin{document} $\scaleto{\mbox{\twemoji{unicorn}}}{100pt}$ \end{document}

enter image description here

\documentclass[12pt]{article}
\usepackage{emoji}
\usepackage{scalerel}

\begin{document}

$\scaleto{\mbox{\emoji{unicorn}}}{100pt}$ \end{document}

Sebastiano
  • 54,118
17

Plot it.

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}

\begin{tikzpicture} \begin{axis}[axis equal image]

\addplot[no marks, domain={-0.95:1.85}] {-2*pow(x,5)+3.5*pow(x,4)};
\addplot[no marks, domain={-0.95:3.5}] {-0.35*pow(x-0.5,2)+6.25};
\addplot[no marks, domain={-3.5:-0.95}] {-0.15*x+5.25};
\addplot[no marks, domain={-3.5:-0.95}] {-0.5*x+4};
\addplot[no marks, domain={-180:180}] ({0.25*cos(x)-0.25}, {0.25*sin(x)+3.5});

\end{axis} \end{tikzpicture}

\end{document}

enter image description here

12

Approach:

  • prepare a (simple) pixelated drawing
  • place nodes like pixels, filled with some color

Details:

  • most colors predefined
  • \pix introduced as shorthand notation
  • shown: classical lines with \node ... {};
  • later: shorthands, with ; being absorbed: \pix{}{}{}

Some ideas for refinement:

  • node shapes yould be circle, triangle etc. to modify the pixels appearance
  • pixels of same color could be placed by for loops
  • a row or column of colored pixels could be coded for programming and decoded for drawing by tikz

pixelated

\documentclass[10pt, border=3mm]{standalone}
\usepackage{color}
\usepackage{tikz}

% ~~~ (most) colors ~~~~~~~~~~~~~~~~~~~~~~~ \definecolor{pnk}{RGB}{244,173,203} \definecolor{yel}{RGB}{245,233,49} \definecolor{bld}{RGB}{110,181,233} \definecolor{bll}{RGB}{180,220,246} \definecolor{blu}{RGB}{145,200,239}

% ~~~ short hand notation ~~~~~~~~~~~~~~~~ \newcommand\pix[3]{ \node [fill=#1] at (#2/4,#3/4) {};}

\begin{document}

\tikz{ % ~~~ starting somewhere ~~~~~~~~~~ \node [fill=pnk] at (0,0) {};% so it begins \node [fill=bld] at (1/4,0) {}; \node [fill=bll] at (2/4,0) {}; \node [fill=blu] at (3/4,0) {}; \node [fill=blu] at (4/4,0) {}; \node [fill=pnk] at (5/4,0) {}; \node [fill=bll] at (6/4,0) {}; % ~~~ line(s) above ~~~~~~~~~ \pix{pnk}{1}{1}% using short hand notation \pix{bld}{2}{1} \pix{pnk}{4}{1} \pix{bld}{5}{1} \pix{blu}{6}{1} \pix{blu}{7}{1} \pix{blu}{8}{1}

\pix{pnk}{4}{2}
\pix{bll}{5}{2}
\pix{black}{6}{2}
\pix{bll}{7}{2}
\pix{bll}{8}{2}

\pix{pnk}{4}{3}
\pix{pnk}{5}{3}
\pix{pnk}{6}{3}
\pix{yel}{7}{3}

\pix{pnk}{5}{4}
\pix{pnk}{6}{4}
\pix{yel}{8}{4}
% ~~~ line(s) below ~~~~~~~~~~
\pix{pnk}{1}{-1}
\pix{blu}{2}{-1}
\pix{blu}{3}{-1}
\pix{blu}{4}{-1}
\pix{bll}{5}{-1}
\pix{blu}{6}{-1}

\pix{pnk}{1}{-2}
\pix{blu}{2}{-2}
\pix{bll}{3}{-2}
\pix{bld}{5}{-2}
\pix{bll}{7}{-2}

\pix{gray!40}{2}{-3}
\pix{gray!40}{5}{-3}
\pix{gray!40}{7}{-3}

}

\end{document}

MS-SPO
  • 11,519
10

Draw it using the totally experimental (but also already totally capable) l3draw package (okay, I have to admit that it is not TikZ then):

\documentclass[border=10pt]{standalone}
\usepackage{l3draw}

\begin{document}

\ExplSyntaxOn

\draw_begin:

\draw_linewidth:n { 2pt }

\color_select:n { black!50 }

\draw_path_moveto:n { \draw_point_polar:nnn { 1.75cm } { 2cm } { 270 } } \draw_path_arc:nnnn { 270 } { 140 } { 1.75cm } { 2cm } \draw_path_arc:nnnn { 240 } { 50 } { 0.25cm } { 0.25cm } \draw_path_curveto:nn { -1.25cm , 2cm } { -1.75cm , 2cm }

\draw_path_moveto:n { \draw_point_polar:nnn { 1.75cm } { 2cm } { 115 } } \draw_path_curveto:nn { -1.5cm , 2.5cm } { -2cm , 2.5cm } \draw_path_curveto:nn { -2.5cm , 2cm } { -1.75cm , 1.5cm }

\draw_path_moveto:n { \draw_point_polar:nnn { 1.75cm } { 2cm } { 270 } } \draw_path_arc:nnnn { 270 } { 400 } { 1.75cm } { 2cm } \draw_path_arc:nnnn { 300 } { 480 } { 0.25cm } { 0.25cm } \draw_path_curveto:nn { 1.25cm , 2cm } { 1.75cm , 2cm }

\draw_path_moveto:n { \draw_point_polar:nnn { 1.75cm } { 2cm } { 65 } } \draw_path_curveto:nn { 1.5cm , 2.5cm } { 2cm , 2.5cm } \draw_path_curveto:nn { 2.5cm , 2cm } { 1.75cm , 1.5cm }

\draw_path_use_clear:n { stroke }

\color_select:n { black }

\draw_path_circle:nn { -0.75cm , 0.45cm } { 2.5mm } \draw_path_circle:nn { 0.75cm , 0.45cm } { 2.5mm }

\draw_path_use_clear:n { fill }

\color_select:n { white }

\draw_path_circle:nn { -0.7cm , 0.5cm } { 0.9mm } \draw_path_circle:nn { 0.8cm , 0.5cm } { 0.9mm }

\draw_path_use_clear:n { fill }

\color_select:n { black!50 }

\draw_path_ellipse:nnn { -0.5cm , -1.25cm } { 1mm , -0.5mm } { 0mm , 1.5mm } \draw_path_ellipse:nnn { 0.5cm , -1.25cm } { 1mm , 0.5mm } { 0mm , 1.5mm }

\draw_path_use_clear:n { fill }

\color_stroke:n { yellow!75!red } \color_fill:n { yellow!85!red }

\draw_path_moveto:n { -0.25cm , 2cm, } \draw_path_lineto:n { 0cm , 3.75cm } \draw_path_lineto:n { 0.25cm , 2cm }

\draw_path_use_clear:n { fill, stroke }

\color_stroke:n { magenta!85!cyan } \color_fill:n { magenta }

\draw_path_moveto:n { \draw_point_polar:nnn { 1.75cm } { 2cm } { 115 } } \draw_path_curveto:nnn { -0.75cm , 2.25cm } { -0.25cm , 2.25cm } { 1cm , 1.25cm } \draw_path_curveto:nnn { -0.75cm , 3.25cm } { -1cm , 2.5cm } { \draw_point_polar:nnn { 1.75cm } { 2cm } { 115 } }

\draw_path_use_clear:n { fill, stroke }

\draw_end:

\ExplSyntaxOff

\end{document}

enter image description here

9

Let's criticise my previous drawing with line strokes.

From research and knowledge:

  • unicorns come with color
  • rainbow-like colors are an important ingredient
  • unicorns are fiction, held dearly by many

How to reflect these issues? One way to do it is using tikz features to process pathes. Let's apply Artistic Intelligence again.

pathes

\documentclass[10pt, border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.shapes,shapes.geometric}% <<< NEW <<<

\begin{document}

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

\tikz[line width=1pt,decoration={shape sep=8pt,shape size=8pt}]{ % ~~~ horn coloration ~~~~~~~~ <<< NEW <<< \draw [decoration={shape sep=11pt,shape size=10pt},my star=6, paint=yellow] (4.67, 5.22) -- (3.25,4.4); % ~~~ head ~~~~~~~~ \draw (2.96, 4.67) to [out=88, in=95] (3.22, 4.78); \draw (3.13, 4.63) to [out=55, in=85] (3.22, 4.43) to [out=-45, in=105] (3.57, 3.79) to [out=288, in=85] (3.88, 2.86); \draw (3.77, 2.82) to [out=230, in=280] (3.32, 2.73) to [out=90, in=300] (2.79, 3.34); \draw (2.84, 3.28) to [out=185, in=270] (2.20, 3.92) to [out=250, in=160] (2.67, 2.83); % ~~~ eye ~~~~~~~~ \draw (3.30, 4.10) to [out=190, in=160] (3.04, 4.04) to [out=300, in=190] (3.32, 3.93); % ~~~ nose ~~~~~~~~ \draw (3.84, 2.83) -- (3.70, 3.00); % ~~~ hair ~~~~~~~ <<< MODIFIED <<< \draw [my star=5, paint=red] (2.89, 4.83) to [out=180, in=90] (1.78, 3.69) to [out=270, in=160] (2.90, 2.50); \draw [my star=5, paint=orange] (1.63, 4.24) to [out=230, in=80] (2.14, .76); \draw [my star=5, paint=blue] (1.73, .45) to [out=70, in=270] (1.03, 3.04); \draw [my star=5, paint=yellow] (1.61, 3.65)
to [out=260, in=140] (2.31, 2.29) to [out=-40, in=105] (3.34, 1.54); % ~~~ horn ~~~~~~ \draw (3.48, 4.19) to [out=35, in=30] (4.67, 5.22) to [out=35, in=30](3.65, 4.82); \draw (3.65, 4.34) to [out=90 , in=280] (3.59, 4.69); \draw (3.85, 4.51) to [out=90 , in=290] (3.79, 4.75); \draw (4.00, 4.64) to [out=95 , in=290] (3.96, 4.83); \draw (4.19, 4.77) to [out=95 , in=300] (4.16, 4.89); }

\end{document}

MS-SPO
  • 11,519
8

You can view the following code from two perspectives:

  1. as a cheap trick
  2. as an inventive solution.

Ad #1: That view should be obvious.


Ad #2: It provides the properties of an inventive solution:

  • it IS TIKZ
  • AND it IS NOT-TIKZ
  • i.e. it's a resolution of a contradiction
  • done by separation in code
  • which can be perceived as the principle of "separating between part and whole" (overall it's tikz as a whole, but not-tikz in it's part(s))

Take that, AI ...

result

Screenshot. Save as uniforn-f.png with or without the gray borders from my browsers background.

\documentclass[10pt]{standalone}
\usepackage{tikz}%       tikz
\usepackage{graphicx}% NOT-tikz

\begin{document}

\tikz{\node at (0,0) {\includegraphics{unicorn-f.png}};}% AND (tikz AND not-tikz)

\end{document}

MS-SPO
  • 11,519
  • Hehe, kudos for finding the gap in the question (+1, but I also add a comment to the question to prevent more of those xD) – Martin Thoma Mar 31 '23 at 17:31
6

Let's apply some Artistic Intelligence on my line-stroke-drawing. To give it a cubistic touch let's introduce some colored areas by:

  1. just filling some strokes
  2. introducing new colored shapes

Though it builds on the previous approach the concept is slightly different, using other properties tikz provide in two different ways.

Are the results pleasing? When to stop, where to continue? Humans decide, humans know, ...


Ad #1: Results for 1.5 pt and 4.5 pt line thickness AND filling the hair-strokes.

1pt5 4pt5

...
    % ~~~ hair ~~~~~~~
    \draw [fill=gray] (1.63, 4.24)  to [out=230, in=80] (2.14, .76);
    \draw [fill=gray] (1.73,  .45)  to [out=70, in=270] (1.03, 3.04);
    \draw [fill=gray] (1.61, 3.65)  to [out=260, in=140] (2.31, 2.29) 
                        to [out=-40, in=105] (3.34, 1.54);
    \draw [fill=gray] (2.89, 4.83)  to [out=180, in=90]  (1.78, 3.69) 
                        to [out=270, in=160] (2.90, 2.50);
...

Ad #2: Just adding a few colored shapes before drawing the strokes.

colored shapes

\documentclass[10pt, border=3mm]{standalone}
\usepackage{tikz}

\begin{document}

\tikz[line width=4.5pt]{ % ~~~ colored shapes ~~~~ \draw [fill=yellow!60,draw=none] (3.2,4.7) -- (4.3,5.5) -- (4.9,5.35) -- (3.3,4.3) -- cycle; \draw [fill=blue!50,draw=none] (.5,3) -- (1,3.5) -- (2,1) -- (1.5,.5) -- cycle;
\draw [fill=pink!60,draw=none] (1.2,3.8) -- (1.6,4.5) -- (1.6,1.3) -- (2.,2) -- cycle; \draw [fill=orange!50,draw=none] (1.5,3.8) -- (2.8,.9) -- (3.8,1.6) -- cycle;

% ~~~ head ~~~~~~~~
\draw (2.96, 4.67)  to [out=88, in=95]   (3.22, 4.78);
\draw (3.13, 4.63)  to [out=55, in=85]   (3.22, 4.43)
                    to [out=-45, in=105] (3.57, 3.79) 
                    to [out=288, in=85] (3.88, 2.86);
\draw (3.77, 2.82)  to [out=230, in=280] (3.32, 2.73) 
                    to [out=90, in=300] (2.79, 3.34);
\draw (2.84, 3.28)  to [out=185, in=270] (2.20, 3.92)  
                    to [out=250, in=160] (2.67, 2.83);
% ~~~ eye ~~~~~~~~
\draw (3.30, 4.10) to [out=190, in=160] (3.04, 4.04) 
to [out=300, in=190] (3.32, 3.93);
% ~~~ nose ~~~~~~~~
\draw (3.84, 2.83) -- (3.70, 3.00);
% ~~~ hair ~~~~~~~
\draw (2.89, 4.83)  to [out=180, in=90]  (1.78, 3.69) 
                    to [out=270, in=160] (2.90, 2.50);
\draw (1.63, 4.24)  to [out=230, in=80] (2.14, .76);
\draw (1.73,  .45)  to [out=70, in=270] (1.03, 3.04);
\draw (1.61, 3.65)  to [out=260, in=140] (2.31, 2.29) 
                    to [out=-40, in=105] (3.34, 1.54);
% ~~~ horn ~~~~~~
\draw (3.48, 4.19)  to [out=35, in=30] (4.67, 5.22) 
                    to [out=35, in=30](3.65, 4.82);
\draw (3.65, 4.34)  to [out=90 , in=280] (3.59, 4.69);
\draw (3.85, 4.51)  to [out=90 , in=290] (3.79, 4.75);
\draw (4.00, 4.64)  to [out=95 , in=290] (3.96, 4.83);
\draw (4.19, 4.77)  to [out=95 , in=300] (4.16, 4.89);

}

\end{document}

MS-SPO
  • 11,519
6

"Diamonds are forever ...", said "The last unicorn" ;-)

result

\documentclass[10pt, border=4mm]{standalone}
\usepackage{tikz}

\begin{document}

\tikzset{ unic/.pic={ % ~~~ colored shapes ~~~~ \draw [fill=yellow!60,draw=none] (3.2,4.7) -- (4.3,5.5) -- (4.9,5.35) -- (3.3,4.3) -- cycle;
\draw [fill=red!20,draw=none] (0,4.2) -- (.3,.9) -- (4.2,1.6) -- (4.5,3.5) -- cycle;

% ~~~ head ~~~~~~~~
\draw (2.96, 4.67)  to [out=88, in=95]   (3.22, 4.78);
\draw (3.13, 4.63)  to [out=55, in=85]   (3.22, 4.43) to [out=-45, in=105] (3.57, 3.79) to [out=288, in=85] (3.88, 2.86);
\draw (3.77, 2.82)  to [out=230, in=280] (3.32, 2.73) to [out=90, in=300] (2.79, 3.34);
\draw (2.84, 3.28)  to [out=185, in=270] (2.20, 3.92) to [out=250, in=160] (2.67, 2.83);
% ~~~ eye ~~~~~~~~
\draw (3.30, 4.10) to [out=190, in=160] (3.04, 4.04) to [out=300, in=190] (3.32, 3.93);
% ~~~ nose ~~~~~~~~
\draw (3.84, 2.83) -- (3.70, 3.00);
% ~~~ hair ~~~~~~~
\draw (2.89, 4.83)  to [out=180, in=90]  (1.78, 3.69) to [out=270, in=160] (2.90, 2.50);
\draw (1.63, 4.24)  to [out=230, in=80] (2.14, .76);
\draw (1.73,  .45)  to [out=70, in=270] (1.03, 3.04);
\draw (1.61, 3.65)  to [out=260, in=140] (2.31, 2.29) to [out=-40, in=105] (3.34, 1.54);
% ~~~ horn ~~~~~~
\draw (3.48, 4.19)  to [out=35, in=30] (4.67, 5.22) to [out=35, in=30](3.65, 4.82);
\draw (3.65, 4.34)  to [out=90 , in=280] (3.59, 4.69);
\draw (3.85, 4.51)  to [out=90 , in=290] (3.79, 4.75);
\draw (4.00, 4.64)  to [out=95 , in=290] (3.96, 4.83);
\draw (4.19, 4.77)  to [out=95 , in=300] (4.16, 4.89);

}}

\tikzset{% diamond dmnd/.pic={\draw [fill=red,line width=2.5pt] (-.7,0) -- (0,1.1) -- (.7,0) -- (0,-1.1)-- cycle;} }

\tikzset{% half card half/.pic={ \pic at (0,0) [line width=2.5pt] {unic}; \pic at (-1,5.5) [scale=.7, transform shape] {dmnd}; }}

\tikz{% á la card ... \pic at (-2.5,-.5) {half}; \pic at (+2.5,+.5) [rotate=180,transform shape] {half}; \draw (-4.5,-7) [rounded corners=10pt,line width=4pt] rectangle ++(9,14); }

\end{document}

MS-SPO
  • 11,519
5

Let's show 2 unicorns, inspired by what we know from gables or blazons, like here:

basic idea

The code below basically does two things:

  • combine two previous drawings I posted here as tikz pics
  • shift the two \pics against each other via the "constant" \newcommand\shft[0]{1}

Relevant code section:

\tikz{
    \pic             at (-\shft,0) {beauty};
    \pic [xscale=-1] at (+\shft,0) {uni};
}

For shft=1, this is the result:

shift=1

But it's also fun to see what happens for 0, 2, 2.5, 3, 3.5, 4 and 5. Wrt. AI they can be generated easily, but not all will be appreciated as nice, esthtic or beautiful. Some may appear disturbing, or like taken from a test from psychology. The last one even qualifies for "telling a story by one picture". Or in techno-speak: shft introduces a lot of noise for us humans.

shift=0 shift=2 shift=2.5 shift=3 shift=3.5 shift=4 shift=5

\documentclass[10pt, border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.shapes,shapes.geometric}

\newcommand\shft[0]{1}% shift amount for the \pic's

\begin{document}

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

\tikzset{% beaty-corn, as one-liners beauty/.style={line width=1pt,decoration={shape sep=8pt,shape size=8pt}}, beauty/.pic={ % ~~~ horn coloration ~~~~~~~~ \draw [decoration={shape sep=11pt,shape size=10pt},my star=6, paint=yellow] (4.67, 5.22) -- (3.25,4.4); % ~~~ head ~~~~~~~~ \draw (2.96, 4.67) to [out=88, in=95] (3.22, 4.78);\draw (3.13, 4.63) to [out=55, in=85] (3.22, 4.43) to [out=-45, in=105] (3.57, 3.79) to [out=288, in=85] (3.88, 2.86);\draw (3.77, 2.82) to [out=230, in=280] (3.32, 2.73) to [out=90, in=300] (2.79, 3.34);\draw (2.84, 3.28) to [out=185, in=270] (2.20, 3.92) to [out=250, in=160] (2.67, 2.83); % ~~~ eye ~~~~~~~~ \draw (3.30, 4.10) to [out=190, in=160] (3.04, 4.04) to [out=300, in=190] (3.32, 3.93); % ~~~ nose ~~~~~~~~ \draw (3.84, 2.83) -- (3.70, 3.00); % ~~~ hair ~~~~~~~ \draw [my star=5, paint=red] (2.89, 4.83) to [out=180, in=90] (1.78, 3.69) to [out=270, in=160] (2.90, 2.50);\draw [my star=5, paint=orange] (1.63, 4.24) to [out=230, in=80] (2.14, .76);\draw [my star=5, paint=blue] (1.73, .45) to [out=70, in=270] (1.03, 3.04);\draw [my star=5, paint=yellow] (1.61, 3.65) to [out=260, in=140] (2.31, 2.29) to [out=-40, in=105] (3.34, 1.54); % ~~~ horn ~~~~~~ \draw (3.48, 4.19) to [out=35, in=30] (4.67, 5.22) to [out=35, in=30](3.65, 4.82);\draw (3.65, 4.34) to [out=90 , in=280] (3.59, 4.69);\draw (3.85, 4.51) to [out=90 , in=290] (3.79, 4.75);\draw (4.00, 4.64) to [out=95 , in=290] (3.96, 4.83);\draw (4.19, 4.77) to [out=95 , in=300] (4.16, 4.89); }}

\tikzset{% uni-corn, as one-liners uni/.style={line width=4.5pt,decorate,decoration={mirror=true}}, uni/.pic={ % ~~~ head ~~~~~~~~ \draw (2.96, 4.67) to [out=88, in=95] (3.22, 4.78);\draw (3.13, 4.63) to [out=55, in=85] (3.22, 4.43) to [out=-45, in=105] (3.57, 3.79) to [out=288, in=85] (3.88, 2.86);\draw (3.77, 2.82) to [out=230, in=280] (3.32, 2.73) to [out=90, in=300] (2.79, 3.34);\draw (2.84, 3.28) to [out=185, in=270] (2.20, 3.92) to [out=250, in=160] (2.67, 2.83); % ~~~ eye ~~~~~~~~ \draw (3.30, 4.10) to [out=190, in=160] (3.04, 4.04) to [out=300, in=190] (3.32, 3.93); % ~~~ nose ~~~~~~~~ \draw (3.84, 2.83) -- (3.70, 3.00); % ~~~ hair ~~~~~~~ \draw (2.89, 4.83) to [out=180, in=90] (1.78, 3.69) to [out=270, in=160] (2.90, 2.50);\draw (1.63, 4.24) to [out=230, in=80] (2.14, .76);\draw (1.73, .45) to [out=70, in=270] (1.03, 3.04);\draw (1.61, 3.65) to [out=260, in=140] (2.31, 2.29) to [out=-40, in=105] (3.34, 1.54); % ~~~ horn ~~~~~~ \draw (3.48, 4.19) to [out=35, in=30] (4.67, 5.22) to [out=35, in=30](3.65, 4.82);\draw (3.65, 4.34) to [out=90 , in=280] (3.59, 4.69);\draw (3.85, 4.51) to [out=90 , in=290] (3.79, 4.75);\draw (4.00, 4.64) to [out=95 , in=290] (3.96, 4.83);\draw (4.19, 4.77) to [out=95 , in=300] (4.16, 4.89); }}

\tikz{ \pic at (-\shft,0) {beauty}; \pic [xscale=-1] at (+\shft,0) {uni}; }

\end{document}

MS-SPO
  • 11,519
5

result

\documentclass[10pt, border=5mm]{standalone}
\usepackage{color}
\usepackage{tikz}
\usetikzlibrary{shapes.callouts,decorations.shapes,shapes.geometric}

% ~~~ (most) colors ~~~~~~~~~~~~~~~~~~~~~~~ \definecolor{pnk}{RGB}{244,173,203} \definecolor{yel}{RGB}{245,233,49} \definecolor{bld}{RGB}{110,181,233} \definecolor{bll}{RGB}{180,220,246} \definecolor{blu}{RGB}{145,200,239}

% ~~~ short hand notation ~~~~~~~~~~~~~~~~ \newcommand\pix[3]{ \node [fill=#1] at (#2/4,#3/4) {};}

\begin{document}

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

\tikzset{% beaty-corn, as one-liners beauty/.style={line width=1pt,decoration={shape sep=8pt,shape size=8pt}}, beauty/.pic={ % ~~~ horn coloration ~~~~~~~~ \draw [decoration={shape sep=11pt,shape size=10pt},my star=6, paint=yellow] (4.67, 5.22) -- (3.25,4.4); % ~~~ head ~~~~~~~~ \draw (2.96, 4.67) to [out=88, in=95] (3.22, 4.78);\draw (3.13, 4.63) to [out=55, in=85] (3.22, 4.43) to [out=-45, in=105] (3.57, 3.79) to [out=288, in=85] (3.88, 2.86);\draw (3.77, 2.82) to [out=230, in=280] (3.32, 2.73) to [out=90, in=300] (2.79, 3.34);\draw (2.84, 3.28) to [out=185, in=270] (2.20, 3.92) to [out=250, in=160] (2.67, 2.83); % ~~~ eye ~~~~~~~~ \draw (3.30, 4.10) to [out=190, in=160] (3.04, 4.04) to [out=300, in=190] (3.32, 3.93); % ~~~ nose ~~~~~~~~ \draw (3.84, 2.83) -- (3.70, 3.00); % ~~~ hair ~~~~~~~ \draw [my star=5, paint=red] (2.89, 4.83) to [out=180, in=90] (1.78, 3.69) to [out=270, in=160] (2.90, 2.50);\draw [my star=5, paint=orange] (1.63, 4.24) to [out=230, in=80] (2.14, .76);\draw [my star=5, paint=blue] (1.73, .45) to [out=70, in=270] (1.03, 3.04);\draw [my star=5, paint=yellow] (1.61, 3.65) to [out=260, in=140] (2.31, 2.29) to [out=-40, in=105] (3.34, 1.54); % ~~~ horn ~~~~~~ \draw (3.48, 4.19) to [out=35, in=30] (4.67, 5.22) to [out=35, in=30](3.65, 4.82);\draw (3.65, 4.34) to [out=90 , in=280] (3.59, 4.69);\draw (3.85, 4.51) to [out=90 , in=290] (3.79, 4.75);\draw (4.00, 4.64) to [out=95 , in=290] (3.96, 4.83);\draw (4.19, 4.77) to [out=95 , in=300] (4.16, 4.89); }}

\tikzset{ bitcorn/.pic={ % ~~~ starting somewhere ~~~~~~~~~~ \node [fill=pnk] at (0,0) {};% so it begins \node [fill=bld] at (1/4,0) {};\node [fill=bll] at (2/4,0) {}; \node [fill=blu] at (3/4,0) {};\node [fill=blu] at (4/4,0) {}; \node [fill=pnk] at (5/4,0) {};\node [fill=bll] at (6/4,0) {}; % ~~~ line(s) above ~~~~~~~~~ \pix{pnk}{1}{1}% using short hand notation \pix{bld}{2}{1}\pix{pnk}{4}{1}\pix{bld}{5}{1}\pix{blu}{6}{1}\pix{blu}{7}{1}\pix{blu}{8}{1} \pix{pnk}{4}{2}\pix{bll}{5}{2}\pix{black}{6}{2}\pix{bll}{7}{2}\pix{bll}{8}{2} \pix{pnk}{4}{3}\pix{pnk}{5}{3}\pix{pnk}{6}{3}\pix{yel}{7}{3} \pix{pnk}{5}{4}\pix{pnk}{6}{4}\pix{yel}{8}{4} % ~~~ line(s) below ~~~~~~~~~~ \pix{pnk}{1}{-1}\pix{blu}{2}{-1}\pix{blu}{3}{-1}\pix{blu}{4}{-1}\pix{bll}{5}{-1}\pix{blu}{6}{-1} \pix{pnk}{1}{-2}\pix{blu}{2}{-2}\pix{bll}{3}{-2}\pix{bld}{5}{-2}\pix{bll}{7}{-2} \pix{gray!40}{2}{-3}\pix{gray!40}{5}{-3}\pix{gray!40}{7}{-3} }}

\tikz{ % text \node [draw,inner ysep=2em,inner xsep=3em,rounded corners=20pt,line width=3pt] at (-8,4) {\Huge{Once upon a time \dots}};

% dream
\node at (1,0) [draw,cloud callout,cloud puffs=15,callout relative pointer={(215:3cm)}, callout pointer segments=3,ball color=orange,inner color=yellow!70,outer color=orange!70] {\tikz{\pic [xscale=-1] {beauty};}};

% dreamer
\pic at (-12,-8) [scale=2.5,transform shape] {bitcorn};

}

\end{document}

MS-SPO
  • 11,519
4

For your entertainment I tried phind.com on the unicorns. In contrast to ChatGPT it claims to access the internet and uses links, i.e. actual information, with focus on programming.

Being closer to a search engine it also displays related links ... though it's not always clear, how it obtained the solution from said links. This seems to be a feature of GPT (General Pre-Trained language models, which can't be or map knowledge models). (GPT-3.5, long answer)

Enjoy the results.

draw a unicorn with tikz, to be used in latex.

Could be worse ...

result 1

draw a detailed unicorn with tikz, to be used in latex. show the complete code, please.

qed ...

result 2

Code

As produced, without indenting, just combined into one.

\documentclass[10pt,border=3mm,tikz]{standalone}% my edit
%\documentclass{article}% as proposed
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% Body
\filldraw[color=white, fill=white] (0,0) circle (2);
% Horn
\filldraw[color=yellow, fill=yellow] (0,2) -- (-0.5,4) -- (0.5,4) -- cycle;
% Mane
\filldraw[color=pink, fill=pink] (-1,1) -- (-2,3) -- (-1,3) -- cycle;
\filldraw[color=pink, fill=pink] (1,1) -- (2,3) -- (1,3) -- cycle;
% Tail
\draw[color=blue, ultra thick] (0,-2) -- (0,-4);
% Eyes
\filldraw[color=black, fill=black] (-0.5,0.5) circle (0.1);
\filldraw[color=black, fill=black] (0.5,0.5) circle (0.1);
\end{tikzpicture}

\begin{tikzpicture} % Body \filldraw[gray!50] (0,0) circle (2cm); % Legs \draw[gray, thick] (-1.5,-1) -- (-1.5,-3); \draw[gray, thick] (1.5,-1) -- (1.5,-3); % Horn \draw[gray, thick] (0,2) -- (0,4); % Eyes \filldraw[black] (-0.5,0.5) circle (0.1cm); \filldraw[black] (0.5,0.5) circle (0.1cm); % Label \node[anchor=north] at (0,-3.5) {Unicorn}; \end{tikzpicture}

\end{document}

P.S.: some "refinement"

Following some guide how to formulate prompts (input to such interfaces), I tried the following. Please judge for yourself ...

Prompt/instruction: Draw a unicorn using tikz, so I can use it with Latex. Make it detailed. Avoid using simple shapes, i.e. avoid triangles, avoid circles, avoid simple lines, use more sophisticated elements. Output the complete code so I can copy it.

result 3

% Draw a unicorn using tikz, so I can use it with Latex. Make it detailed. Avoid using simple shapes, i.e. avoid triangles, avoid circles, avoid simple lines, use more sophisticated elements. Output the complete code so I can copy it.

\documentclass{article} \usepackage{tikz}

\begin{document} \begin{tikzpicture}[scale=0.5] % Head \fill[white] (0,0) circle (4); % Eyes \fill[black] (-1,1.5) circle (0.5); \fill[black] (1,1.5) circle (0.5); % Horn \draw[gray, line width=2] (0,0) -- (0,4); % Ears \fill[gray] (-3,3) -- (-2,4) -- (-1,3) -- cycle; \fill[gray] (3,3) -- (2,4) -- (1,3) -- cycle; % Mane \fill[blue!50] (-4,0) to[out=90,in=180] (-3,2) to[out=0,in=180] (-2,4) to[out=0,in=180] (2,4) to[out=0,in=180] (3,2) to[out=0,in=90] (4,0); % Body \fill[pink] (-4,0) to[out=270,in=180] (-2,-2) to[out=0,in=180] (2,-2) to[out=0,in=270] (4,0); % Legs \fill[gray] (-3,-4) rectangle (-1,-2); \fill[gray] (3,-4) rectangle (1,-2); % Hooves \fill[black] (-2.5,-4) rectangle (-1.5,-3.5); \fill[black] (2.5,-4) rectangle (1.5,-3.5); \end{tikzpicture} \end{document}

To make the "head" visible, I changed it to:

% Head
\fill[yellow!50] (0,0) circle (4);

result 4

One of us probably needs to study unicorn anatomy ...

MS-SPO
  • 11,519
3

Let's have a look at a new tikz bread, which:

The parameter set for the scale determines the esthetics of the result.

uni-masto-corn Scale as given in code

scale = 0.0125 Scale set to 0.0125

0.0225 Scale set to 0.0225

\documentclass[10pt, border=3mm]{standalone}
\usepackage{color}
\usepackage{tikz}

% ~~~ (most) colors ~~~~~~~~~~~~~~~~~~~~~~~ \definecolor{pnk}{RGB}{244,173,203} \definecolor{yel}{RGB}{245,233,49} \definecolor{bld}{RGB}{110,181,233} \definecolor{bll}{RGB}{180,220,246} \definecolor{blu}{RGB}{145,200,239}

% ~~~ NEW: short hand notation with animal magic ~~~~~~~~~~~~~~~~ \newcommand\pix[3]{ \pic [fill=#1,scale=0.0185,transform shape] at (#2/4,#3/4) {masto};}

\begin{document}

% ~~~ a pic-ture here and a pic-ture there, % tikz picture is that place where ... \tikzset{% guess the bread <<< NEW masto/.pic={ % ~~~ ele ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \draw [fill=#1,line width=.4pt, draw=black!80]% (6,0) .. controls +(0:3.4) and +(-90:-3.4) ..% (12,-4) -- (12,-6.6) .. controls +(90:-3) and +(0:3) ..% (6,-9.97) .. controls +(0:-1) and +(-10:1) ..%
(3.4,-9.64) .. controls +(-80:1) and +(0:-2) ..% (6,-12) .. controls +(0:1) and +(30:-1) ..% (8.2,-11.3) -- (8.3,-12.4) .. controls +(30:-1) and +(0:1) ..% (5.55,-13) .. controls +(0:-4) and +(90:-5) ..%
(0,-6.6) -- (0,-4) .. controls +(90:3.4) and +(0:-3.4) ..%
(6,0);%
% ~~~ m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \draw [fill=green!20, line join=round, cap=round, line width=.4pt, draw=black!80]% (2.1,-7.9) -- (2.1,-4.4) .. controls +(90:1.5) and +(0:-1) ..% (4.15,-2.15).. controls +(0:1) and +(-60:-1) ..% (6,-3.5) .. controls +(60:1) and +(0:-1) ..%
(7.9,-2.15) .. controls +(0:1) and +(90:1.5) ..%
(9.9,-4.4) -- (9.9,-7.9) -- (8.5,-7.9) --% (8.5,-4.4) .. controls +(90:.5) and +(180:-.5) ..% (7.6,-3.5) .. controls +(0:-.5) and +(90:.5) ..% (6.7,-4.4) -- (6.7,-6.6) -- (5.3,-6.6) -- (5.3,-4.4)% .. controls +(90:.5) and +(180:-.5) ..% (4.4,-3.5) .. controls +(0:-.5) and +(-90:-.5) ..% (3.53,-4.4) -- (3.53,-7.9) -- (2.1,-7.9);% }}

% ~~~ unicorns can come in pixels ... \tikz{% <<< rearranged % ~~~ starting somewhere ~~~~~~~~~~ \pix{pnk}{0}{0}\pix{bld}{1}{0}\pix{bll}{2}{0}\pix{blu}{3}{0}\pix{blu}{4}{0}\pix{pnk}{5}{0}\pix{bll}{6}{0}
% ~~~ line(s) above ~~~~~~~~~ \pix{pnk}{1}{1}\pix{bld}{2}{1}\pix{pnk}{4}{1}\pix{bld}{5}{1}\pix{blu}{6}{1}\pix{blu}{7}{1}\pix{blu}{8}{1} \pix{pnk}{4}{2}\pix{bll}{5}{2}\pix{black}{6}{2}\pix{bll}{7}{2}\pix{bll}{8}{2} \pix{pnk}{4}{3}\pix{pnk}{5}{3}\pix{pnk}{6}{3}\pix{yel}{7}{3} \pix{pnk}{5}{4}\pix{pnk}{6}{4}\pix{yel}{8}{4} % ~~~ line(s) below ~~~~~~~~~~ \pix{pnk}{1}{-1}\pix{blu}{2}{-1}\pix{blu}{3}{-1}\pix{blu}{4}{-1}\pix{bll}{5}{-1}\pix{blu}{6}{-1} \pix{pnk}{1}{-2}\pix{blu}{2}{-2}\pix{bll}{3}{-2}\pix{bld}{5}{-2}\pix{bll}{7}{-2} \pix{gray!40}{2}{-3}\pix{gray!40}{5}{-3}\pix{gray!40}{7}{-3} }

\end{document}

MS-SPO
  • 11,519