2
$\begingroup$

I've a large data make matrix 100*100 and and other two sets of data represent the x and y axis. Each value in the matrix is a related to one value in x and one value of y. I ask about a way to plot these data list contour plot and about how to combine this figure with list log plot and I don't want to write the the data manually

mat = {{22, 36, 44, 44, 48, 59, 67, 87, 89, 83}, {44, 32, 39, 52, 54, 
   72, 63, 78, 118, 139}, {41, 36, 56, 63, 77, 84, 78, 107, 112, 
   141}, {41, 64, 50, 82, 106, 100, 113, 127, 156, 183}, {61, 60, 57, 
   85, 95, 122, 134, 145, 172, 197}, {50, 61, 78, 106, 113, 151, 155, 
   185, 202, 238}, {61, 78, 116, 150, 122, 164, 207, 215, 227, 
   265}, {95, 100, 108, 155, 147, 192, 217, 255, 267, 364}, {71, 144, 
   128, 152, 187, 227, 241, 314, 302, 363}, {126, 166, 213, 214, 290, 
   284, 304, 378, 392, 420}} ; 
x = {0.01, 3, 7, 10, 13, 17, 18, 20, 23, 30} ;
y = {0.01, 0.19, 2, 4, 5, 8.5, 9, 10, 11, 13};
$\endgroup$
5
  • 1
    $\begingroup$ ListContourPlot accepts matrix data, and adding DataRange -> {{xmin, xmax}, {ymin, ymax}} will ensure the ticks are displayed correctly. I do not know what you mean by combining this with ListLogPlot, though. Would you clarify, please. $\endgroup$
    – rcollyer
    Commented Jun 29, 2015 at 15:39
  • $\begingroup$ I want to combine two figures one plotted using list contour plot and other figure by list log plot in the same figure like the order show but show order does not work with me $\endgroup$
    – Shaaban
    Commented Jun 29, 2015 at 15:43
  • $\begingroup$ It would be easier to understand your question and to provide some help, if you could provide a minimal example of working and nonworking code together with a picture or description of the desired output. A smaller matrix (10x10) or a random matrix should reproduce the problem. $\endgroup$
    – Karsten7
    Commented Jun 29, 2015 at 15:51
  • $\begingroup$ mat={ {22, 36, 44, 44, 48, 59, 67, 87, 89, 83}, {44, 32, 39, 52, 54, 72, 63, 78, 118, 139}, {41, 36, 56, 63, 77, 84, 78, 107, 112, 141}, {41, 64, 50, 82, 106, 100, 113, 127, 156, 183}, {61, 60, 57, 85, 95, 122, 134, 145, 172, 197}, {50, 61, 78, 106, 113, 151, 155, 185, 202, 238}, {61, 78, 116, 150, 122, 164, 207, 215, 227, 265}, {95, 100, 108, 155, 147, 192, 217, 255, 267, 364}, {71, 144, 128, 152, 187, 227, 241, 314, 302, 363}, {126, 166, 213, 214, 290, 284, 304, 378, 392, 420} } x={0.01, 3, 7, 10, 13, 17, 18 ,20, 23, 30} y={0.01,0.19, 2, 4,5, 8.5,9,10,11,13} $\endgroup$
    – Shaaban
    Commented Jun 29, 2015 at 15:56
  • $\begingroup$ It means for x=0.01, 0.01 the matrix value 126 and for x=0.01, y=0.19 matrix value 71 and etc. $\endgroup$
    – Shaaban
    Commented Jun 29, 2015 at 16:00

1 Answer 1

6
$\begingroup$

I don't understand the "combining" part of your question, but this makes a contour plot:

ListContourPlot[Flatten /@ Flatten[Transpose[{Outer[List, x, y], mat}, {3, 2, 1}], 1],
                Epilog -> {Red, PointSize[Medium], Point /@ Outer[List, x, y]}]]

Mathematica graphics

ContourPlot[
 Interpolation[Flatten[Transpose[{Outer[List, x, y], mat}, {3, 2, 1}], 1]][u, v], 
 Evaluate@{u, Sequence @@ ({Min@#, Max@#} &[x])}, 
 Evaluate@{v, Sequence @@ ({Min@#, Max@#} &[y])}]

Mathematica graphics

$\endgroup$
2
  • $\begingroup$ How can I make this plot with logarithmic scale for x and y? $\endgroup$
    – Shaaban
    Commented Jul 9, 2015 at 15:46
  • $\begingroup$ @Shaaban Welcome to this site! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ Commented Jul 9, 2015 at 15:51

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.