3

I only create this:

enter image description here

With this:

\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[ 
  axis x line=bottom,
  axis y line=left,
  ultra thick,
  y coord trafo/.code={\pgfmathparse{sqrt(#1)}},
  y coord inv trafo/.code={\pgfmathparse{pow(#1,2)}}
  ] 
    \addplot coordinates {
    (0,0)
    (0.3,0)
    (0.44,0.00016)
    (0.45,0.00045)
    (0.49,0.00071)
    (0.5,0.001)
    (0.51,0.00139)
    (0.54,0.00176)
    (0.56,0.00214)
    (0.57,0.00243)
    (0.61,0.00279)
    (0.63,0.00327)
    (0.64,0.00386)
    (0.67,0.00433)
        };
        \end{axis}
        \end{tikzpicture}
        \end{document}

But I need put negative coordinates, for example: (-0.51,-0.00139)

also I need the red line and words (I,V):

enter image description here

3
  • By setting axis lines=middle, both the axis will be placed in the middle, once you add negative coordinates.
  • You can add labels using xlabel=$V$ and ylabel=$I$.
  • Those labels can be placed at a different position with respect to the axis using x label style={at={(current axis.right of origin)}, anchor=west}.
  • Drawing the red line can be done using \draw[red, dashed] (axis cs:0.6, 0)--(axis cs:0.6, 0.004);. Here I use axis cs coordinates, which are coordinates linked to your axis.
  • Your last request is not possible. You can not add negative values on the y-axis, since you rescale the axis using a square root. The square root of a negative number is a complex number.

An example where I removed the y coord travo stuff and added some negative coordinates.

MWE

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\begin{document}
    \begin{tikzpicture}
      \begin{axis}[ 
          axis lines=middle,
          ultra thick,
          xlabel= $V$, ylabel=$I$,
          x label style={at={(current axis.right of origin)}, anchor=west},
%         y coord trafo/.code={\pgfmathparse{sqrt(#1)}},
%         y coord inv trafo/.code={\pgfmathparse{pow(#1,2)}},
          ] 
            \addplot coordinates {
            (-0.48, -0.002)
            (-0.43, -0.0002)
            (-0.3, -0.0001)
            (0,0)
            (0.3,0)
            (0.44,0.00016)
            (0.45,0.00045)
            (0.49,0.00071)
            (0.5,0.001)
            (0.51,0.00139)
            (0.54,0.00176)
            (0.56,0.00214)
            (0.57,0.00243)
            (0.61,0.00279)
            (0.63,0.00327)
            (0.64,0.00386)
            (0.67,0.00433)
             };
         \draw[red, dashed] (axis cs:0.6, 0)--(axis cs:0.6, 0.004);
        \end{axis}
    \end{tikzpicture}
\end{document}

Result

enter image description here

  • Its perfect!!! Thank you very much for your help – Solid Oct 4 '16 at 21:53

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.