[Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid'

Stephen P. Molnar s.molnar at sbcglobal.net
Mon Nov 20 09:55:41 EST 2017


On 11/20/2017 09:34 AM, William Ray Wing wrote:
>
>> On Nov 19, 2017, at 3:14 PM, Stephen P. Molnar 
>> <s.molnar at sbcglobal.net <mailto:s.molnar at 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.molnar at sbcglobal.net <mailto:s.molnar at 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
>>>
>
> As an experiment, I took the code and moved it to my laptop (MacOS, 
> running 10.12.6 where there is a complete Anaconda installation that 
> contains self-consistent versions of everything Dr. Molnar imports 
> (Python 3.6.1 incidentally).  There the code runs perfectly.  I’m 
> appending a copy of the .png file it produced, and although I expect 
> it to be scraped off by the gateway list-server, it should show up in 
> Dr. Molnar’s e-mail.
>
> 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 
>>>> <http://www.molecular-modeling.net>Stochastic and multivariate
>>>> (614)312-7528 (c)
>>>> Skype: smolnar1
>>>>
>>>> <A_poutput.txt>_______________________________________________
>>>> Tutor maillist  -  Tutor at python.org
>>>> To unsubscribe or change subscription options:
>>>> https://mail.python.org/mailman/listinfo/tutor
>>>
>>
>> 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 
>> <http://www.molecular-modeling.net>Stochastic and multivariate
>> (614)312-7528 (c)
>> Skype: smolnar1
>>
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> To unsubscribe or change subscription options:
>> https://mail.python.org/mailman/listinfo/tutor
>
Hmmmmmmmmmmmmmm!  I'm relieved that the code works!

I've just encountered something strange.

I haven't been using Python very long, only about six months or so. When 
I started I  look at a number of different IDE, and settled on Spyder, 
although not in Anaconda.  I just installed Canopy in order to use the 
ipython notebook, and the code ran perfectly in the Canopy editor!!!!  
Perhaps I should switch IDE's, but I rather like the Variable Explorer 
feature in Spyder.

-- 
Stephen P. Molnar, Ph.D.		Life is a fuzzy set
www.molecular-modeling.net		Stochastic and multivariate
(614)312-7528 (c)
Skype: smolnar1



More information about the Tutor mailing list