[gpaw-users] Plotting error

Varadharajan Srinivasan varadharajan.srinivasan at gmail.com
Wed Apr 27 06:00:38 CEST 2016


Dear Jens,

I think I solved the problem. The issue was with the location on latex. I
had to do the following to get it to work

1. Make a link for the latex binaries (since in El Capitan /usr/texbin is
no longer the path for these).
     sudo ln -s
/Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin
/Library/TeX/texbin
2. Add the following lines in the python script for plotting :

    import os
    os.environ['PATH'] = os.environ['PATH'] + ':/Library/TeX/texbin'

With these the script proceeded to give me a png file. However, the
spin-dependent colour scheme in the plot is now messed up as compared to
the example. I will look into this a little and further and let you know if
I continue to have problems.

Best,
Vardha.

On Tue, Apr 26, 2016 at 10:22 PM, Varadharajan Srinivasan <
varadharajan.srinivasan at gmail.com> wrote:

> Dear Jens,
>
> I did an upgrade install and still got an error (below).
>
> Traceback (most recent call last):
>   File "MoS2_bands_plot.py", line 37, in <module>
>     plt.savefig('MoS2_bands.png')
>   File "/usr/local/lib/python2.7/site-packages/matplotlib/pyplot.py", line
> 688, in savefig
>     res = fig.savefig(*args, **kwargs)
>   File "/usr/local/lib/python2.7/site-packages/matplotlib/figure.py", line
> 1565, in savefig
>     self.canvas.print_figure(*args, **kwargs)
>   File
> "/usr/local/lib/python2.7/site-packages/matplotlib/backend_bases.py", line
> 2232, in print_figure
>     **kwargs)
>   File
> "/usr/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py",
> line 527, in print_png
>     FigureCanvasAgg.draw(self)
>   File
> "/usr/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py",
> line 474, in draw
>     self.figure.draw(self.renderer)
>   File "/usr/local/lib/python2.7/site-packages/matplotlib/artist.py", line
> 61, in draw_wrapper
>     draw(artist, renderer, *args, **kwargs)
>   File "/usr/local/lib/python2.7/site-packages/matplotlib/figure.py", line
> 1159, in draw
>     func(*args)
>   File "/usr/local/lib/python2.7/site-packages/matplotlib/artist.py", line
> 61, in draw_wrapper
>     draw(artist, renderer, *args, **kwargs)
>   File "/usr/local/lib/python2.7/site-packages/matplotlib/axes/_base.py",
> line 2324, in draw
>     a.draw(renderer)
>   File "/usr/local/lib/python2.7/site-packages/matplotlib/artist.py", line
> 61, in draw_wrapper
>     draw(artist, renderer, *args, **kwargs)
>   File "/usr/local/lib/python2.7/site-packages/matplotlib/axis.py", line
> 1108, in draw
>     renderer)
>   File "/usr/local/lib/python2.7/site-packages/matplotlib/axis.py", line
> 1058, in _get_tick_bboxes
>     extent = tick.label1.get_window_extent(renderer)
>   File "/usr/local/lib/python2.7/site-packages/matplotlib/text.py", line
> 961, in get_window_extent
>     bbox, info, descent = self._get_layout(self._renderer)
>   File "/usr/local/lib/python2.7/site-packages/matplotlib/text.py", line
> 352, in _get_layout
>     ismath=False)
>   File
> "/usr/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py",
> line 229, in get_text_width_height_descent
>     renderer=self)
>   File "/usr/local/lib/python2.7/site-packages/matplotlib/texmanager.py",
> line 675, in get_text_width_height_descent
>     dvifile = self.make_dvi(tex, fontsize)
>   File "/usr/local/lib/python2.7/site-packages/matplotlib/texmanager.py",
> line 422, in make_dvi
>     report))
> RuntimeError: LaTeX was not able to process the following string:
> 'lp'
> Here is the full report generated by LaTeX:
>
>
>
>
> On Tue, Apr 26, 2016 at 3:54 PM, Jens Jørgen Mortensen <jensj at fysik.dtu.dk
> > wrote:
>
>> On 04/26/2016 09:27 AM, Varadharajan Srinivasan via gpaw-users wrote:
>>
>> Dear all,
>>
>> I was trying out a tutorial calculation on WS2 band structure with
>> spin-orbit coupling. I modified the system to MoS2 and tried out the python
>> scripts given in the tutorial. At the plotting stage I get the following
>> error :
>>
>>
>> What version of matplotlib do you have?  You could try to a "pip install
>> -U --user matplotlib" and see if that helps.
>>
>> Jens Jørgen
>>
>>
>>  plt.savefig('MoS2_bands.png')
>>
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   File "/usr/local/lib/python2.7/site-packages/matplotlib/pyplot.py",
>> line 688, in savefig
>>     res = fig.savefig(*args, **kwargs)
>>   File "/usr/local/lib/python2.7/site-packages/matplotlib/figure.py",
>> line 1565, in savefig
>>     self.canvas.print_figure(*args, **kwargs)
>>   File
>> "/usr/local/lib/python2.7/site-packages/matplotlib/backend_bases.py", line
>> 2232, in print_figure
>>     **kwargs)
>>   File
>> "/usr/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py",
>> line 527, in print_png
>>     FigureCanvasAgg.draw(self)
>>   File
>> "/usr/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py",
>> line 474, in draw
>>     self.figure.draw(self.renderer)
>>   File "/usr/local/lib/python2.7/site-packages/matplotlib/artist.py",
>> line 61, in draw_wrapper
>>     draw(artist, renderer, *args, **kwargs)
>>   File "/usr/local/lib/python2.7/site-packages/matplotlib/figure.py",
>> line 1159, in draw
>>     func(*args)
>>   File "/usr/local/lib/python2.7/site-packages/matplotlib/artist.py",
>> line 61, in draw_wrapper
>>     draw(artist, renderer, *args, **kwargs)
>>   File "/usr/local/lib/python2.7/site-packages/matplotlib/axes/_base.py",
>> line 2324, in draw
>>     a.draw(renderer)
>>   File "/usr/local/lib/python2.7/site-packages/matplotlib/artist.py",
>> line 61, in draw_wrapper
>>     draw(artist, renderer, *args, **kwargs)
>>   File "/usr/local/lib/python2.7/site-packages/matplotlib/lines.py", line
>> 739, in draw
>>     ln_color_rgba = self._get_rgba_ln_color()
>>   File "/usr/local/lib/python2.7/site-packages/matplotlib/lines.py", line
>> 1251, in _get_rgba_ln_color
>>     return colorConverter.to_rgba(self._color, self._alpha)
>>   File "/usr/local/lib/python2.7/site-packages/matplotlib/colors.py",
>> line 376, in to_rgba
>>     'to_rgba: Invalid rgba arg "%s"\n%s' % (str(arg), exc))
>> ValueError: to_rgba: Invalid rgba arg "0.5"
>> to_rgb: Invalid rgb arg "0.5"
>> cannot convert argument to rgb sequence
>>
>>
>> Have I missed installing some libraries? I am working on a brew-based
>> installation of ase and gpaw on El Capitan Mac OS X.
>>
>> Thanks,
>> Vardha.
>>
>>
>>
>> _______________________________________________
>> gpaw-users mailing listgpaw-users at listserv.fysik.dtu.dkhttps://listserv.fysik.dtu.dk/mailman/listinfo/gpaw-users
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/gpaw-users/attachments/20160427/71a6a3cc/attachment-0001.html>


More information about the gpaw-users mailing list