invert columns and labels

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

invert columns and labels

alberto
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
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: invert columns and labels

vincent.adrien@gmail.com
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
> [hidden email]
> https://mail.python.org/mailman/listinfo/matplotlib-users
>

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users