0

I've never drawn plots in Latex before and I'm really struggling at drawing some simple pictures with the tikz package. Can anybody help me? The two lines in the second and fourth quadrant should be made perpendicular to the vectors x_{.3} and x_{.1} respectively. enter image description here

  • 1
    You can use relative radial coordinates such as \draw[->] (3,3) -- ++(30: 2); – John Kormylo Apr 15 '19 at 20:46
  • 3
    Welcome to TeX.SX! The short answer is that, yes, this is possible but I have to warn you that questions of the form "Please draw this for me" that show no effort on the part of OP, often don't get answered. You will get more help if you post some code showing what you have tried and give a minimal working example. A quick search on TeX.SX for drawing functions (with tikz or pstricks) will give you an idea of where to start from. – Andrew Apr 15 '19 at 21:02
3

Perhaps this will get you started:

enter image description here

Here is the code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta}

\begin{document}

  \begin{tikzpicture}[>=Straight Barb]
    \draw[fill=black](105:1.6)--(285:0.6)-| cycle; % filled triangle
    \draw[orange](105:1.8)--(285:0.8);
    \draw[thick](0,2)node[above]{Security 2}--(0,0)--(2,0)node[right]{Security 1};
    \foreach \x [count=\xi] in {15,45,75} {
      \draw[->](0,0)--(\x:1.8);
      \node at (\x:2){$x_{\xi}$};
    }
  \end{tikzpicture}

\end{document}

Edit You can make the labels smaller by for example, ad \small to the labels. YOu can make the whole picture bigger by adding scale=3 to the tikzpicture environment -- there's alsoxscaleandyscale` if you want to scale by different factors in the x and y directions.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta}

\begin{document}

  \begin{tikzpicture}[>=Straight Barb,scale=3]
    \draw[fill=black](105:1.6)--(285:0.6)-| cycle; % filled triangle
    \draw[orange](105:1.8)--(285:0.8);
    \draw[thick](0,2)node[above]{\small Security 2}--(0,0)--(2,0)node[right]{\small Security 1};
    \foreach \x [count=\xi] in {15,45,75} {
      \draw[->](0,0)--(\x:1.8);
      \node at (\x:2){$x_{\xi}$};
    }
  \end{tikzpicture}

\end{document}
  • Thank you, Andrew. How can I make the axes labels smaller? And how can I make my picture bigger? – Nenne Apr 24 '19 at 14:48
  • @Nenne See my edit – Andrew Apr 24 '19 at 22:36
  • Thank you! How can I add a vector perpendicular to one of the vectors drawn with foreach? – Nenne Apr 25 '19 at 13:00

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.