0

I have 3 lists of data, x,y,z which I want to plot as a discrete colourmap type graph with the x and y being the coordinates of the z data point, and the z-value corresponding to a colour in the usual sense.

My data is of the form:

x = [0.4, 0.4, 0.4, 0.4, 0.4, 0.5, 0.5, 0.5, 0.5, 0.5]

y = [0.002, 0.0024, 0.0028, 0.0032, 0.0036, 0.002, 0.0024, 0.0028, 0.0032, 0.0036]

z = [1884.7, 1783.7, 2065.7, 1778.0, 2042.0, 2615.7, 2814.0, 2605.0, 1538.3, 1981.3]

I've tried using imshow/matshow by reshaping the z data into an m by n matrix, but the issue there is that the x/y axes only have values corresponding to the index of the z-matrix. Ideally I'd like something like the image below, but with the numbers on the axes referring to my x/y data.

Thanks very much.

enter image description here

Community
  • 1
  • 1
ponsly
  • 87
  • 9
  • 1
    [Here's](https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.pcolor.html#matplotlib.axes.Axes.pcolor) what I think you are looking for. – Aaron Aug 15 '19 at 14:47
  • this seems to be the simplest seaborn alternative. thanks very much. – ponsly Aug 15 '19 at 14:55
  • 1
    take note of how the input needs to be formatted. it is not exactly the same. – Aaron Aug 15 '19 at 15:05

1 Answers1

1

You could use seaborn instead of matplotlib for a heatmap. See the following question for a nice example: Three variables as heatmap

A. van Hugten
  • 715
  • 5
  • 16