Re: Spettro elettromagnetico con TikZ

#85173
Up
0
Down
::

logos” post=84574Vorrei fare un ulteriore aggiustamento: mi piacerebbe che anche lo spazio bianco tra le linee curve che fanno da zoom per il visibile fosse fatta ad arcobaleno, ma con un’opacità del 50%. Son convinto che non basti farne una curva chiusa e usare shade con il raimbow per farlo, vero?

Invece basta 🙂

Ho anche apportato qualche miglioria al codice che vado poi a spiegare più nel dettaglio probabilmente questa sera: `
\documentclass[dvipsnames*,svgnames]{article}

%— Testo
\usepackage[LGRx,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}

%— Pacchetti utili
\usepackage{siunitx}

%— TikZ e impostazioni
\usepackage{tikz}
\usetikzlibrary{shadings}

% Spectrum-def
\pgfdeclarehorizontalshading{rainbow}{100bp}{
color(0bp)=(violet); color(25bp)=(violet);
color(35bp)=(blue); color(45bp)=(cyan);
color(55bp)=(green); color(65bp)=(yellow);
color(75bp)=(red); color(100bp)=(red)}

\tikzset{math mode/.style={
execute at begin node=$,
execute at end node=$,
}
}

%— Inizio del documento:

\begin{document}

%%%%%%
%%%%%%
%%%%%%

\begin{center}
\begin{tikzpicture}[scale=0.88,font=\footnotesize,
line cap=round,
line join=round,
x=1.0cm,y=1.0cm]
% Spectrum
\shade[shading=rainbow] (0,0) rectangle (9,1);

\draw[very thin] (0,0) rectangle (9,1);
\draw (0,0) — (9,0);
\foreach \x in {0,0.5,…,9} \draw[thin] (\x,0) — (\x,-0.1);
\foreach \x/\num in {0.5/400,3/500,5.5/600,8/700}{
\draw[semithick] (\x,0) — (\x,-0.2)
node[below,font=\tiny,math mode] {\SI{\num}{\nano\meter}};
}
%% Altro spettro
\fill[black] (-2.5,3) — (12.5,3) — (13,3.5) — (12.5,4) — (-2.5,4) — (-3,3.5) — cycle;
% Microvisibile
\shade[shading=rainbow] (3,3)coordinate(x1) rectangle (3.35,4);
% Linee di collegamento
\draw[thin] (3,3) ..controls +(-90:1.5) and +(20:1).. (0,1)coordinate(z1);
\draw[thin] (3.35,3)coordinate(x2) ..controls +(-90:1.5) and +(170:1.2).. (9,1)coordinate(z2);

% Colorazione dello spazio bianco
\shade[shading=rainbow,opacity=0.4] (3,3)..controls +(-90:1.5) and +(20:1).. (0,1) — (9,1) ..controls +(170:1.2) and +(-90:1.5)..(3.35,3)–cycle;

\foreach \x in {-2,-1,…,12} \draw (\x,3) — (\x,2.9);

\begin{scope}[font=\tiny, below, math mode]
% Scala dello spettro
\node at (-2,2.9) {\SI{0.001}{\nano\meter}};
\node at (1,2.9) {\SI{1}{\nano\meter}};
\node at (4,2.9) {\SI{1000}{\nano\meter}};
\node at (7,2.9) {\SI{1}{\milli\meter}};
\node at (8,2.9) {\SI{1}{\meter}};
\node at (10,2.9) {\SI{1}{\kilo\meter}};
\end{scope}
\begin{scope}[right,font=\tiny,right,color=white, text width=1cm]
% Nome delle onde
\node at (-2.2,3.6)
{raggi cosmici};
\node at (-0.7,3.6)
{raggi gamma};
\node at (0.6,3.6)
{raggi X \phantom{gamma}};
\node at (2.1,3.6)
{UV \phantom{gamma}};
\node at (3.4,3.6)
{\centering infrarosso (IR)};
\node at (4.8,3.6)
{microonde \phantom{gamma}};
\node at (6.6,3.6)
{radar \phantom{gamma}};
\node at (7.6,3.6)
{radio \phantom{gamma}};
\node at (9.6,3.6)
{banda larga};
\end{scope}
\end{tikzpicture}
\end{center}

\end{document}
` Il risultato:

[attachment=680]Senzanome_2013-04-22.jpg[/attachment]

Ciao
Claudio

Attachments:
You must be logged in to view attached files.

Go to top