7

I am writing a report about superconductivity and I need to reproduce the below graph as TikZ code.

enter image description here

For the moment, I have this :

\begin{tikzpicture}[scale=10]
\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$H(A\ldotp m^{-1})$};
\draw[thick,->] (0,0,0) -- (0,0.75,0) node[anchor=north west]{$T(K)$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$I(A)$};
\draw (0,0.55) parabola (0.75,0);
\draw (0,0,0.75) parabola (0.75,0,0);
\draw (0,0.55,0) parabola (0,0,0.75);
\draw (0.25,0.25) node [fill=none]
{\Large{Superconducting state}};
\draw (0.65,0.60) node [fill=none]
{\Large{Normal state}};
\draw (0.75,0) node [fill=red]
{$H_c$};
\draw (0,0.55) node [fill=red]
{$T_c$};
\draw (0,0,0.75) node [fill=red]
{$I_c$};
\end{tikzpicture}

And does that :

enter image description here

But I don't know how to make the red lines...

  • This looks pretty 2D for me. Which part bothers you? – Symbol 1 Jan 5 '16 at 20:02
  • I am trying hard with the red lines haha – PMC1234 Jan 5 '16 at 20:03
  • concentric circles clipped by the black contour? – Symbol 1 Jan 5 '16 at 20:04
  • 1
    Perhaps asymptote is a better match? C++-like syntax with 2 and 3D points as basic data types, flexible primitives for defining points, ... – vonbrand Jan 5 '16 at 22:21
  • Thank you for your suggestions guys, I've answered my own question below... @Symbol-1 – PMC1234 Jan 5 '16 at 23:04
7

I started from the code of your own answer, optimized it a little bit and added the red lines from your original question.

Optimization:

  • By defining a new style for the text decoration, you can save yourself some typing as you don't have to copy-paste the decoration in each path. Also, instead of defining a \myshift you can use the raise key of the decoration: curved text/.style={postaction={decorate},decoration={text along path,text align=center,raise=-2.2ex,text={|\sffamily|#1}}}
  • >=latex gives (in my opinion) "better" arrow heads for your axes.
  • Instead of using parabola for the plots, I defined 3 plot functions \plotone, \plottwo, \plotthree. By \defing those, they are easy to reuse (for shade and red lines). Also, because we use actual plots instead of parabola we can plot any function we like. That way you can recreate the plots from your original question better (with 1 quadratic and 2 qubic functions).
  • You'll notice that the \def of \plotone has a \z which is set to 0. This is done so we might be able to iterate and increase that \z value while drawing the red lines.
  • The shading can now be done by reusing those 3 plots. This is way better than the (manual) points from your own shading.
  • Adding the red balls can be done with a \node instead of \shade and \draw

Addition:

  • The red lines are drawn by plotting \plotone for \z values from 1 to 15 and clipping everything that falls outside of the area created by \plotone, \plottwo and \plotthree. They have a decreasing opacity that is set to ln(-\z+17)/ln(20) (returns values from about 1 to about 0 for \z from 1 to 15).

Code:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{decorations.text}

