2
$\begingroup$

I have two data tables with identical parts along the vertical axis. For example:

Tab1 = Table[i*10, {i, 0, 20}];

Tab2 = Table[i, {i, 0, 20}];

Tab3 = Table[i*0.1, {i, 0, 20}];

Now I want to combine both graphics on one:

plot1 = ListPlot[Transpose[{Tab1, Tab3}], 
Frame -> {True, True, False, False},
FrameLabel -> {"Parameter 1", "Y axis", None, None},
ImagePadding -> 50, FrameTicks -> {{All, None}, {All, None}}];

plot2 = ListPlot[Transpose[{Tab2, Tab3}], 
Frame -> {False, False, True, True},
FrameLabel -> {None, None, "Parameter 2", "Y axis"},
ImagePadding -> 50, FrameTicks -> {{None, All}, {None, All}}];

Overlay[{plot1, plot2}]

And the result is: enter image description here

Now I want to use ListDensityPlot to show how Yaxis depends from Parameter 1 and 2. In order to do this, I need the abscissa axis to be parameter 1, and on the ordinate axis there was parameter 2.

UPD: I found a way to do it:

tab1 = Table[i*10, {i, 0, 20}];(*Parameter 1*)

tab2 = Table[i, {i, 0, 20}];(*Parameter 2*)

tab3 = Table[i*0.1, {i, 0, 20}];

tab4 = Transpose[{tab1, tab2, tab3}];

ListDensityPlot[tab4, 
ColorFunction -> "Rainbow", PlotLegends -> Automatic,
Frame -> True,
FrameLabel -> {"Parameter 1", "Parameter 2"}, 
LabelStyle -> Directive[Black, 14], ImageSize -> Large]

As result I have a white graph enter image description here I find solution of this problem use:

DataRange -> All

And the result is enter image description here How we can see that the abscissa axis has another values. How can I solve this problem?

$\endgroup$
  • $\begingroup$ I suspect that ListDensityPlot isn't behaving well because you only provide values along the diagonal. If you provide values for points evenly spread out in the space, it will probably behave as you expect. $\endgroup$ – C. E. Apr 20 at 19:54

Your Answer

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

Browse other questions tagged or ask your own question.