10
$\begingroup$

Say I have a dataset named "d"

d = {{0.02`, 0.0012590355605140609`}, {0.07`, 
0.03190107785291465`}, {0.12000000000000001`, 
0.1341664962650996`}, {0.17`, 0.36075980746436004`}, {0.22`, 
0.357927357108827`}, {0.27`, 0.7918189679330538`}, {0.32000000000000006`, 
0.9908662217648183`}, {0.37000000000000005`, 
1.326284520883634`}, {0.42000000000000004`, 
1.6667182988224543`}, {0.47000000000000003`, 2.786860204849679`}, {0.52`, 
2.93933750379339`}, {0.5700000000000001`, 
3.9366944327584346`}, {0.6200000000000001`, 3.134060239061052`}, {0.67`, 
3.4525830444631516`}, {0.7200000000000001`, 3.146161177105212`}, {0.77`, 
3.020376751028269`}, {0.8200000000000001`, 
4.675746764366013`}, {0.8700000000000001`, 6.218831558416226`}, {0.92`, 
5.912788886349729`}, {0.9700000000000001`, 6.083549243252543`}, {1.02`, 
5.698685465342156`}, {1.07`, 5.335045431412702`}, {1.12`, 
4.588645123940877`}, {1.1700000000000002`,
  4.836149753666741`}, {1.2200000000000002`, 4.731911635811709`}, {1.27`, 
4.3204281272371095`}, {1.32`, 3.8191496326978123`}, {1.37`, 
4.425577764542655`}, {1.4200000000000002`, 
4.202433760690466`}, {1.4700000000000002`, 4.345090612510468`}, {1.52`, 
4.943409063693237`}, {1.57`, 5.5220625859488255`}, {1.62`, 
6.159173390833452`}, {1.6700000000000002`, 
6.429250552258077`}, {1.7200000000000002`, 6.3412110427206345`}, {1.77`, 
6.444125949011322`}, {1.82`, 6.941306477251247`}, {1.87`, 
7.269850600160908`}, {1.9200000000000002`, 
7.4459650057643145`}, {1.9700000000000002`, 7.381768092485144`}, {2.02`, 
7.638145357784952`}, {2.0700000000000003`, 8.126256325553179`}, {2.12`, 
8.057667374122504`}, {2.17`, 8.860957231660683`}, {2.22`, 
9.731314285903778`}, {2.27`, 10.521063318290198`}, {2.3200000000000003`, 
11.202904736346488`}, {2.37`, 11.746558133012728`}, {2.4200000000000004`, 
12.1887799898985`}, {2.47`, 12.524874206169914`}, {2.52`, 
12.947505240273822`}, {2.5700000000000003`, 13.340677305210736`}, {2.62`, 
13.590186938026871`}, {2.6700000000000004`, 14.14787161554347`}, {2.72`, 
15.664058697389326`}, {2.77`, 16.665468696630878`}, {2.8200000000000003`, 
17.000850998774546`}, {2.87`, 16.647131946787326`}, {2.9200000000000004`, 
16.3859238348108`}, {2.97`, 15.982010112784831`}};

and I generate two datasets from "d":

v = {#[[1]], #[[2]]*2*\[Pi]/#[[1]]} & /@ d;
a = {#[[1]], #[[2]]*(2*\[Pi]/#[[1]])^2} & /@ d;

I can plot "d", "v" and "a" individually as follows:

ListLinePlot[#] & /@ {d, v, a}

However I want to combine these three datasets into a 4-way logarithmic plot. The x-axis of the 4-way plot corresponds to the first column of the datasets i.e. period. The y-axis corresponds to the second column of the "v" dataset, the +45-degree axis corresponds to the second column of "d" dataset, and the +135-degree axis corresponds to the second column of the "a" dataset. This type of plot is used to present the response spectrum in earthquake engineering. Can anyone help with this type of plot? An example is shown.

enter image description here

$\endgroup$
11
$\begingroup$

Epilog and FullGraphics with RotationTransform do the main part of the visualization

shift = {1, -1} Log[2 π]/Sqrt[2];
scale = {1, 1}/Sqrt[2];
ao = {0.5, 50};
ListLogLogPlot[{0}, Axes -> False, 
 PlotRange -> {{0.01, 10}, {0.1, 100}}, Frame -> True, 
 GridLines -> Automatic, 
 FrameLabel -> {Style["x axis", 16], Style["v axis", 16]}, 
 AspectRatio -> Automatic, ImageSize -> 500,
 Epilog -> {
   GeometricTransformation[#, RotationTransform[π/4]] &@
         GeometricTransformation[#, TranslationTransform[shift]] &@
       GeometricTransformation[#, ScalingTransform[scale]] &@
     Join[
      List @@ FullGraphics@
        ListLogLogPlot[{0}, Axes -> True, AxesOrigin -> ao, 
         PlotRange -> {{0.0002, 200}, {0.1, 100000}}, 
         GridLines -> Automatic], {Text[Style["d axis", 16], 
        Log@ao + {0.7, -0.2} Log[10]], 
       Rotate[Text[Style["a axis", 16], 
         Log@ao + {-0.2, 0.7} Log[10]], -π/2]}] /. 
    Text[s__] :> Text[s, Background -> GrayLevel[1, 0.8]],
   AbsolutePointSize[6],
   ColorData[1][1], Point@Log@v
   }]

enter image description here

Some details:

  • shift shifts the position of (1,1) point of the 45-degree plot.
  • ao sets the axis origin of the 45-degree plot.
  • Logs converts the logarithmic values to the linear Graphics coordinates.
  • ColorData[1] sets colors to usual colors of Plot.
  • /. Text[s__] :> Text[s, Background -> GrayLevel[1, 0.8]] set background of all text labels of the 45-degree plot to white with small transparency.
  • Unfortunately it doesn't work in V10 due to bugs (in Linux at lest). I used V9 to plot it.
$\endgroup$
  • $\begingroup$ Thank you very much for the answer to a difficult plot problem. My apology for not being clear in my question. Because the three parameters are related through a = (2*pi/T)*v = (4*pi^2/T^2)*d, the 3 datasets can actually be plotted as just one line in the 4-way logarithmic plot. This may involve re-scaling the y, +45-degree and +135-degree axes to condense them into one line. I wonder plotting them as one line can be done. $\endgroup$ – user11946 Nov 29 '14 at 1:49
  • $\begingroup$ @user11946 I adjusted the scale and the shift. It is a really nice property of this plot! $\endgroup$ – ybeltukov Nov 29 '14 at 20:15
  • $\begingroup$ Wow - it runs perfect in MMA 9.0. This is exactly what I am looking for. I hope the plot issue gets resolved in the version 10 updates. $\endgroup$ – user11946 Nov 29 '14 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.