# Constructing a Seismic Tripartite Graph with TikZ & pgfplots

I am attempting to use TiKZ and pgfplots to construct a seismic tripartite graph. These are used by structural engineers to determine seismic response for a structure. The example I am attempting to replicate is pasted below. This is related to my post is Engineering.SE, for those interested.

My working example is pasted below.

\documentclass[letter,landscape]{article}
\usepackage[bindingoffset=0.2in,%
left=0.5in,right=0.5in,top=0.5in,bottom=0.5in,%
footskip=.25in]{geometry}
\usepackage{pgfplots}
\pgfplotsset{compat=1.5}

\begin{document}

\begin{tikzpicture}

% Primary Axes
\begin{loglogaxis}[
%
width=9in, height=7in,
title=Tripartite Paper,
% Frequency Axis
xlabel={Frequency (Hz)},
xmin=0.1, xmax=1000,
domain=1:1000,
log ticks with fixed point,
x tick label style={/pgf/number format/1000 sep=\,},
% Pseudovelocity Axis
ylabel={Pseudo Response Velocity (in/sec)},
ymin=0.01, ymax=10,
domain=1:100,
log ticks with fixed point,
y tick label style={/pgf/number format/1000 sep=\,},
grid=minor
]

\end{loglogaxis}

% Secondary Axes
\begin{loglogaxis}[
% Pseudoacceleration Axis
xlabel={Acceleration (g)},
xlabel style={rotate=45,anchor=north},
xmin=0.0001, xmax=100,
domain=0.0001:100,
rotate=45,
log ticks with fixed point,
x tick label style={rotate=-45, anchor=west, /pgf/number format/1000 sep=\,},
% Displacment Axis
ylabel={Displacement (in)},
ylabel style={rotate=-135,anchor=south},
ymin=0.000001, ymax=10,
domain=0.000001:10,
log ticks with fixed point,
y tick label style={rotate=45, anchor=east, /pgf/number format/1000 sep=\,},
grid=minor
]

\end{loglogaxis}

\end{tikzpicture}

\end{document}


This generates the following graph, which has some obvious issues.

The things that I can't figure out how to fix are:

1. Remove the border from the secondary axes
2. Have the secondary axes extend beyond the extents of the primary axes (ideally ad infinitum with an anchor point at a specific place)
3. Keep all the major axis gridlines square and the same size
4. Put the secondary axis labels above the major gridlines (see example)
5. Move the secondary axis tick labels in the middle of the graph
• can you explain how are built the tilting axes and scale of these axes – rpapa May 10 '16 at 20:32
• @rpapa, not quite sure what you mean. The secondary axes are at a 45-deg skew to the primary axes, as in the first image. Ideally, I'd like to anchor the secondary axes coordinate (0.01,0.001) to the primary axes coordinate (10,0.1). For scale, the secondary axes are scaled such that the spacing of the primary axes between 10^n times cos(45deg) equals the spacing of the secondary axes between 10^n. If that makes sense...it's hard to put in writing. – grfrazee May 10 '16 at 20:42
• In other words, the diagonal of the square made by the major gridlines of the secondary axes is the same length as the distance between major gridlines on the primary axes. – grfrazee May 10 '16 at 21:24
• Your best bet is just to draw all the diagonals and label them with node[mid]. – John Kormylo May 11 '16 at 2:57

here is my proposal, I am not satisfied but it should allow others to complete.

I do not know what to write about tilting axes

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{calc,intersections}

\begin{document}

\begin{tikzpicture}[scale=2.5,transform shape]

\begin{scope}

\def\minx{-1}
\def\maxx{3}
\def\miny{-2}
\def\maxy{2}
\foreach \yy in {\minx,...,\maxx}{
\foreach \xx in{1,2,4,6,8}{
\draw[red, name path global/.expanded = X\xx10\yy] ({log10(\xx*10^(\yy)}, {log10(10^(\miny)})node[below=0.5em,scale=1/4,rotate=90]{X\xx10\yy:$\xx \cdot 10^{\yy}$}coordinate(X\xx-\yy) -- ({log10(\xx*10^(\yy)},{log10(10^(\maxy+1)});
}
}
\foreach \yy in {\miny,...,\maxy}{
\foreach \xx in{1,2,4,6,8}{
\draw[blue,name path global/.expanded=Y\xx10\yy] ({log10(10^(\minx)}, {log10(\xx*10^(\yy)})node[left,scale=1/4]{$Y\xx10\yy$:$\xx \cdot 10^{\yy}$}coordinate(Y\xx-\yy) -- (\nbdecade,{log10(\xx*10^(\yy)});
}
}

\clip (\minx,\miny) rectangle ({\maxx+1},{\maxy+1});
\foreach \yy in {\miny,...,\maxy}{
\foreach \xx in{1,2,4,6,8}{
\path[name intersections={of=X1101 and Y\xx10\yy, by= P}];
%\path[name intersections={of=X1101 and Y110-1, by= P}];
\draw [thin,green] (P) --+ (45:4)--+(-135:4)node[sloped,pos=0.4,black,scale=1/5]{$\xx10^{\yy}$};
\draw [thin,purple] (P) --+ (-45:4)--+(135:4)node[sloped,pos=0.6,black,scale=1/5]{$\xx10^{\yy}$};
}
}

\end{scope}
\end{tikzpicture}
\end{document}