The matrix that I wanna plot the elements are complicated, this matrix is just an example:

matriz[t_] := {{-2*t, 2*(1 - t)*t, 0}, {2*(1 - t)*t, 0, 2*(1 - t)}, {0, 2*(1 - t), 0}}; 

I want to generate a graph thats show the evolution of each element and the label is the ij of the element


1 Answer 1


Some basics first:

  1. Try to see if you can extract the matrix element to begin with. You can achieve this by using Part. The most common notation is list[[elem]] which picks out the element of your choice. You can then keep adding components to get to your desired list/matrix depth: list[[row,col]].

  2. Try to see if you can Plot anything at all, and then try to plot an element of your matrix.

It can be daunting at first, but you will become very speedy quite fast.

A staple of mathematica is to be familiar with the following very handy guide on List Manipulation. It is arguably the most useful guide there is out there.

Now back to your question

Would this answer your question?

Table[Plot[Evaluate[matriz[t][[i, j]]], {t, 1, 10}, 
   PlotLabel -> matriz[t][[i, j]]], {i, 1, 3}, {j, 1, 3}] // Grid

enter image description here

Or, if you prefer to have them all in one graph:

    Evaluate[matriz[t]][[i, j]], {i, 1, 3}, {j, 1, 3}]), {t, 1, 10}, 
 PlotLegends -> Flatten@matriz[t]]

enter image description here

Although I am not particularly fond of this plot. Perhaps you could use Callout to better identify the labels on each matrix element? I'll leave that to you.:)

  • $\begingroup$ But how to plot in a single graph? $\endgroup$ Mar 27 at 23:58
  • 1
    $\begingroup$ I've edited my post. Let me know what you think. take care. $\endgroup$
    – alex
    Mar 28 at 8:44
  • 1
    $\begingroup$ i've added a small section at the start for you. You had a good and useful question. The only thing I would suggsest for your next post is that you show your attempt on the code. This helps the community better understand your way of thinking and perhaps can give you pointers on how to improve. Also, by trying you get much more familiar with your work as well. $\endgroup$
    – alex
    Mar 28 at 8:57
  • $\begingroup$ Thanks, it worked $\endgroup$ Mar 28 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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