> On Nov 19, 2017, at 3:14 PM, Stephen P. Molnar <s.mol...@sbcglobal.net> wrote: > > > On 11/19/2017 03:10 PM, William Ray Wing wrote: >>> On Nov 19, 2017, at 11:36 AM, Stephen P. Molnar <s.mol...@sbcglobal.net> >>> wrote: >>> >>> I have written a short Python 3 script to plot three curves (one plot) of >>> data from a FORTRAN program. Initially the code worked and produced the >>> plot which is attached. I have also attached the code and the input data, >>> >> The data made it through, neither the script nor the plot did. If the >> script really is short, perhaps you could just cut and paste it into a >> follow-up msg. Absent that, no one here can help you. >> >> Thanks, >> Bill >> >>> In all candor, I don't have the faintest idea as to whst the problem (or >>> problens) might be and would greatly appreciate a pointer towards the >>> solution. >>> >>> Thanks in advance. >>> >>> -- >>> Stephen P. Molnar, Ph.D. Life is a fuzzy set >>> www.molecular-modeling.net Stochastic and multivariate >>> (614)312-7528 (c) >>> Skype: smolnar1 >>> >>> <A_poutput.txt>_______________________________________________ >>> Tutor maillist - Tutor@python.org >>> To unsubscribe or change subscription options: >>> https://mail.python.org/mailman/listinfo/tutor >> >
Unfortunately your mail reader/program has pasted it in as an RTF file and this makes it almost impossible to look at in a text editor or hand to the Python interpreter. What we see looks like the following (I’ve pasted in the first few lines). ——————————————— Multiple_Plots_2_b.py\ \ Copyright (c) 2017 Stephen P. Molnar, Ph.D. \'a0All rights reserved.\ \ """\ import numpy as np\ from mpl_toolkits.axes_grid1 import host_subplot\ import mpl_toolkits.axisartist as AA\ import matplotlib.pyplot as plt\ \ data = []\ name = input("Enter Molecule ID: ")\ \ name_in = name+'_poutput'\ data = np.genfromtxt(name_in)\ \ s = data[:,0]\ FTm = data[:,1] \'a0\'a0\'a0\'a0#atomic number\ FTe = data[:,2] \'a0\'a0\'a0\'a0#atomic mass\ FTc = data[:,3] \'a0\'a0\'a0\'a0#atom electron density\ \ \ fig = plt.figure(figsize=(7.6,4))\ \ host = host_subplot(111, axes_class=AA.Axes)\ plt.subplots_adjust(right=0.75)\ \ par1 = host.twinx()\ par2 = host.twinx()\ \ offset = 60\ new_fixed_axis = par2.get_grid_helper().new_fixed_axis\ par2.axis["right"] = new_fixed_axis(loc="right", axes=par2,\ \'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0offset=(offset, 0))\ \ ------------------------------- > Here it is: > > #!/usr/bin/env python3 > # -*- coding: utf-8 -*- > """ > Multiple_Plots_2_b.py > > Copyright (c) 2017 Stephen P. Molnar, Ph.D. All rights reserved. > > """ > import numpy as np > from mpl_toolkits.axes_grid1 import host_subplot > import mpl_toolkits.axisartist as AA > import matplotlib.pyplot as plt > > data = [] > name = input("Enter Molecule ID: ") > > name_in = name+'_poutput' > data = np.genfromtxt(name_in) > > s = data[:,0] > FTm = data[:,1] #atomic number > FTe = data[:,2] #atomic mass > FTc = data[:,3] #atom electron density > > > fig = plt.figure(figsize=(7.6,4)) > > host = host_subplot(111, axes_class=AA.Axes) > plt.subplots_adjust(right=0.75) > > par1 = host.twinx() > par2 = host.twinx() > > offset = 60 > new_fixed_axis = par2.get_grid_helper().new_fixed_axis > par2.axis["right"] = new_fixed_axis(loc="right", axes=par2, > offset=(offset, 0)) > > par2.axis["right"].toggle(all=True) > > host.set_xlim(0, 30) > """ > host.set_ylim(min(FTm), max(FTm)) > """ > > host.set_xlabel("Distance ($\AA$)") > host.set_ylabel("Atomic Number") > par1.set_ylabel("Atom Mass") > par2.set_ylabel("Atom Electron Density") > > p1, = host.plot(data[:,0], data[:,1])#, label="Atomic Number") > p2, = par1.plot(data[:,0], data[:,2])#, label="Atom Mass") > p3, = par2.plot(data[:,0], data[:,3])#, label="Atom Electron Density") > > """ > par1.set_ylim(min(FTe), max(FTe)) > par2.set_ylim(min(FTc),max(FTc)) > """ > > #host.legend() > > host.axis["left"].label.set_color(p1.get_color()) > par1.axis["right"].label.set_color(p2.get_color()) > par2.axis["right"].label.set_color(p3.get_color()) > > host.title.set_text('Molecule {0} - Molecular Transforms'.format(name)) > plt.draw() > plt.show() > > name_plt = name+'-fig1.png' > fig.savefig(name_plt,bbox_inches='tight') > > > -- > Stephen P. Molnar, Ph.D. Life is a fuzzy set > www.molecular-modeling.net Stochastic and multivariate > (614)312-7528 (c) > Skype: smolnar1 > _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor