2
$\begingroup$

So I wished to combine quiet a few different contour plots into one plot which would demonstrate to me not only the highest value out of all the different plots but also which contour plot that value came from. Show doesn't work and I've tried several other things and looked through the documentation and nothing seems quiet right for this.

con = Select[hopec, MemberQ[#, 0.009, 2] &];
con1 = Select[con, MemberQ[#, 0.4, 2] &];
con2 = Select[con1, MemberQ[#, -0.008,2] &];
(*collects all the data that have these conditions b=0.4,d=0.009,c=-0.008*)
t22 = Table[{con2[[i, 13]], con2[[i, 12]], con2[[i, 10]]}, {i, Length[con2]}];
g22 = ListContourPlot[t22,PlotLegends -> BarLegend[Automatic, LegendLabel -> "\[Rho]22"], FrameLabel -> {"m", "\[Delta]"}];
tvv = Table[{con2[[i, 13]], con2[[i, 12]], con2[[i, 1]]}, {i, Length[con2]}];
gvv = ListContourPlot[tvv, PlotLegends -> BarLegend[Automatic, LegendLabel -> "\[Rho]VV"], FrameLabel -> {"m", "\[Delta]"}];
tv0 = Table[{con2[[i, 13]], con2[[i, 12]], con2[[i, 2]]}, {i, Length[con2]}];
gv0 = ListContourPlot[tv0,  PlotLegends -> BarLegend[Automatic, LegendLabel -> "\[Rho]V0"],  FrameLabel -> {"m", "\[Delta]"}];
t12 = Table[{con2[[i, 13]], con2[[i, 12]], con2[[i, 9]]}, {i, Length[con2]}];
g12 = ListContourPlot[t12, PlotLegends -> BarLegend[Automatic, LegendLabel -> "\[Rho]12"], FrameLabel -> {"m", "\[Delta]"}];
t11 = Table[{con2[[i, 13]], con2[[i, 12]], con2[[i, 6]]}, {i, Length[con2]}];
g11 = ListContourPlot[t11, PlotLegends -> BarLegend[Automatic, LegendLabel -> "\[Rho]11"], FrameLabel -> {"m", "\[Delta]"}];
t00 = Table[{con2[[i, 13]], con2[[i, 12]], con2[[i, 3]]}, {i, Length[con2]}];
g00 = ListContourPlot[t00, PlotLegends -> BarLegend[Automatic, LegendLabel -> "\[Rho]00"],  FrameLabel -> {"m", "\[Delta]"}];
t01 = Table[{con2[[i, 13]], con2[[i, 12]], con2[[i, 5]]}, {i, Length[con2]}];
g01 = ListContourPlot[t01, PlotLegends -> BarLegend[Automatic, LegendLabel -> "\[Rho]01"], FrameLabel -> {"m", "\[Delta]"}];
t02 = Table[{con2[[i, 13]], con2[[i, 12]], con2[[i, 8]]}, {i, Length[con2]}];
g02 = ListContourPlot[t02, PlotLegends -> BarLegend[Automatic, LegendLabel -> "\[Rho]02"], FrameLabel -> {"m", "\[Delta]"}];
tv2 = Table[{con2[[i, 13]], con2[[i, 12]], con2[[i, 7]]}, {i, Length[con2]}];
gv2 = ListContourPlot[tv2, PlotLegends -> BarLegend[Automatic, LegendLabel -> "\[Rho]v2"], FrameLabel -> {"m", "\[Delta]"}, ClippingStyle -> Automatic];
tv1 = Table[{con2[[i, 13]], con2[[i, 12]], con2[[i, 4]]}, {i, Length[con2]}];
gv1 = ListContourPlot[tv1, PlotLegends -> BarLegend[Automatic, LegendLabel -> "\[Rho]v1"], FrameLabel -> {"m", "\[Delta]"}];

In a sense I want it to look like a phase diagram but I only have data. In terms of data $con2$ is this (sorry about the length):

con2={{0.0000105869, 0.0000462323, 0.000677253, 0.00274798, 0.0124342, 0.984084, 2.38207*10^-11, 8.61828*10^-11, 6.35236*10^-9, 2.15696*10^-9, 0.009, 1/10000, 1/100000000000000, 0.4, -0.008}, {0.0000453586, 0.000961524, 0.0293037, 0.00484845, 0.120212, 0.844628, 1.76562*10^-10, 3.51431*10^-9, 2.15254*10^-8, 8.50819*10^-9, 0.009, 1/1000, 1/100000000000000, 0.4, -0.008}, {0.000695392, 0.0224844, 0.97682, -1.89692*10^-16, -7.03587*10^-15, 5.803*10^-15, 7.07799*10^-16, 1.98745*10^-14, -1.30136*10^-15, 9.08022*10^-15,0.009, 1/100, 1/100000000000000, 0.4, -0.008}, {0.0000105546, 0.0000454985, 0.000661428, 0.00274496, 0.0122819, 0.984256, 8.23563*10^-11, 2.93692*10^-10, 2.189*10^-8, 7.55843*10^-9, 0.009, 1/10000, 1/10000, 0.4, -0.008}, {0.0000446545, 0.000941198,0.0285556, 0.00482258, 0.118843, 0.846793, 5.47588*10^-10, 1.08015*10^-8, 6.70859*10^-8, 2.66721*10^-8, 0.009, 1/1000, 1/10000, 0.4, -0.008}, {0.000695392, 0.0224844, 0.97682, -1.92039*10^-16, -7.14018*10^-15, 5.75627*10^-15, 8.66728*10^-16, 2.48057*10^-14, -1.29496*10^-15, 1.07056*10^-14, 0.009, 1/100, 1/10000, 0.4, -0.008}, {0.000010309, 0.0000397491, 0.000540616, 0.00271978, 0.0110479, 0.984423, 3.34346*10^-6, 0.0000106159, 0.000870896, 0.000333864, 0.009, 1/10000, 1/1000,0.4, -0.008}, {0.0000392752, 0.000786282, 0.0229166, 0.00461014, 0.10761, 0.862954, 5.42425*10^-6, 0.0000989839, 0.000691211, 0.000287618, 0.009, 1/1000, 1/1000, 0.4, -0.008}, {0.000695392, 0.0224844, 0.97682, -2.09467*10^-16, -7.9219*10^-15, 5.38064*10^-15, 1.31488*10^-14, 4.03497*10^-13, -1.23877*10^-15, 1.38373*10^-13, 0.009, 1/100, 1/1000, 0.4, -0.008}, {0.0000101203, 5.25375*10^-18, 7.76108*10^-17, 1.08346*10^-15, 1.14741*10^-15, 3.94109*10^-13, 0.00274997, 1.62744*10^-16, 2.44902*10^-14, 0.99724, 0.009, 1/10000, 1/10, 0.4, -0.008}, {0.0000335559, 3.20184*10^-17, 8.26066*10^-16, 4.30362*10^-16, 3.46298*10^-15, 1.21438*10^-13, 0.00499983, 8.04832*10^-16, 9.13918*10^-15, 0.994967, 0.009, 1/1000, 1/10, 0.4, -0.008}, {0.00104562, 7.13771*10^-18, 1.71916*10^-16, 1.69479*10^-18, 3.06827*10^-17, 1.26974*10^-16, 0.0274712, 1.04101*10^-16, 2.27133*10^-17, 0.971483, 0.009, 1/100, 1/10,0.4, -0.008}}
$\endgroup$
4
$\begingroup$

Show actually is the function to use, but to display all ten contour plots in the same frame it is necessary to

  • Specify the Contours rather than allowing them to be determined automatically
  • Specify the ColorStyle for contours to distinguish them
  • Specify ContourLabels using Tooltip to distinguish among data sets
  • Turn off ContourShading, so that one plot does not block the preceding one
  • Insert a Point to indicate the location of the maximum data value

This last is necessary, because contour plots do not in themselves show the maximum values of the data they are displaying. With all this,

clr = Table[{ColorData[10][n], Thick}, {n, 10, 1, -1}];
ll = {"ρVV", "ρV0", "ρ00", "ρv1", "ρ01", "ρ11", "ρv2", "ρ02", "ρ12", "ρ22"};
Row[{Show[(n = #; ListContourPlot[
    {con2[[All, 13]], con2[[All, 12]], con2[[All, n]]} // Transpose, 
    Contours -> Range[0, 1, .1], ContourStyle -> clr, ContourShading -> None, 
    ContourLabels -> {None, Tooltip[Null, ll[[n]]] &}]) & /@ Range[10], 
    FrameLabel -> {"m", "δ"},  LabelStyle -> Directive[Bold, Black, Medium], 
    ImageSize -> Large, 
    Epilog -> {Red, PointSize[Large], Point[{con2[[#, 13]], con2[[#, 12]]} & 
        [Position[con2, Max[con2[[All, ;; -2]]]][[1, 1]]]]}], 
    "   ", 
    Style[Framed[Table[{.1 (10 - n), ColorData[10][n]}, {n, 9}] // TableForm], Large]}]

(Note: n = # is needed to help Mathematica distinguish between #'s in the inner and outer functions, the inner being Tooltip[Null, ll[[n]]] &.)

enter image description here

Hovering the pointer over a contour displays its name, for instance ρ22 for the Red contour at the far right of the plot. The actual maximum value, its name, and its coordinates are given by

{Max[con2[[All, ;; -2]]], ll[[#]], {con2[[#, 13]], con2[[#, 12]]}} &
    [Position[con2, Max[con2[[All, ;; -2]]]][[1, 1]]]
(* {0.99724, "ρ22", {1/10, 1/10000}} *)
$\endgroup$
  • $\begingroup$ Sorry for commenting so long after you replied (I was gone for a week and was somehow unable to login since stack exchange did not recognized my account on a different computer). But the two links that @kglr posted are much more what I'm looking for but still proving difficult to apply since I have data and not strict equations. $\endgroup$ – Wilco May 29 '18 at 17:16
  • $\begingroup$ @Wilco Convert your data into InterpolationFunctions by means of Interpolation and then treat them like any other functions. $\endgroup$ – bbgodfrey May 29 '18 at 21:00

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.