kthyng / tracpy

Fortran core of Tracmass + Python wrapping around the outside.
MIT License
28 stars 19 forks source link

Matplotlib problem with plotting.tracks #5

Open rsignell-usgs opened 11 years ago

rsignell-usgs commented 11 years ago

When trying to run https://www.wakari.io/sharing/bundle/kthyng/manual I'm getting a error related to dashes that seems related to using an outdated matplotlib?

plotting.tracks(lonp, latp, name, grid=grid)

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-13-1f333ccdc1f5> in <module>()
----> 1 plotting.tracks(lonp, latp, name, grid=grid)

/opt/anaconda/envs/manual/lib/python2.7/site-packages/tracpy/plotting.pyc in tracks(lonp, latp, fname, grid, fig, ax, Title, mers, pars)
    361         os.makedirs('figures')
    362 
--> 363     savefig('figures/' + fname + 'tracks.png',bbox_inches='tight')
    364     # savefig('figures/' + fname + 'tracks.pdf',bbox_inches='tight')
    365 

/opt/anaconda/envs/manual/lib/python2.7/site-packages/matplotlib/pyplot.pyc in savefig(*args, **kwargs)
    559 def savefig(*args, **kwargs):
    560     fig = gcf()
--> 561     return fig.savefig(*args, **kwargs)
    562 
    563 

/opt/anaconda/envs/manual/lib/python2.7/site-packages/matplotlib/figure.pyc in savefig(self, *args, **kwargs)
   1419             self.set_frameon(frameon)
   1420 
-> 1421         self.canvas.print_figure(*args, **kwargs)
   1422 
   1423         if frameon:

/opt/anaconda/envs/manual/lib/python2.7/site-packages/matplotlib/backend_bases.pyc in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
   2165                     orientation=orientation,
   2166                     dryrun=True,
-> 2167                     **kwargs)
   2168                 renderer = self.figure._cachedRenderer
   2169                 bbox_inches = self.figure.get_tightbbox(renderer)

/opt/anaconda/envs/manual/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc in print_png(self, filename_or_obj, *args, **kwargs)
    503 
    504     def print_png(self, filename_or_obj, *args, **kwargs):
--> 505         FigureCanvasAgg.draw(self)
    506         renderer = self.get_renderer()
    507         original_dpi = renderer.dpi

/opt/anaconda/envs/manual/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc in draw(self)
    449 
    450         try:
--> 451             self.figure.draw(self.renderer)
    452         finally:
    453             RendererAgg.lock.release()

/opt/anaconda/envs/manual/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
     52     def draw_wrapper(artist, renderer, *args, **kwargs):
     53         before(artist, renderer)
---> 54         draw(artist, renderer, *args, **kwargs)
     55         after(artist, renderer)
     56 

/opt/anaconda/envs/manual/lib/python2.7/site-packages/matplotlib/figure.pyc in draw(self, renderer)
   1032         dsu.sort(key=itemgetter(0))
   1033         for zorder, a, func, args in dsu:
-> 1034             func(*args)
   1035 
   1036         renderer.close_group('figure')

/opt/anaconda/envs/manual/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
     52     def draw_wrapper(artist, renderer, *args, **kwargs):
     53         before(artist, renderer)
---> 54         draw(artist, renderer, *args, **kwargs)
     55         after(artist, renderer)
     56 

/opt/anaconda/envs/manual/lib/python2.7/site-packages/matplotlib/axes.pyc in draw(self, renderer, inframe)
   2084 
   2085         for zorder, a in dsu:
-> 2086             a.draw(renderer)
   2087 
   2088         renderer.close_group('axes')

/opt/anaconda/envs/manual/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
     52     def draw_wrapper(artist, renderer, *args, **kwargs):
     53         before(artist, renderer)
---> 54         draw(artist, renderer, *args, **kwargs)
     55         after(artist, renderer)
     56 

/opt/anaconda/envs/manual/lib/python2.7/site-packages/matplotlib/lines.pyc in draw(self, renderer)
    560                         drawFunc(pe_renderer, gc, tpath, affine_frozen)
    561                 else:
--> 562                     drawFunc(renderer, gc, tpath, affine.frozen())
    563 
    564         if self._marker:

/opt/anaconda/envs/manual/lib/python2.7/site-packages/matplotlib/lines.pyc in _draw_lines(self, renderer, gc, path, trans)
    936 
    937     def _draw_lines(self, renderer, gc, path, trans):
--> 938         self._lineFunc(renderer, gc, path, trans)
    939 
    940     def _draw_steps_pre(self, renderer, gc, path, trans):

/opt/anaconda/envs/manual/lib/python2.7/site-packages/matplotlib/lines.pyc in _draw_dashed(self, renderer, gc, path, trans)
    981         gc.set_linestyle('dashed')
    982         if self._dashSeq is not None:
--> 983             gc.set_dashes(0, self._dashSeq)
    984 
    985         renderer.draw_path(gc, path, trans)

/opt/anaconda/envs/manual/lib/python2.7/site-packages/matplotlib/backend_bases.pyc in set_dashes(self, dash_offset, dash_list)
    902             dl = np.asarray(dash_list)
    903             if np.any(dl <= 0.0):
--> 904                 raise ValueError("All values in the dash list must be positive")
    905         self._dashes = dash_offset, dash_list
    906 

ValueError: All values in the dash list must be positive
kthyng commented 10 years ago

This dashed line problem should be fixed now. It was in a basemap plot, and my computer and tracpy are all updated now, too.

Could you try this again? https://www.wakari.io/sharing/bundle/kthyng/manual

rsignell-usgs commented 10 years ago

I tried it again and got the exact same error. Did your updates get applied to the environment you shared?

kthyng commented 10 years ago

Thanks for trying again. Maybe the notebook wasn't properly updated, and now I actually can't get it to share (comes up with an unknown error every time). Also can't get it to run in an ipython terminal; the terminal just blacks out. I guess I'll have to get back to you later!

On Sun, Nov 17, 2013 at 7:53 PM, Rich Signell notifications@github.comwrote:

I tried it again and got the exact same error. Did your updates get applied to the environment you shared?

— Reply to this email directly or view it on GitHubhttps://github.com/kthyng/tracpy/issues/5#issuecomment-28670771 .

Kristen M. Thyng Postdoctoral Research Associate Department of Oceanography Texas A&M University http://kristenthyng.com