I am trying to reproduce the picture below using TikZ.

enter image description here

A similar question was already asked here, but I wasn't able to apply the answers to my problem since I need the exact same picture not only the shapes. I tried to modify the given answers but that didn't lead to anything useful because I don't really understand pgfplots and I'm relatively new to TikZ ...

That is what I have done so far.

   \foreach \x in {0,4.5,9,13.5}{
      \draw [->] (-1.2-\x,0)--(2.5-\x,0);
      \draw [->] (0-\x,-1.2)--(0-\x,1.7);
      \draw[shorten <=-1cm, shorten >=-3mm] (0-\x,1)--(2-\x,0) node [midway, above] {$A$};

   \draw[blue] (-10,0)--(-9,1)--(-8,0)--(-9,-1)--cycle;
   \draw [blue](-4.5,0) circle (0.88cm);

   \foreach \x in {0.66}{
      \draw[blue] (-\x,-\x)--(-\x,\x)--(\x,\x)--(\x,-\x)--cycle;



The picture below shows the result. The code is horrific but it is the best I can come up with for now ...

p-Norm for p=2/3,1,2,infty

  • could you please post what have you done so far?
    – naphaneal
    Jul 18 '16 at 13:38
  • @naphaneal yes, but how do i display code in the comment environment? or should i use the "Answer Your Question" button? Jul 18 '16 at 14:52
  • click on edit in your question, paste your code, mark it, then click on the {} symbol. your code will be displayed on a grey background.
    – naphaneal
    Jul 18 '16 at 15:41
  • Are the shapes supposed to be cosmetic? As in, no actual mathematical precision?
    – Alenanno
    Jul 18 '16 at 19:18
  • Please always post compilable code, rather than just a fragment as it makes it much easier to reproduce what you are seeing.
    – cfr
    Jul 18 '16 at 21:37

Possibly something like this? It may not be maximally efficient as I started from the code in the question and something which plots each one might provide greater elegance.

   \foreach \i in {0,...,3}{
      \draw [<->] (-1.2,0)--(2.5,0);
      \draw [<->] (0,-1.2)--(0,1.7);
      \draw[shorten <=-1cm, shorten >=-3mm] (0,1)--(2,0) node [midway, above] {$A$};
   \begin{scope}[draw=blue, densely dashed]
     \draw [] (-1,0)--(0,1)--(1,0)--(0,-1)--cycle;
     \draw [](4.5,0) circle (0.88cm);
     \draw [xshift=9cm] (-.66,-.66) rectangle (.66,.66);
       \draw [domain=0:90,samples=100,smooth,variable=\t] plot({-1*cos(\t)^(3)},{1*sin(\t)^(3)});
       \draw [domain=0:90,samples=100,smooth,variable=\t] plot({-1*cos(\t)^(3)},{-1*sin(\t)^(3)});
       \draw [domain=0:90,samples=100,smooth,variable=\t] plot({1*cos(\t)^(3)},{-1*sin(\t)^(3)});
       \draw [domain=0:90,samples=100,smooth,variable=\t] plot({1*cos(\t)^(3)},{1*sin(\t)^(3)});
     \foreach \i [count=\j from 0] in {(0,1),(.39,.79),(.66,.66),(0,1)} \scoped [xshift=\j*4.5cm] { \draw [{Circle[width=3pt, length=3pt, fill=black, black]}-{Circle[width=3pt, length=3pt, fill=black, black]}, shorten <=-1.5pt, shorten >=-1.5pt] (0,0) node [below left] {$x$} -- \i node [above right] {$\hat x$} ; };
   \foreach \i [count=\j from 0] in {1,2,\infty,\frac{1}{2}} \scoped [xshift=\j*4.5cm] { \node [anchor=mid west] at (0,-1.5) {$p=\i$}; };

variations on a unitary theme


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.