Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \documentclass{standalone}
- \usepackage{pgfplots}
- \newcommand{\getpgfkey}[1]{\pgfkeysvalueof{/pgfplots/#1}}
- \newcommand{\xmin}[0]{\getpgfkey{xmin}}
- \newcommand{\xmax}[0]{\getpgfkey{xmax}}
- \newcommand{\ymin}[0]{\getpgfkey{ymin}}
- \newcommand{\ymax}[0]{\getpgfkey{ymax}}
- \pgfmathsetmacro{\yminscaledDOWN}{\pgfkeysvalueof{/pgfplots/ymin}}
- \usepgfplotslibrary{groupplots}
- \pgfplotsset{
- xscalingdown/.style={
- x coord trafo/.code=\pgfmathparse{##1/(1e#1)},
- every axis/.append code={%
- \edef\pgfmathresult{\xmax/(1e#1)}\global\let\xmaxSCALED=\pgfmathresult
- \edef\pgfmathresult{\xmin/(1e#1)}\global\let\xminSCALED=\pgfmathresult
- },
- xlabel style={
- append after command={
- node [rotate=90, anchor=base west] at (\tikzlastnode.base east) {$\cdot{10^{#1}}$}
- }
- }
- },
- xscalingup/.style={
- x coord trafo/.code=\pgfmathparse{##1*(1e#1)},
- every axis/.append code={%
- \edef\pgfmathresult{\xmax*(1e#1)}\global\let\xmaxSCALED=\pgfmathresult
- \edef\pgfmathresult{\xmin*(1e#1)}\global\let\xminSCALED=\pgfmathresult
- },
- xlabel style={
- append after command={
- node [rotate=90, anchor=base west] at (\tikzlastnode.base east) {$\cdot{10^{{-1}#1}}$}
- }
- }
- },
- yscalingdown/.style={
- y coord trafo/.code=\pgfmathparse{##1/(1e#1)},
- every axis/.append code={%
- \pgfmathparse{\ymax/(1e#1)}\global\let\ymaxSCALED=\pgfmathresult
- \pgfmathparse{\ymin/(1e#1)}\global\let\yminSCALED=\pgfmathresult
- },
- ylabel style={
- append after command={
- node [rotate=90, anchor=base west] at (\tikzlastnode.base east) {$\cdot{10^{#1}}$}
- }
- }
- },
- yscalingup/.style={
- y coord trafo/.code=\pgfmathparse{##1*(1e#1)},
- every axis/.append code={%
- \pgfmathparse{\ymax*(1e#1)}\global\let\ymaxSCALED=\pgfmathresult
- \pgfmathparse{\ymin*(1e#1)}\global\let\yminSCALED=\pgfmathresult
- },
- ylabel style={
- append after command={
- node [rotate=90, anchor=base west] at (\tikzlastnode.base east) {$\cdot{10^{{-1}#1}}$}
- }
- }
- },
- }
- \begin{document}
- \begin{tikzpicture}
- \begin{groupplot}[
- group style={
- horizontal sep=0.2cm,
- group size=2 by 1,
- ylabels at=edge left,
- yticklabels at=edge left,
- },
- ymin=-100, ymax=1300,
- xlabel={The label for the x-axis},
- ylabel={Some y-values},
- xscalingdown=3,
- yscalingdown=3,
- ]
- \nextgroupplot
- \addplot[only marks] coordinates{(2000,1200) (3000,500)};
- \draw[ultra thick, dashed, blue] (axis cs:\xminSCALED,\yminSCALED) rectangle (axis cs:\xmaxSCALED,\ymaxSCALED);
- \nextgroupplot
- \addplot[only marks] coordinates{(2100,1000) (2800,1200)};
- \draw[ultra thick, dashed, blue] (axis cs:\xminSCALED,\yminSCALED) rectangle (axis cs:\xmaxSCALED,\ymaxSCALED);
- \end{groupplot}
- \end{tikzpicture}
- \end{document}
Advertisement
Add Comment
Please, Sign In to add comment