2
$\begingroup$

The model I am trying to copy is this(not really necessary to look at it):

https://www.wolfram.com/mathematica/new-in-10/plot-themes/table-of-plots.html

but my problem is slightly different and I am trying to adapt it. (ignoring the formatting).

I have tried this:

function[a_,z_]=azr
Clear[parameters1]
parameters1 := Table[{i, j}, {i, 1.3, 5.3}, {j, {1, 10, 20, 30, 40}}]
Clear[parameters2]
parameters2 := MapThread[function @@ # &, {#}] & /@ Transpose[parameters1]

Map[Plot[#, {r, 0, 1.2}, AspectRatio -> 1, ImageSize -> 150, 
PlotRange -> {0, 40}] &, parameters2, {2}]

The issue is that when I plot, the incorrect values get mapped. For instance, there is no graph with the values a=5.3 and z=40 that I can see. I believe the first row of graphs is correct but then the latter ones are not.

I think everything up to parameters 2 is correct but the last line is what is where the problem is.

Note: that the function is just an example, for my application I am using something different, but I am still mapping values for two of the parameters and using the third one for the graph.

$\endgroup$

2 Answers 2

3
$\begingroup$

I'm seeing all the graphs in the expected order, including the one you mention (which comes last). What you have is equivalent to the following

Clear[parameters2, f, a, z, r]
f[a_, z_, r_] = a*z*r
parameters2 = Outer[f[#1, #2, r] &, {1, 10, 20, 30, 40}, 0.3 + Range[5]]
options = {AspectRatio -> 1, ImageSize -> 100, PlotRange -> {0, 40}}
Grid@Map[Plot[#, {r, 0, 1.2}, Evaluate@options] &, parameters2, {2}]
$\endgroup$
4
  • $\begingroup$ Not sure if this is the best command but something isn't right. When i check out the last plot using Manipulate[plot[xyr,{r,0,1.2}],{a,5.3},{z,40}]. I get a different graph. How is this possible? Are these not equivalent? @Alan $\endgroup$
    – Dio
    Commented Oct 13, 2017 at 18:34
  • $\begingroup$ Sorry meant to say Manipulate[plot[azr,{r,0,1.2}],{a,5.3},{z,40}] @Alan $\endgroup$
    – Dio
    Commented Oct 13, 2017 at 18:40
  • $\begingroup$ Omg sorry another mess up! Manipulate[Plot[azr,{r,0,1.2}],{a,5.3},{z,40}]. Clearly this graph is different from the last graph? Why is this happening @Alan $\endgroup$
    – Dio
    Commented Oct 13, 2017 at 18:53
  • $\begingroup$ @Dio They are the same, except that in this new plot you did not set PlotRange, so instead of {0,40} you got the full range. $\endgroup$
    – Alan
    Commented Oct 13, 2017 at 19:22
3
$\begingroup$

Adding plot labels so you can see which graph corresponds to which parameter values:

ClearAll[fObs,r];
fObs = Flatten[
   Table[{r*i*j, i, j}, {j, {1, 10, 20, 30, 40}}, {i, 1.3, 5.3}], 1];
Grid@Partition[
  Map[Plot[#[[1]], {r, 0, 1.2}, AspectRatio -> 1, ImageSize -> 100, 
     PlotRange -> {0, 40}, 
     PlotLabel -> ("a: " <> ToString[#[[2]] ] <> ", z: " <> 
        ToString[#[[3]] ]) ] &, fObs], 
      5]

Grid Output

$\endgroup$
1
  • $\begingroup$ Repeating comment here: Not sure if this is the best command but something isn't right. When i check out the last plot using Manipulate[Plot[azr,{r,0,1.2}],{a,5.3},{z,40}]. I get a different graph. How is this possible? Are these not equivalent? $\endgroup$
    – Dio
    Commented Oct 13, 2017 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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