根据 tikz 环境中对象的三维位置分配颜色

根据 tikz 环境中对象的三维位置分配颜色

我想制作一个思维导图,让整个思维导图中的颜色逐渐变化。由于颜色通常由 RGB 代码定义,因此我必须使用 3D 思维导图才能实现这一点。

我的思维导图如下所示(不过这个是2D的):

\documentclass[landscape]{article}
\usepackage[a2paper]{geometry}
\usepackage[usenames,dvipsnames]{color}
\usepackage{pbox}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\pagenumbering{gobble}
\definecolor{gold}{RGB}{255,215,0}
\definecolor{beetjeblue}{RGB}{65,105,225}
\definecolor{zalmorange}{RGB}{255,160,122}
\definecolor{firebrick}{RGB}{178,34,34}
\definecolor{donker}{RGB}{153,50,204}
\definecolor{dviolet}{RGB}{148,0,211}
\definecolor{ired}{RGB}{205,92,92}
\definecolor{rbrown}{RGB}{188,143,143}
\definecolor{palegreen}{RGB}{154,205,50}
\definecolor{plum}{RGB}{221,160,221}
\definecolor{LSB}{RGB}{135,206,250}
\definecolor{navy}{RGB}{0,0,128}
\definecolor{LB}{RGB}{100,149,237}
\definecolor{navajo}{RGB}{255,222,173}
\definecolor{honey}{RGB}{193,205,193}
\definecolor{darkslate}{RGB}{49,79,79}

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}[node distance=1cm, auto]  
\tikzset{
mynode/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=gold!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode2/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=palegreen!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode3/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=beetjeblue!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode4/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=cyan!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode5/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=rbrown!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode6/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=green!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode7/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=ired!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode8/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=firebrick!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode9/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=red!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode10/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=donker!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode11/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=dviolet!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode12/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=yellow!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode13/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=plum!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode14/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=LSB!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode15/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=navy!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode16/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=LB!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode17/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=navajo!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode18/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=honey!50,very thick, inner sep=1em, minimum size=3em, text centered},
mynode19/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=darkslate!50,very thick, inner sep=1em, minimum size=3em, text centered},
myarrow/.style={->, >=latex', shorten >=1pt, thick},
mylabel/.style={text width=7em, text centered} 
}  
\node[mynode12] (geschiedenis) {Westerse geschiedenis};  
\node[below=3cm of geschiedenis] (dummy) {}; 
\node[mynode,below=3cm of geschiedenis] (DT) {Darwins theorie van `Natuurlijke selectie'};
\node[left=3.5cm of dummy] (1) {};  
\node[right=3.5cm of dummy] (2) {};
\node[mynode2,above=6cm of 1] (3) {\pbox{20cm}{Ten tijde van Aristotoles: Teleologie\\in andere woorden: doeloorzakelijkheid}}; 
\node[mynode8,above=6cm of 2] (4) {\pbox{20cm}{In de middeleeuwen: \emph{argument from design}\\Orde in de kosmos en functionele doelmatigheid\\zijn een bewijs voor een intelligente maker}}; 
\node[above=3cm of 3] (dummy2) {}; 
\node[mynode6,left=of dummy2] (31) {Heliocentrisme}; 
\node[mynode6,right=of dummy2] (32) {Geocentrisme}; 
\node[mynode9,above=4.5cm of 4] (41) {Ontwerpargument in de 19$^e$ eeuw aageduidt als `Natuurlijke Theologie'}; 
\node[mynode12,below=13cm of 4] (evoalt) {Andere evolutietheorie\"en};
\node[below=3cm of evoalt] (dummy3) {};
\node[mynode11,left=1cm of dummy3] (lamarck) {\pbox{20cm}{$18^e$ eeuw - Jean-Baptiste de Lamarck:\\Evolutie wordt gestuurd door innerlijk streven}};
\node[mynode13,below=3cm of lamarck] (gebruik) {\pbox{20cm}{Principe van gebruik en onbruik:\\lichaamsdelen intensief worden gebruik treden\\gaandeweg prominent naar voren.}};
\node[mynode13,left=3cm of gebruik] (erfelijkheid) {\pbox{20cm}{Verworven eigenschappen zijn erfelijk}};
\node[mynode3,right=1cm of dummy3] (spencer) {\pbox{20cm}{$19^e$ eeuw - Herbert Spencer:\\Evolutie is een meer algemeen, metafysisch\\principe dan wetenschappelijke hypothese.}};
\node[mynode14,below=3cm of spencer] (eenvoud) {\pbox{20cm}{Niet alleen levende natuur maar hele universum\\zien een ontwikkeling van eenvoud naar veelvoud,\\ van homogeniteit naar heterogeniteit.}};
\node[mynode14,right=3cm of eenvoud] (progontw) {\pbox{20cm}{Progressieve ontwikkeling is\\een natuurlijke wetmatigheid.}};
\node[mynode14,above=8cm of progontw] (socdarwin) {\pbox{20cm}{Vader van het \textbf{sociaal-darwinisme}:\\de gedachte dat we de arme en zwakke\\ medemens niet moeten bijstaan omdat\\dit het natuurlijke evenwicht verstoort.}};
\node[mynode12,left=6cm of DT] (bewijsstukken) {Bewijsstukken evolutietheorie};
\node[mynode15,below=3cm of bewijsstukken] (geologie) {Geologie};
\node[below=1cm of geologie] (dummy4) {};
\node[mynode16,right=1cm of dummy4] (catastrof) {Catastrofisme};
\node[mynode16,left=1cm of dummy4] (uniform) {Uniformitarisme};
\node[mynode15,left=5cm of geologie] (embryo) {Embryologie};
\node[mynode16,below=2cm of embryo] (haeckel) {\pbox{20cm}{Haeckel - recapitulatietheorie\\De ontogenie recapituleert de fylogenie.}};
\node[mynode15,above=3cm of embryo] (vglanatomie) {Vergelijkende anatomie};
\node[left=2cm of vglanatomie] (dummy5) {};
\node[mynode16,above=1cm of dummy5] (homo) {\pbox{20cm}{Homologe eigenschappen: hebben \\\emph{verschillende} functies, maar\\opgebouwd uit \emph{hetzelfde} schema}};
\node[mynode16,below=1cm of dummy5] (ana) {\pbox{20cm}{Analoge eigenschappen: dezelfde functies,\\ maar onafhankelijk ge\"evolueerd.}};
\node[mynode15,above=3cm of vglanatomie] (anatom) {Anatomie};
\node[mynode16,left=3cm of anatom] (rudi) {Rudimentaire organen};
\node[mynode15,above=3cm of bewijsstukken] (pale) {Paleontologie};
\node[mynode16,above=1cm of anatom] (owen) {Richard Owen: fossielen};
\node[mynode15,right=2cm of pale] (bio) {Biogeografie};
\node[mynode16,above=13.5cm of catastrof] (biouitleg) {\pbox{20cm}{Verspreiding van planten\\en niet homogene verspreiding}};

\node[mynode12,right=6cm of DT] (raadsels) {Wat is de drijvende kracht achter de evolutietheorie?};

\node[mynode17, above=.5cm of raadsels] (malthus) {\pbox{20cm}{Malthus: \emph{struggle for existence}\\oorlogen, epidemie\"en en hongersnoden\\doen hun nuttige werk om de populatie weer\\tot levensvatbare omvang terug te brengen.}};

\node[mynode12, below=13cm of 3] (resultaat) {Resultaat};
\node[mynode19, below=1.5cm of haeckel] (neodarwin) {\pbox{20cm}{Het combineren van Darwins theorie\\van natuurlijke selectie en Mendels\\erfelijkheidsleer leidde tot het\\\textbf{Neo-darwinisme}}};
\node[mynode19, right=1.5cm of neodarwin] (drift) {\pbox{20cm}{`Genetische drift': de genetische opmaak\\van een kleine populatie kan door toevals-\\schommelingen sneller veranderen dan die van\\ een grote populatie.}};

\node[mynode18, right=4.5cm of 32] (pangenese) {\pbox{20cm}{Darwins oplossing - \emph{pangenese}:\\Geslachtscellen ontvangen voortdurend informatie\\ over wat er in het lichaam gebeurt, met als basis\\\textbf{Lamarck's erfelijkheidstheorie}.}};
\node[mynode12, below=4.5cm of pangenese] (erf) {Hoe zat het dan met erfelijkheid?};
\node[mynode18, right=2cm of pangenese] (kiem) {\pbox{20cm}{\emph{Weismann} -     \textbf{kiemplastheorie}:\\We moeten onderscheid maken tussen\\geslachtscellen en lichaamscellen.}};
\node[mynode18, below=4.5cm of kiem] (mendel) {\pbox{20cm}{\textbf{\emph{Mendel}'s erfelijkheidstheorie}:\\Onderscheid genotype en fenotype,\\`dominante' en `recessieve' genen.}};

\draw[<-, >=latex', shorten >=2pt, shorten <=2pt, bend right=30, thick] 
(3.south) to node[auto, swap] {}(geschiedenis.north); 
\draw[<-, >=latex', shorten >=2pt, shorten <=2pt, bend left=30, thick] 
(4.south) to node[auto, swap] {}(geschiedenis.north); 
\draw[<-, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(geschiedenis.south) to node[auto, swap] {}(DT.north); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick, bend left=30] 
(DT.south) to node[auto, swap] {}(evoalt.north); 

\draw[->, >=latex', shorten >=2pt, shorten <=2pt, bend right=20, thick] 
(evoalt.south) to node[auto, swap] {}(lamarck.north); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, bend left=20, thick] 
(evoalt.south) to node[auto, swap] {}(spencer.north); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(lamarck.south) to node[auto, swap] {}(gebruik.north); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, bend right=10, thick] 
(lamarck.south west) to node[auto, swap] {}(erfelijkheid.north); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(spencer.south) to node[auto, swap] {}(eenvoud.north); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, bend left=30, thick] 
(spencer.east) to node[auto, swap] {}(progontw.north); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, bend right=30, thick] 
(spencer.east) to node[auto, swap] {}(socdarwin.south); 

\draw[->, >=latex', shorten >=2pt, shorten <=2pt, bend left=30, thick] 
(3.north) to node[auto, swap] {}(31.south); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, bend right=30, thick] 
(3.north) to node[auto, swap] {}(32.south); 
\draw[<->, >=latex', shorten >=2pt, shorten <=2pt, thick, dashed] 
(31.east) to node[auto, swap] {}(32.west); 
\node[mylabel, above=0cm of dummy2] (label) {versus};
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(4.north) to node[auto, swap] {}(41.south); 

\draw[->, >=latex', shorten >=2pt, shorten <=2pt, bend right=30, thick] 
(geologie.west) to node[auto, swap] {}(uniform.north); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, bend left=30, thick] 
(geologie.east) to node[auto, swap] {}(catastrof.north); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(DT.west) to node[auto, swap] {}(bewijsstukken.east); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(bewijsstukken.south) to node[auto, swap] {}(geologie.north); 
\draw[<->, >=latex', shorten >=2pt, shorten <=2pt, thick, dashed] 
(catastrof.west) to node[auto, swap] {}(uniform.east); 
\node[mylabel, above=0cm of dummy4] (label) {versus};
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(bewijsstukken.south west) to node[auto, swap] {}(embryo.north east); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(embryo.south) to node[auto, swap] {}(haeckel.north); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(bewijsstukken.west) to node[auto, swap] {}(vglanatomie.east); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick, bend left=30] 
(vglanatomie.south) to node[auto, swap] {}(ana.east); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick, bend right=30] 
(vglanatomie.north) to node[auto, swap] {}(homo.east); 
\draw[<->, >=latex', shorten >=2pt, shorten <=2pt, thick, dashed] 
(homo.south) to node[auto, swap] {}(ana.north); 

\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(bewijsstukken.north west) to node[auto, swap] {}(anatom.south east); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(anatom.west) to node[auto, swap] {}(rudi.east); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(bewijsstukken.north) to node[auto, swap] {}(pale.south); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(pale.north west) to node[auto, swap] {}(owen.south east); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick, bend right=30] 
(bewijsstukken.north east) to node[auto, swap] {}(bio.south); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick, bend right=30] 
(bio.north) to node[auto, swap] {}(biouitleg.south); 

\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(DT.east) to node[auto, swap] {}(raadsels.west); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(raadsels.north) to node[auto, swap] {}(malthus.south); 

\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(DT.north east) to node[auto, swap] {}(erf.south west); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(erf.north) to node[auto, swap] {}(pangenese.south); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick, bend right=20] 
(erf.north east) to node[auto, swap] {}(kiem.south); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick] 
(erf.east) to node[auto, swap] {} (mendel.west); 

\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick, bend right=30] 
(DT.south) to node[auto, swap] {}(resultaat.north); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick, bend right=10] 
(resultaat.west) to node[auto, swap] {}(neodarwin.north east); 
\draw[->, >=latex', shorten >=2pt, shorten <=2pt, thick, bend right=10] 
(resultaat.south west) to node[auto, swap] {}(drift.north east); 


\end{tikzpicture} 
\end{figure}

\end{document}

因此基本思想是每个节点:

mynode/.style={rectangle,rounded corners,draw=black, top color=white, bottom color=gold!50,very thick, inner sep=1em, minimum size=3em, text centered},

具有定义的颜色(在本例中为“金色”)。我想根据元素在 3D 环境/思维导图中的位置自动使用颜色。

所以:

  1. 位置 x= 红色数量
  2. 位置 y= 绿色量
  3. 位置 z= 蓝色量

答案1

您的示例非常庞大,因此我大幅削减了代码,并专注于 3D 中颜色的定位。

\extractcolorspec在此示例中,我通过以下命令获取颜色规范:xcolor包,我们得到例如 gold-> {rgb}{1,0.84314,0}-> x=5*1=5, y=3*0.84314=2.52942, z=10*0=0因为我将象限从 限制(0,0,0)(5,3,10)。它与 配合得很好rgb,但它需要一些额外的颜色从其他颜色空间转换为rgb,例如whiteblack不能立即工作,因为它们是在gray颜色空间中定义的。

编辑:代码中有两个命令:\catchme\placeme。都用于\node放置文本。第一个使用定义的颜色,第二个命令使用点。

我附上了代码和结果预览,我们可以使用 pdf-、xe- 和 lualatex。

%! *latex mal-colours.tex
\documentclass[a4paper]{article}
\pagestyle{empty}
\usepackage{xcolor}
\usepackage{tikz}
\definecolor{gold}{RGB}{255,215,0}
\definecolor{beetjeblue}{RGB}{65,105,225}
\definecolor{zalmorange}{RGB}{255,160,122}
\definecolor{firebrick}{RGB}{178,34,34}
\definecolor{donker}{RGB}{153,50,204}
\definecolor{dviolet}{RGB}{148,0,211}
\definecolor{ired}{RGB}{205,92,92}
\definecolor{rbrown}{RGB}{188,143,143}
\definecolor{palegreen}{RGB}{154,205,50}
\definecolor{plum}{RGB}{221,160,221}
\definecolor{LSB}{RGB}{135,206,250}
\definecolor{navy}{RGB}{0,0,128}
\definecolor{LB}{RGB}{100,149,237}
\definecolor{navajo}{RGB}{255,222,173}
\definecolor{honey}{RGB}{193,205,193}
\definecolor{darkslate}{RGB}{49,79,79}
\begin{document}
\def\malsep#1#2{\malcoord#2 }
\def\malcoord#1,#2,#3 {%
  \pgfmathparse{#1*\xmax}%
  \let\mred=\pgfmathresult
  \pgfmathparse{#2*\ymax}%
  \let\mgreen=\pgfmathresult
  \pgfmathparse{#3*\zmax}%
  \let\mblue=\pgfmathresult
  }%
\def\catchme#1{%
  \extractcolorspec{#1}{\test}%
  %\typeout{\meaning\test}% Show me the color specification...
  \expandafter\malsep\test
  \node[#1]at(\mred,\mgreen,\mblue){#1};
  }
\def\placeme#1{\malplaceme#1 }
\def\malplaceme#1,#2,#3 {%
  \pgfmathparse{#1/\xmax}%
  \let\xplace=\pgfmathresult
  \pgfmathparse{#2/\ymax}%
  \let\yplace=\pgfmathresult
  \pgfmathparse{#3/\zmax}%
  \let\zplace=\pgfmathresult
  \definecolor{maltemp}{rgb}{\xplace,\yplace,\zplace}%
  \node[maltemp]at(#1,#2,#3){new-color};
  }
\def\xmax{5}
\def\ymax{3}
\def\zmax{10}
\begin{tikzpicture}
\draw[->] (0,0,0)--(\xmax,0,0) node[yshift=-1.5ex,xshift=-3ex] {$x$};
\draw[->] (0,0,0)--(0,\ymax,0) node[yshift=-3ex,xshift=-1ex] {$y$};
\draw[->] (0,0,0)--(0,0,\zmax) node[yshift=2ex,xshift=1ex] {$z$};
\foreach \mcolor in {red, green, blue, gold, beetjeblue, zalmorange, firebrick, donker, dviolet, ired, rbrown, palegreen, plum, LSB, navy, LB, navajo, honey, darkslate} { \catchme{\mcolor} }
\placeme{2,2,2}
\placeme{0,2,8}
\end{tikzpicture} 
\end{document}

mwe,第 1 部分


这是具有用户定义最小值和最大值点的示例。

%! *latex mal-colours.tex
\documentclass[a4paper]{article}
\pagestyle{empty}
\usepackage{xcolor}
\usepackage{tikz}
\definecolor{gold}{RGB}{255,215,0}
\definecolor{beetjeblue}{RGB}{65,105,225}
\definecolor{zalmorange}{RGB}{255,160,122}
\definecolor{firebrick}{RGB}{178,34,34}
\definecolor{donker}{RGB}{153,50,204}
\definecolor{dviolet}{RGB}{148,0,211}
\definecolor{ired}{RGB}{205,92,92}
\definecolor{rbrown}{RGB}{188,143,143}
\definecolor{palegreen}{RGB}{154,205,50}
\definecolor{plum}{RGB}{221,160,221}
\definecolor{LSB}{RGB}{135,206,250}
\definecolor{navy}{RGB}{0,0,128}
\definecolor{LB}{RGB}{100,149,237}
\definecolor{navajo}{RGB}{255,222,173}
\definecolor{honey}{RGB}{193,205,193}
\definecolor{darkslate}{RGB}{49,79,79}
\begin{document}
\def\malsep#1#2{\malcoord#2 }
\def\malcoord#1,#2,#3 {%
  \pgfmathparse{#1*(\xmax-\xmin)+\xmin}%
  \let\mred=\pgfmathresult
  \pgfmathparse{#2*(\ymax-\ymin)+\ymin}%
  \let\mgreen=\pgfmathresult
  \pgfmathparse{#3*(\zmax-\zmin)+\zmin}%
  \let\mblue=\pgfmathresult
  }%
\def\catchme#1{%
  \extractcolorspec{#1}{\test}%
  %\typeout{\meaning\test}% Show me the color specification...
  \expandafter\malsep\test
  \node[#1]at(\mred,\mgreen,\mblue){#1};
  }
\def\placeme#1{\malplaceme#1 }
\def\malplaceme#1,#2,#3 {%
  \pgfmathparse{(#1-\xmin)/(\xmax-\xmin)}%
  \let\xplace=\pgfmathresult
  \pgfmathparse{(#2-\ymin)/(\ymax-\ymin)}%
  \let\yplace=\pgfmathresult
  \pgfmathparse{(#3-\zmin)/(\zmax-\zmin)}%
  \let\zplace=\pgfmathresult
  \definecolor{maltemp}{rgb}{\xplace,\yplace,\zplace}%
  \node[maltemp]at(#1,#2,#3){new-color};
  }
\def\xmax{5} \def\ymax{3} \def\zmax{10}
\def\xmin{-3} \def\ymin{-2} \def\zmin{-3}
\begin{tikzpicture}
\draw[dotted] (\xmin,\ymin,\zmax)--(\xmin,\ymin,\zmin)--(\xmin,\ymax,\zmin)--(\xmin,\ymax,\zmax)--cycle;
\draw[dotted] (\xmin,\ymin,\zmin)--(\xmin,\ymin,\zmax)--(\xmax,\ymin,\zmax)--(\xmax,\ymin,\zmin)--cycle;
\draw[dotted] (\xmin,\ymin,\zmin)--(\xmin,\ymax,\zmin)--(\xmax,\ymax,\zmin)--(\xmax,\ymin,\zmin)--cycle;
\draw[dashed] (\xmin,0,0)--(0,0,0);
\draw[->] (0,0,0)--(\xmax,0,0) node[yshift=-1.5ex,xshift=-3ex] {$x$};
\draw[dashed] (0,\ymin,0)--(0,0,0);
\draw[->] (0,0,0)--(0,\ymax,0) node[yshift=-3ex,xshift=-1ex] {$y$};
\draw[dashed] (0,0,\zmin)--(0,0,0);
\draw[->] (0,0,0)--(0,0,\zmax) node[yshift=2ex,xshift=1ex] {$z$};
\foreach \mcolor in {red, green, blue, gold, beetjeblue, zalmorange, firebrick, donker, dviolet, ired, rbrown, palegreen, plum, LSB, navy, LB, navajo, honey, darkslate} { \catchme{\mcolor} }
\placeme{2,2,2}
\placeme{0,2,8}
\end{tikzpicture} 
\end{document}

mwe,第 2 部分

相关内容