Re: URGENTE! Problema con stampa di grafici di pgfplots

#96684
Up
0
Down
::


Eccolo! Questa è la coppia di grafici che mi crea problemi:

`

\documentclass[12pt,a4paper,titlepage]{book}

\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}
\usepackage[bf]{caption}
\usepackage{pgfplots}
\usepackage{subfig}
\usepackage{tikz}

\usepackage{graphicx}
\usepackage{emptypage}
\usetikzlibrary{angles,arrows.meta,intersections,patterns,plotmarks,quotes,shapes}
\pgfplotsset{/pgf/number format/use comma,compat=newest,legend style={font=\scriptsize}}

\begin{document}

\begin{figure}
\caption{\textbf{Potenziale efficace nella teoria newtoniana della gravitazione}}
\label{fig:potnew}
\centering
\subfloat[Fotone]{%
\begin{tikzpicture}
\begin{axis}[font=\footnotesize,xlabel={$x=\frac{r}{R_S}$}, ylabel={$V\left(x=\frac{r}{R_S}\right)$}, xmin=0, xmax=20, ymin=0, ymax=0.8, width=6.7cm, height=7cm]

\addplot[domain=0.5:20, samples=200,green]{(1/2)*(((25/4)/x^2))};
\addplot[domain=0.5:20, samples=200,orange]{(1/2)*((4/x^2))};
\addplot[domain=0.5:20, samples=200,magenta]{(1/2)*(((9/4)/x^2))};
\addplot[domain=0.1:20, samples=200,blue]{(1/2)*((1/x^2))};
\addplot[domain=0.1:20, samples=200,red]{(1/2)*(((1/4)/x^2))};
\legend{$J=\frac{5}{2}cR_S$,$J=2cR_S$,$J=\frac{3}{2}cR_S$,$J=cR_S$,$J=\frac{1}{2}cR_S$}

\end{axis}
\end{tikzpicture}}\quad
\subfloat[Particella massiva]{%
\begin{tikzpicture}
\begin{axis}[font=\footnotesize, xlabel={$x=\frac{r}{R_S}$}, xmin=0, xmax=20, ymin=0, ymax=0.8, width=6.7cm, height=7cm, legend style={anchor=south east, at={(0.98,0.02)}}]

\addplot[domain=0.5:20, samples=200, green]{(1/2)*(((25/4)/x^2)+1-(1/x))};
\addplot[domain=0.5:20, samples=200, orange]{(1/2)*((4/x^2)+1-(1/x))};
\addplot[domain=0.5:20, samples=200, magenta]{(1/2)*(((9/4)/x^2)+1-(1/x))};
\addplot[domain=0.1:20, samples=200, blue]{(1/2)*((1/x^2)+1-(1/x))};
\addplot[domain=0.1:20, samples=200, red]{(1/2)*(((1/4)/x^2)+1-(1/x))};
\legend{$J=\frac{5}{2}cR_S$,$J=2cR_S$,$J=\frac{3}{2}cR_S$,$J=cR_S$,$J=\frac{1}{2}cR_s$}

\end{axis}
\end{tikzpicture}}
\end{figure}

\end{document}

`

Questa è la coppia che non me ne crea:

`

\documentclass[12pt,a4paper,titlepage]{book}

\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}
\usepackage[bf]{caption}
\usepackage{pgfplots}
\usepackage{subfig}
\usepackage{tikz}

\usepackage{graphicx}
\usepackage{emptypage}
\usetikzlibrary{angles,arrows.meta,intersections,patterns,plotmarks,quotes,shapes}
\pgfplotsset{/pgf/number format/use comma,compat=newest,legend style={font=\scriptsize}}

\begin{document}

\begin{figure}
\caption{\textbf{Potenziale efficace in relatività generale}}
\label{fig:potrel}
\centering
\subfloat[Fotone]{%
\begin{tikzpicture}
\begin{axis}[font=\footnotesize,xlabel={$x=\frac{r}{R_S}$}, ylabel={$V\left(x=\frac{r}{R_S}\right)$}, xmin=0, xmax=20, ymin=0, ymax=0.8,width=6.7cm,height=7cm]

\addplot[domain=1:20,samples=200,green]{(1/2)*(((25/4)/x^2))*(1-(1/x))};
\addplot[domain=1:20,samples=200,orange]{(1/2)*((4/x^2))*(1-(1/x))};
\addplot[domain=1:20,samples=200,magenta]{(1/2)*(((9/4)/x^2))*(1-(1/x))};
\addplot[domain=1:20,samples=200,blue]{(1/2)*((1/x^2))*(1-(1/x))};
\addplot[domain=1:20,samples=200,red]{(1/2)*(((1/4)/x^2))*(1-(1/x))};
\legend{$J=\frac{5}{2}cR_S$,$J=2cR_S$,$J=\frac{3}{2}cR_S$,$J=cR_S$,$J=\frac{1}{2}cR_S$}

\end{axis}
\end{tikzpicture}}\quad
\subfloat[Particella massiva]{%
\begin{tikzpicture}
\begin{axis}[font=\footnotesize,xlabel={$x=\frac{r}{R_S}$}, xmin=0, xmax=20, ymin=0, ymax=0.8,width=6.7cm,height=7cm, legend style={anchor=south east, at= {(0.98,0.02)}}]

\addplot[domain=1:20,samples=200,green]{(1/2)*(((25/4)/x^2)+1)*(1-(1/x))};
\addplot[domain=1:20,samples=200,orange]{(1/2)*((4/x^2)+1)*(1-(1/x))};
\addplot[domain=1:20,samples=200,magenta]{(1/2)*(((9/4)/x^2)+1)*(1-(1/x))};
\addplot[domain=1:20,samples=200,blue]{(1/2)*((1/x^2)+1)*(1-(1/x))};
\addplot[domain=1:20,samples=200,red]{(1/2)*(((1/4)/x^2)+1)*(1-(1/x))};
\legend{$J=\frac{5}{2}cR_S$,$J=2cR_S$,$J=\frac{3}{2}cR_S$,$J=cR_S$,$J=\frac{1}{2}cR_S$}

\end{axis}
\end{tikzpicture}}

\end{figure}

\end{document}

`

Go to top