specify line plot color

Hi alberto,

If I have correctly understood your wish, you may be looking for in
[numpy.savetxt](numpy.savetxt — NumPy v1.14 Manual)
and
[numpy.loadtxt](numpy.loadtxt — NumPy v1.14 Manual).

This may not be really Matplotlib's field anymore, but please find
attached a small example on how to record data into a flat text file and
reload them. Hopefully this will helpful to you.

Best regards,
Adrien

Hi,
I wrote days ago about script python
I would ask you if exist a way to print in a file the data of a plot

this is my script

#!/usr/bin/env python

import numpy as np
import matplotlib.pyplot as plt
import sys

#%%
# Temperature that we are interested in
target_T = 10.0
#%% Load all condtens data
data = np.loadtxt("Pb8I28-MA-BISIMID_101010Kp_FR.condtens")
#%% Load trace data
data2 = np.loadtxt("Pb8I28-MA-BISIMID_101010Kp_FR.trace")
#print(data[:,1])
#%%
# Select only the data points computed at that specific temperature
T = data[:, 1]
indices = (T == target_T)
#print(indices)

#%%Fermi levels converted in electronvolts
Ef = 13.60 * data[indices, 0]
print(Ef)

#%% plot trace at T
Fermi_level = 4.44075 # (in eV)

plt.figure()
labels = ("\\sigma / tau",)
for i, label in enumerate(labels):
??? plt.plot((Ef - Fermi_level), data2[indices,(abs(5))], label=label)
plt.legend(loc="best")
plt.xlabel(r"Energy-Efermi [eV]")
plt.ylabel(r"\\sigma/\\tau [\\Omega m s]")
plt.tight_layout()
plt.show()

#%% plot DOS(Ef) at T

au_to_m = 5.291772083E-11
V = 7670.7134 # a.u.^3
m_el = 9.10938356E-31 #Kg
V_m3 = V*(au_to_m)**3
print(V_m3)

plt.figure()
labels = ("DOS",)
for i, label in enumerate(labels):
??? plt.plot(Ef, data2[indices,(3)], label=label)
plt.legend(loc="best")
plt.xlabel(r"Ef [eV]")
plt.ylabel(r"n /(\\mu\) [e / m^3]")
plt.tight_layout()
plt.show()

#%%
# And recast as an array of 3x3 matrices for convenience
# Column numbers are easy to follow: 1 for Ef, 1 for T, 1 for N, 9 for
sigma,
# and then comes the Seebeck coefficient
sigma = data[indices, 3:12].reshape((-1, 3, 3))
sys.stdout=open('prova.txt','wt')
print(sigma)
seebeck = data[indices, 12:21].reshape((-1, 3, 3))

# 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.axis([4,8,-1,8])
plt.tight_layout()
plt.show()

in particular I would write four columns with ef and xx yy zz in a
datafile.txt

regards

Alberto

2018-04-16 19:22 GMT+02:00 alberto <voodoo.bender at gmail.com
<mailto:voodoo.bender at gmail.com>>:

    Hi,
    thank you so much for your help

    Alberto

    2018-04-16 18:58 GMT+02:00 vincent.adrien at gmail.com
    <mailto:vincent.adrien at gmail.com> <vincent.adrien at gmail.com
    <mailto:vincent.adrien at gmail.com>>:

        Hi Alberto,

        I now understand better. No need to flip you data then: you can
        actually explicitly specify the color that? you want in the
        `plot` function, with the *color* keyword argument. See the
        attached script that should hopefully help you to get what you want.

        Best regards,
        Adrien

            Hi vincet,

            in my plot (see .png file)

            I would invert the color

            xx --> green
            zz--> blue

            regards

            Alberto

            ?
            Pb8I28-MA-PERF-BISIMID_32Kp_101010.condtens
            <Pb8I28-MA-PERF-BISIMID_32Kp_101010.condtens - Google Drive
            <Pb8I28-MA-PERF-BISIMID_32Kp_101010.condtens - Google Drive;
            ?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: example_alberto.py
Type: text/x-python
Size: 1726 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180610/6f81db83/attachment-0001.py&gt;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: for_alberto.pdf
Type: application/pdf
Size: 13434 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180610/6f81db83/attachment-0001.pdf&gt;
-------------- next part --------------
# Data used to plot a figure
# ef, xx, yy, zz
0.000000e+00, 0.000000e+00, 0.000000e+00, 0.000000e+00
1.111111e-01, 3.333333e-01, 1.111111e-01, 1.234568e-02
2.222222e-01, 4.714045e-01, 2.222222e-01, 4.938272e-02
3.333333e-01, 5.773503e-01, 3.333333e-01, 1.111111e-01
4.444444e-01, 6.666667e-01, 4.444444e-01, 1.975309e-01
5.555556e-01, 7.453560e-01, 5.555556e-01, 3.086420e-01
6.666667e-01, 8.164966e-01, 6.666667e-01, 4.444444e-01
7.777778e-01, 8.819171e-01, 7.777778e-01, 6.049383e-01
8.888889e-01, 9.428090e-01, 8.888889e-01, 7.901235e-01
1.000000e+00, 1.000000e+00, 1.000000e+00, 1.000000e+00

···

On 06/10/2018 08:30 AM, alberto wrote:

        On 04/16/2018 09:20 AM, alberto wrote: