0
$\begingroup$

I have (x,y,z) set of data and I want to combine 3D figure with LogLogPlot and to produce 2D figure

data = {{5.999996331469935`, 0.5500005474260047`, 2.549565417296867`*^-6}, {5.999991969344593`, 0.5500011983651819`, 2.848318110201032`*^-6}, {5.999986835624129`, 0.5500019644590124`, 3.201464984098217`*^-6}, {5.999980785205914`, 0.5500028673638228`,  3.617646710577001`*^-6}, {5.999973648902611`, 0.5500039323308369`, 4.108652222464897`*^-6}, {5.999965224629254`, 0.5500051895216201`, 4.688439179456477`*^-6}, {5.999955271226099`, 0.5500066749302207`, 5.373677492244699`*^-6}, {5.999943500721313`, 0.550008431538252`,  6.184276903603515`*^-6}, {5.999929569067917`, 0.5500105106978175`,  7.144029569135982`*^-6}, {5.999913065019908`, 0.550012973792352`, 8.281381033889173`*^-6}};

p1 = ListPointPlot3D[data, ColorFunction -> "Rainbow", PlotStyle -> PointSize[Large], PlotLegends -> Automatic]

A = 1 - 1.47/x^0.999;
p2 = LogLogPlot[A, {x, .1, 50}]

Is there way to do this? I need the final result like this figure

$\endgroup$
  • $\begingroup$ Since your goal is to get a true 2D plot in the end, you'll have to project the points onto a plane somehow - why not simply do that before plotting them? Then ListPointPlot and Show are all you need $\endgroup$ – Lukas Lang Jun 27 '18 at 22:33
  • $\begingroup$ @LukasLang Thanks for your comment, but what about the colored bar which give the information about "Z"? $\endgroup$ – Shaaban Jun 27 '18 at 22:39
  • $\begingroup$ Good point - you could emulate ListPlot using Graphics with something like Graphics@With[{max=Max@data[[All,3]]},{ColorData["Rainbow"][#3/max],Point[{#,#2}]}&@@@data}]. And you can manually build the legend using BarLegend and Legended $\endgroup$ – Lukas Lang Jun 27 '18 at 22:49
1
$\begingroup$

An easier way than what I've suggested in the comments is the following:

p1 = ListPointPlot3D[
  data,
  ColorFunction -> "Rainbow",
  PlotStyle -> PointSize[Large],
  PlotLegends -> Automatic,
  ScalingFunctions -> {"Log", "Log", "Linear"}
];

A = 1 - 1.47/x^0.999;
p2 = LogLogPlot[A, {x, .1, 50}];

Show[p2, p1 /. g_Graphics3D :> Graphics[First@g /. Point@{x_, y_, z_} :> Point@{x, y}]]

Mathematica graphics

(Note the ScalingFunctions option for p1)

The idea is to replace the Graphics3D expression with a Graphics one, where we project all the points onto the plane. But I guess you need to adjust this projection a bit, as the points overlap currently.

$\endgroup$
  • $\begingroup$ I've an error with ScalingFunctions, it was in red. $\endgroup$ – Shaaban Jun 27 '18 at 23:06
  • 1
    $\begingroup$ @Shaaban what version of Mathematica do you have? $\endgroup$ – MarcoB Jun 28 '18 at 2:24
  • $\begingroup$ I solved this problem using Show[p2, p1 /. g_Graphics3D :> Graphics[First@g /. Point@{x_, y_, z_} :> Point@{Log10[x], Log10[y]}]] and delete ScalingFunctions -> {"Log", "Log", "Linear"} Many thanks $\endgroup$ – Shaaban Jun 28 '18 at 21:46

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.