0

I have a python script which draws a plot similar to this:

fig = plt.figure()
ax = plt.axes()

x = np.linspace(-2,2,10)
y = x**2

ax.plot(x, y, label='$x^2$', color="#07529a", linewidth=2.0) #  <--  \label this here ???

plt.legend(loc='upper left')
fig.savefig("../plot.pgf", bbox_inches='tight')
plt.show()

Now I include the figure with this lines in latex:

\begin{figure}[h!]%
    \centering
    \input{plot.pgf}
    \caption{Plot info}
    \label{fig:plot}
\end{figure}

Furthermore, I would like to describe the plotted function and add a reference to the plotted line (something like this: \ref{fig:plot:axplot} or this: Use symbols with \label and \ref in custom legend). Is it possible ? Thanks for helping me :)

Your Answer

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

Browse other questions tagged or ask your own question.