4
$\begingroup$

I have compiled data about the evolution of a function with time and the data looks something like this.

I wanted to plot this data in the form of a density histogram such that every row represents one of the four states and every column represented number the observances of the object in one of the four states at a particular time. The end result should appear something like.enter image description here

I first tried to use the DensityHistorgram but I was unable to put discrete data into it and the documentation did not mention how I could do so. I would be very grateful if anyone could tell me how to plot such a function.

Note: I apologize for putting the data as an image. If you can plot it for any simple data I could use that forward in my work. So, please feel free to use the simplest of data. I only wish to understand how data can be plotted in this manner.

$\endgroup$
  • $\begingroup$ tried MatrixPlot? $\endgroup$ – kglr May 21 at 19:07
  • 1
    $\begingroup$ May you paste the data as code instead of an image. $\endgroup$ – Edmund May 22 at 0:01
6
$\begingroup$

You can use MatrixPlot:

data = Sort /@ RandomReal[1, {4, 20}];

MatrixPlot[data, AspectRatio -> 1/4,  ColorFunction -> "Rainbow", ImageSize -> Large]

enter image description here

$\endgroup$

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.