invert columns and labels

Hi,
I use this command to calculate an array of 3x3 matrices

sigma = data[indices, 3:12].reshape((-1, 3, 3))

to return

# Plot the xx, yy and zz components as a function of the first column
plt.figure()
labels = ("xx", "yy", "zz")
for i, label in enumerate(labels):
    plt.plot(Ef, sigma[:, i, i], label=label)
plt.legend(loc="best")
plt.xlabel(r"Energy [eV]")
plt.ylabel(r"$\sigma$ [1/$\Omega$ m s]")
plt.tight_layout()
plt.show()

How could invert the results xx to zz?

something as data[indices, 12:3]?

regards

Alberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180416/ea6e6ca1/attachment.html>

Hi Alberto,

Without an small example of the arrays *data* and *indices* (as well as
possibly *Ef*) or a more precise description of their shape and
dimensions, I have to admit that it is a bit difficult (at least for me)
to understand precisely what you are trying to plot and to invert.

For what I understood, I wonder if you are not just looking for
something like ``sigma[:, i, i][::-1]`` (more information on slicing
here:
https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.indexing.html#basic-slicing-and-indexing),
I may just have missed the point. Beware that you may also have to flip
the *labels*.

Best regards,
Adrien

···

On 04/16/2018 07:25 AM, alberto wrote:

Hi,
I use this command to calculate an array of 3x3 matrices

sigma = data[indices, 3:12].reshape((-1, 3, 3))

to return

# Plot the xx, yy and zz components as a function of the first column
plt.figure()
labels = ("xx", "yy", "zz")
for i, label in enumerate(labels):
??? plt.plot(Ef, sigma[:, i, i], label=label)
plt.legend(loc="best")
plt.xlabel(r"Energy [eV]")
plt.ylabel(r"$\sigma$ [1/$\Omega$ m s]")
plt.tight_layout()
plt.show()

How could invert the results xx to zz?

something as data[indices, 12:3]?

regards

Alberto

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users