Graphics, Figures & Tables ⇒ pgfplots | Several y-Axis
-
- Posts: 1
- Joined: Sun Apr 03, 2011 2:15 pm
pgfplots | Several y-Axis
I would like to plot several y axis in the same pic, like 1 `x` axis and
3 or 4 y axis on the right (not only 2 in both y sides - right and left),
but I do not know how.
Anyone already done this type of plot?
Thanks,
Marcel.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
pgfplots | Several y-Axis
Not until you requested that. An idea with an example from the pgfplots manual should clarify the principal.marcelvduarte wrote:[…] Anyone already done this type of plot? […]
Code: Select all
\documentclass{standalone}
\usepackage{pgfplots}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
area legend,
axis x line*=bottom,
axis y line*=left,
domain=0:1,
legend style={at={(0.03,0.97)},anchor=north west},
legend cell align=left,
axis on top,
xmin=0,xmax=1,
xlabel={x-axes label},
ylabel={y-axes label},
xlabel near ticks,
ylabel near ticks
]
\addplot[pattern=crosshatch dots,pattern color=blue,draw=blue,samples=500]{sqrt(x)} \closedcycle;
\addplot[pattern=crosshatch,pattern color=blue!30!white,draw=blue!30!white]{x^2} \closedcycle;
\addplot[red,line legend] coordinates {(0,0) (1,1)};
\legend{$\sqrt x$,$x^2$,$x$}
\end{axis}
\begin{axis}[%
xmin=0,xmax=1,ymin=0,ymax=10,
ytick={0,5,10},
axis x line=none,
axis y line*=right,
xlabel near ticks,
ylabel near ticks,
ylabel={2nd y-axes label}
]
\end{axis}
\begin{axis}[%
at={(2cm,0)},
xmin=0,xmax=1,ymin=0,ymax=100,
ytick={0,10,...,100},
axis x line=none,
axis y line*=right,
xlabel near ticks,
ylabel near ticks,
ylabel={3rd y-axes label}
]
\end{axis}
\end{tikzpicture}
\end{document}
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10