21/03/2020, 19:27
\begin{tikzpicture}
\begin{axis}[height=5cm,
domain=-10:10,
restrict y to domain=-10:10,
axis x line=middle,
axis y line=middle,
xlabel=$ x $,
ylabel=$ y $,
enlargelimits,
xtick={0},
ytick={0}]
\addplot[samples=400]{x^2};
\addplot[samples=400]{x^4};
\addplot[samples=400]{x^6};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[height=5cm,
domain=-10:10,
restrict y to domain=-10:10,
axis x line=middle,
axis y line=middle,
xlabel=$ x $,
ylabel=$ y $,
enlargelimits,
xtick={0},
ytick={0}]
\addplot[samples=400]{x^1};
\addplot[samples=400]{x^3};
\addplot[samples=400]{x^5};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[height=5cm,
domain=10:10,
restrict y to domain=-10:10,
axis x line=middle,
axis y line=middle,
xlabel=$ x $,
ylabel=$ y $,
enlargelimits,
xtick={0},
ytick={0}]
\addplot[domain=-10:-0.015,samples=400]{1/(x^2)};
\addplot[domain=0.015:10,samples=400]{1/(x^2)};
\addplot[domain=-10:-0.015,samples=400]{1/(x^4)};
\addplot[domain=0.015:10,samples=400]{1/(x^4)};
\addplot[domain=-10:-0.015,samples=400]{1/(x^6)};
\addplot[domain=0.015:10,samples=400]{1/(x^6)};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[height=5cm,
domain=-10:10,
restrict y to domain=-10:10,
axis x line=middle,
axis y line=middle,
xlabel=$ x $,
enlargelimits,
ylabel=$ y $,
xtick={0},
ytick={0}]
\addplot[domain=-10:-0.015,samples=400]{1/(x^1)};
\addplot[domain=0.015:10,samples=400]{1/(x^1)};
\addplot[domain=-10:-0.015,samples=400]{1/(x^3)};
\addplot[domain=0.015:10,samples=400]{1/(x^3)};
\addplot[domain=-10:-0.015,samples=400]{1/(x^5)};
\addplot[domain=0.015:10,samples=400]{1/(x^5)};
\end{axis}
\end{tikzpicture}
restrict y to domain=-10:10
sennò succede chissà che errore di overlfow nonostante io abbia già specificato il range in cui disegnare (e quindi calcolare i punti); anche solo per plottare una cosa come \( x\mapsto x^{-2} \) bisogna scrivere un papiro; ecc.21/03/2020, 20:38
21/03/2020, 21:33
22/03/2020, 10:37
marco2132k ha scritto:Questo non dovrebbe influire sull'omogeneità delle "cose tipografiche" (almeno non tanto quanto succederebbe se usassi python + matplotlib, o altre amenità).
22/03/2020, 17:13
\begin{tikzpicture}
\begin{axis}[
xmin = -10, xmax = 10,
ymin = -1, ymax = 10,
axis lines = left,
axis x line = center,
axis y line = center,
xtick = \empty,
ytick = \empty
]
\addplot[
domain = -4:4,
samples = 100,
line width = 0.5pt,
color = blue
]
{x^2};
\addplot[
domain = -3:3,
samples = 100,
line width = 0.5pt,
color=red
]
{x^4};
\addplot[
domain = -2:2,
samples=100,
line width=0.5pt,
color=black
]
{x^6};
\end{axis}
\end{tikzpicture}
23/03/2020, 17:38
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\usepgfplotslibrary{colorbrewer}
% Set compatibility
\pgfplotsset{compat=1.16}
% Set color index
\pgfplotsset{
cycle list/Set1-9,
cycle multiindex* list = {
% mark list*\nextlist
% linestyles*\nextlist
Set1-9\nextlist
},
}
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[
group style = {
group size = 2 by 2,
vertical sep = 2.5cm,
},
height = 5cm,
domain = -3:3,
samples = 400,
restrict y to domain = -3:3,
axis x line = middle,
axis y line = middle,
xlabel = $x$,
ylabel = $y$,
enlargelimits = true,
xtick = \empty,
ytick = \empty,
legend columns = 2,
legend style = {
at = {(0.5, -0.1)},
anchor = north,
},
]
\nextgroupplot[
title = {$x^n : n$ even},
]
\pgfplotsinvokeforeach{2,4,6,8}{
\addplot+{x^#1};
\addlegendentry{$n = #1$};
}
\nextgroupplot[
title = {$x^n : n$ odd},
]
\pgfplotsinvokeforeach{1,3,5,7}{
\addplot+{x^#1};
\addlegendentry{$n = #1$};
}
\nextgroupplot[
title = {$x^\frac{1}{n} : n$ even},
]
\pgfplotsinvokeforeach{2,4,6,8}{
\addplot+{1/x^#1};
}
\nextgroupplot[
title = {$x^\frac{1}{n} : n$ odd},
]
\pgfplotsinvokeforeach{1,3,5,7}{
\addplot+{1/x^#1};
}
\end{groupplot}
\end{tikzpicture}
\end{document}
devo aggiungere restrict y to domain=-10:10 sennò succede chissà che errore di overlfow nonostante io abbia già specificato il range in cui disegnare (e quindi calcolare i punti);
23/03/2020, 22:24
Ecco, questo lo ignoravo.claudio86 ha scritto:In realtà no. PGFPlots prima disegna il grafico su tutti i punti del dominio, poi lo ritaglia per farlo stare dentro xmin, xmax, ymin e ymax1.
24/03/2020, 08:27
24/03/2020, 12:05
26/03/2020, 16:35
Skuola.net News è una testata giornalistica iscritta al Registro degli Operatori della Comunicazione.
Registrazione: n° 20792 del 23/12/2010.
©2000—
Skuola Network s.r.l. Tutti i diritti riservati. — P.I. 10404470014.
Powered by phpBB © phpBB Group - Privacy policy - Cookie privacy
phpBB Mobile / SEO by Artodia.