I have a table with some data that I plot against each other, say like this.

test = Table[i + j, {i, 7}, {j, 5}];

This will give me a contourplot with x-axis ranging from 0-5 and y-axis from 0-7. However, I want the y-axis to change based on the axisrange list I have. I know I can plot those values on the axis, but I actually want the plot to scale based on the values, as the interval between the values is different for each set of values. Any ideas how to do this?


  • 1
    $\begingroup$ Not entirely clear what you want, but would PlotRange be useful to you? $\endgroup$ – Sjoerd C. de Vries Feb 11 '15 at 14:47
  • $\begingroup$ Perhaps you could draw a picture of the desired output in this case $\endgroup$ – Dr. belisarius Feb 11 '15 at 14:52
  • $\begingroup$ I posted a picture showing what I want (I hope). Basically I want to scale the y-axis according to the values in my axesrange, so 1 corresponds to 0, 2 corresponds to 1.5 and so on. $\endgroup$ – matti0006 Feb 11 '15 at 15:14
  • $\begingroup$ It's still not clear what you are looking for here. If you need to scale something usually you would divide by a constant. If you need to change the plot range you need to use, ListContourPlot[test,PlotRange->{{},{}}]. Showing the output from Mathematica and explaining what its not doing and what you want fixed would make it easier to answer. $\endgroup$ – wgwz Feb 11 '15 at 16:12
  • $\begingroup$ DataRange may be it. $\endgroup$ – Sjoerd C. de Vries Feb 11 '15 at 17:34
test = Flatten[Table[{j, i, i + j}, {i, 7}, {j, 5}], 1]
axesrange = {0, 1.5, 5, 6, 9, 10, 17};
f = Interpolation[Transpose@List[Union[test[[All, 2]]], axesrange]];
GraphicsRow[{ListContourPlot[test], ListContourPlot[test /. {x_, y_, z_} :> {x, f@y, z}]}]

Mathematica graphics

| improve this answer | |
  • $\begingroup$ Thanks a bundle, this looks pretty much like what I want! $\endgroup$ – matti0006 Feb 12 '15 at 15:34

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