\begin{document}
\begin{tikzpicture}[>=latex, curved text/.style={postaction={decorate},decoration={text along path,text align=center,raise=-2.2ex,text={|\sffamily|#1}}}]

    % defining the three functions
    \def\z{0}
    \def\plotone{\x,-.1*\x*\x+5,\z}                             % y = x^2/10 + 5
    \def\plottwo{0,-.038*\x*\x*\x+.333*\x*\x-.948*\x+5,\x}      % y = -0.038z^3 + 0.333z^2 - 0.948z + 5
    \def\plotthree{\x,0,-.053*\x*\x*\x+0.42*\x*\x-1.333*\x+7}   % z = -0.053x^3 + 0.420x^2 - 1.333x + 7

    % dashed axes
    \draw[dashed]   (0,0,0) -- (7,0,0) 
                    (0,0,0) -- (0,5,0) 
                    (0,0,0) -- (0,0,7);

    % solid axes
    \draw[thick,->] (7,0,0) -- (10,0,0) node[anchor=north east] {$H(A\ldotp m^{-1})$};
    \draw[thick,->] (0,5,0) -- (0,7,0)  node[anchor=north west] {$T(K)$};
    \draw[thick,->] (0,0,7) -- (0,0,10) node[anchor=south east] {$I(A)$};

    % three plots
    \draw[curved text = {superconducting state}]    plot [domain=0:7.0,samples=100] (\plotone);
    \draw                                           plot [domain=0:7.7,samples=100] (\plottwo);
    \draw[curved text = {normal state}]             plot [domain=0:7.0,samples=100] (\plotthree);

    % shade
    \shade[top color=white!10,bottom color=blue!90,opacity=.30] 
        (7,0,0) -- plot [domain=7.0:0,samples=100] (\plotone) -- 
        (0,5,0) -- plot [domain=0:7.7,samples=100] (\plottwo) -- 
        (0,0,7) -- plot [domain=0:7.0,samples=100] (\plotthree);

    % red lines with fading opacity
    \begin{scope}
        \clip   (7,0,0) -- plot [domain=7.0:0,samples=100] (\plotone) -- 
                (0,5,0) -- plot [domain=0:7.7,samples=100] (\plottwo) -- 
                (0,0,7) -- plot [domain=0:7.0,samples=100] (\plotthree);

        \foreach \z in {1,2,...,15}
            \draw[ultra thick,red,opacity={ln(-\z+17)/ln(20)}] plot [domain=0:7,samples=100] (\plotone);
    \end{scope}

    % red balls
    \node[white, circle, shading=ball, ball color=red] at (7,0,0) {$H_c$};
    \node[white, circle, shading=ball, ball color=red] at (0,5,0) {$T_c$};
    \node[white, circle, shading=ball, ball color=red] at (0,0,7) {$I_c$};

\end{tikzpicture}
\end{document}

enter image description here

Using both the blue shading and the red lines together might be overkill, but you can easily remove one of them if wanted.

With thin green lines as suggested in the comments:

enter image description here

  • thank you for your optimization (especially parabolas). And yes, I think blue shading + red lines overkills it, but great work. thank you again – PMC1234 Jan 7 '16 at 15:14
  • It looks really gorgeous when the 3d lines are more thin (normal width) and are green. Looks legit. @Maarten Dhondt \draw[green,opacity={ln(-\z+17)/ln(20)}] . See at imgur.com/8vEjQih ! – PMC1234 Jan 7 '16 at 18:24
9

I have made a long reading on TikZ manuals and I've made this. That looks really pretty, more pretty than wanted... enter image description here

Full MWE (edited 2016/01/6) :

\documentclass{standalone}
\usepackage{amsmath,  latexsym, amscd, amsthm}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{tikz-3dplot}
   \usetikzlibrary{decorations.text}

\begin{document}

\begin{tikzpicture}[scale=9,domain=0.00001:0.75]
\def\myshift#1{\raisebox{-2.5ex}}
\draw[postaction={decorate,decoration={text along path,text align=center,text={|\sffamily\myshift|superconducting state}}}] (0,0.55) parabola (0.75,0,0);
\def\myshift#1{\raisebox{-2.5ex}}
\draw[postaction={decorate,decoration={text along path,text align=center,text={|\sffamily\myshift|normal state}}}] (0,0,0.75) parabola (0.75,0,0);
\draw (0,0.55,0) parabola (0,0,0.75);
\draw[color=gray,dashed] (0,0,0) -- (0.75,0,0);
\draw[color=gray,dashed] (0,0,0) -- (0,0.55,0);
\draw[color=gray,dashed] (0,0,0) -- (0,0,0.75);
\draw[thick,->] (0.75,0,0) -- (1,0,0) node[anchor=north east]{$H(A\ldotp m^{-1})$};
\draw[thick,->] (0,0.55,0) -- (0,0.75,0) node[anchor=north west]{$T(K)$};
\draw[thick,->] (0,0,0.75) -- (0,0,1) node[anchor=south east]{$I(A)$};
\shade[top color=white!10,bottom color=blue!90,opacity=.30] 
  (0,0,0.75) to (0.2,0,0.73) to (0.3,0,0.68) to (0.4,0,0.6) to (0.5,0,0.51) to (0.6,0,0.38) to (0.7,0,0.17) to (0.75,0) to (0.7,0.07088888888) to (0.6,0.198) to (0.5,0.30555555555) to (0.4,0.39355555555) to (0.3,0.462) to (0.2,0.51088888888) to (0.1,0.54022222222) to (0,0.55) to (0,0.59022222222,0.1) to (0,0.56088888888,0.2) to (0,0.529,0.3) to (0,0.4545555555,0.4) to (0,0.36555555555,0.5) to (0,0.25,0.6);
\shade[shading=ball, ball color=red] (0.75,0,0) circle (.045);
\shade[shading=ball, ball color=red] (0,0.55,0) circle (.045);
\shade[shading=ball, ball color=red] (0,0,0.75) circle (.045);
\draw (0.75,0,0) node [white] {$H_c$};
\draw (0,0.55,0) node [white] {$T_c$};
\draw (0,0,0.75) node [white] {$I_c$};
\end{tikzpicture}


\end{document}
  • 1
    I can't tell. Are you happy with this? Or are you looking for an uglier solution? If so, which particular aspect of its prettiness is unwanted? – cfr Jan 6 '16 at 0:01
  • I am only at high-school so yes for me this is a success and examiners don't ask for that much but I am sure that for you that's ugly... I understand. @cfr If you want to give suggestions, feel free to give them then. – PMC1234 Jan 6 '16 at 0:04
  • 1
    I did not mean that it looked ugly. But you said that it was more pretty than wanted which seemed to mean that what you wanted was something less pretty i.e. more ugly. I think it looks fine and not ugly at all and I think its looking pretty is a good thing. But it is not my question.... – cfr Jan 6 '16 at 0:33
  • Oh ok sorry My interpretation was completely wrong haha @cfr – PMC1234 Jan 6 '16 at 0:37
  • No problem ;). I'm glad to have cleared up the misunderstanding. (Obviously my first comment was not very clear.) – cfr Jan 6 '16 at 0:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.