{"action":"created","issue":{"url":"https://api.github.com/repos/joferkington/mpldatacursor/issues/42","labels_url":"https://api.github.com/repos/joferkington/mpldatacursor/issues/42/labels{/name}","comments_url":"https://api.github.com/repos/joferkington/mpldatacursor/issues/42/comments","events_url":"https://api.github.com/repos/joferkington/mpldatacursor/issues/42/events","html_url":"https://github.com/joferkington/mpldatacursor/issues/42","id":104931893,"number":42,"title":"CGContext Ref is NULL","user":{"login":"jlopezbi","id":3253027,"avatar_url":"https://avatars.githubusercontent.com/u/3253027?v=3","gravatar_id":"","url":"https://api.github.com/users/jlopezbi","html_url":"https://github.com/jlopezbi","followers_url":"https://api.github.com/users/jlopezbi/followers","following_url":"https://api.github.com/users/jlopezbi/following{/other_user}","gists_url":"https://api.github.com/users/jlopezbi/gists{/gist_id}","starred_url":"https://api.github.com/users/jlopezbi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlopezbi/subscriptions","organizations_url":"https://api.github.com/users/jlopezbi/orgs","repos_url":"https://api.github.com/users/jlopezbi/repos","events_url":"https://api.github.com/users/jlopezbi/events{/privacy}","received_events_url":"https://api.github.com/users/jlopezbi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-04T17:17:12Z","updated_at":"2015-09-05T02:06:38Z","closed_at":null,"body":"Hey There, \r\njust wanted to let you know about this error (Ipython error message below). This occurs when I enter the first example code from the readme, and then click on a line in the plot. I am a new user of matplotlib and scipy/numpy so my apologies if I am missing something trivial.\r\nI am using python 2.7.8 matplotlib (1.4.3) and mpldatacursor (0.6.1)\r\n\r\ncheers for putting this out there!\r\n\r\n\r\nRuntimeError                              Traceback (most recent call last)\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backend_bases.pyc in button_press_event(self, x, y, button, dblclick, guiEvent)\r\n   1885         mouseevent = MouseEvent(s, self, x, y, button, self._key,\r\n   1886                                 dblclick=dblclick, guiEvent=guiEvent)\r\n-> 1887         self.callbacks.process(s, mouseevent)\r\n   1888 \r\n   1889     def button_release_event(self, x, y, button, guiEvent=None):\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/cbook.pyc in process(self, s, *args, **kwargs)\r\n    538                     del self.callbacks[s][cid]\r\n    539                 else:\r\n--> 540                     proxy(*args, **kwargs)\r\n    541 \r\n    542 \r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/cbook.pyc in __call__(self, *args, **kwargs)\r\n    413             mtd = self.func\r\n    414         # invoke the callable and return the result\r\n--> 415         return mtd(*args, **kwargs)\r\n    416 \r\n    417     def __eq__(self, other):\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mpldatacursor/datacursor.pyc in _select(self, event)\r\n    624                 new_event = PickEvent('pick_event', fig.canvas, fixed_event,\r\n    625                                      artist, **info)\r\n--> 626                 self(new_event)\r\n    627 \r\n    628         all_artists = itertools.chain(self.artists, self.annotations.values())\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mpldatacursor/datacursor.pyc in __call__(self, event)\r\n    246                 pass\r\n    247 \r\n--> 248             self._show_annotation_box(event)\r\n    249 \r\n    250     def _event_ignored(self, event):\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mpldatacursor/datacursor.pyc in _show_annotation_box(self, event)\r\n    286                 ann.set_visible(False)\r\n    287 \r\n--> 288         self.update(event, annotation)\r\n    289 \r\n    290     def event_info(self, event):\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mpldatacursor/datacursor.pyc in update(self, event, annotation)\r\n    546 \r\n    547         if self.keep_inside:\r\n--> 548             self._keep_annotation_inside(annotation)\r\n    549 \r\n    550         event.canvas.draw()\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mpldatacursor/datacursor.pyc in _keep_annotation_inside(self, anno)\r\n    554 \r\n    555         # Need to draw the annotation to get the correct extent\r\n--> 556         anno.draw(fig.canvas.renderer)\r\n    557         bbox = anno.get_window_extent()\r\n    558 \r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)\r\n     57     def draw_wrapper(artist, renderer, *args, **kwargs):\r\n     58         before(artist, renderer)\r\n---> 59         draw(artist, renderer, *args, **kwargs)\r\n     60         after(artist, renderer)\r\n     61 \r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/text.pyc in draw(self, renderer)\r\n   2071             return\r\n   2072 \r\n-> 2073         self._update_position_xytext(renderer, xy_pixel)\r\n   2074         self.update_bbox_position_size(renderer)\r\n   2075 \r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/text.pyc in _update_position_xytext(self, renderer, xy_pixel)\r\n   1936         if self.arrowprops:\r\n   1937             x0, y0 = xy_pixel\r\n-> 1938             l, b, w, h = Text.get_window_extent(self, renderer).bounds\r\n   1939             r = l + w\r\n   1940             t = b + h\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/text.pyc in get_window_extent(self, renderer, dpi)\r\n    796             raise RuntimeError('Cannot get window extent w/o renderer')\r\n    797 \r\n--> 798         bbox, info, descent = self._get_layout(self._renderer)\r\n    799         x, y = self.get_position()\r\n    800         x, y = self.get_transform().transform_point((x, y))\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/text.pyc in _get_layout(self, renderer)\r\n    309         tmp, lp_h, lp_bl = renderer.get_text_width_height_descent('lp',\r\n    310                                                          self._fontproperties,\r\n--> 311                                                          ismath=False)\r\n    312         offsety = (lp_h - lp_bl) * self._linespacing\r\n    313 \r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.pyc in get_text_width_height_descent(self, s, prop, ismath)\r\n    164         size = self.points_to_pixels(points)\r\n    165         width, height, descent = self.gc.get_text_width_height_descent(\r\n--> 166             six.text_type(s), family, size, weight, style)\r\n    167         return  width, height, 0.0*descent\r\n    168 \r\n\r\nRuntimeError: CGContextRef is NULL"},"comment":{"url":"https://api.github.com/repos/joferkington/mpldatacursor/issues/comments/137893366","html_url":"https://github.com/joferkington/mpldatacursor/issues/42#issuecomment-137893366","issue_url":"https://api.github.com/repos/joferkington/mpldatacursor/issues/42","id":137893366,"user":{"login":"tacaswell","id":199813,"avatar_url":"https://avatars.githubusercontent.com/u/199813?v=3","gravatar_id":"","url":"https://api.github.com/users/tacaswell","html_url":"https://github.com/tacaswell","followers_url":"https://api.github.com/users/tacaswell/followers","following_url":"https://api.github.com/users/tacaswell/following{/other_user}","gists_url":"https://api.github.com/users/tacaswell/gists{/gist_id}","starred_url":"https://api.github.com/users/tacaswell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tacaswell/subscriptions","organizations_url":"https://api.github.com/users/tacaswell/orgs","repos_url":"https://api.github.com/users/tacaswell/repos","events_url":"https://api.github.com/users/tacaswell/events{/privacy}","received_events_url":"https://api.github.com/users/tacaswell/received_events","type":"User","site_admin":false},"created_at":"2015-09-05T02:06:37Z","updated_at":"2015-09-05T02:06:37Z","body":"@mdehoon has method (currently merged to master) for getting around this issue for `tight_layout`.  I don't recall exactly how that code works so it might fix this as-is or provide a template for fixing this issue.\r\n\r\nThe underlying issue here is that on the Agg-based backends we can grab a graphics context and run a draw when every we want, where as in the OSX gui framework only lets you have a graphics context during it's draw callback when it is doing the actual re-draw for the screen."}}