MvvmCross vnext - Initialising IMvxGeoLocationWatcher problems - xamarin.ios
Continuing the journey into vnext...
I can now build the entire solution & run it successfully. However, when I try to initialise the IMvxGeoLocationWatcher, it crashes. The code & output are -
private IMvxGeoLocationWatcher _geoWatcher;
public void StartGettingLocation(Action<MvxCoordinates> response)
{
Log.Info("LocationService->StartGettingLocation");
// crashes on this line -
if (_geoWatcher == null) _geoWatcher = this.GetService<IMvxGeoLocationWatcher>();
Output -
Unhandled Exception:
0 MyApp 0x000797ae mono_handle_exception_internal_first_pass + 2190
1 MyApp 0x0007b1e2 mono_handle_exception_internal + 1602
2 MyApp 0x0007bd2f mono_handle_exception + 47
3 MyApp 0x000bce22 mono_x86_throw_exception + 306
4 ??? 0x07f30f8f 0x0 + 133369743
at System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:545
at System.Activator.CreateInstance (System.Type,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo,object[]) [0x00174] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:299
at System.Activator.CreateInstance (System.Type,object[],object[]) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:234
at System.Activator.CreateInstance (System.Type,object[]) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:229
at Cirrious.MvvmCross.Application.MvxDefaultViewModelLocator.TryLoad (System.Type,System.Collections.Generic.IDictionary2<string, string>,Cirrious.MvvmCross.Interfaces.ViewModels.IMvxViewModel&) <IL 0x00043, 0x000d8>
at Cirrious.MvvmCross.Application.MvxViewModelLoader.LoadViewModel (Cirrious.MvvmCross.Views.MvxShowViewModelRequest) <IL 0x0005b, 0x000a2>
at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods.LoadViewModel<TViewModel> (Cirrious.MvvmCross.Touch.Interfaces.IMvxTouchView1)
at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods/c__AnonStorey01.<>m__0 () <IL 0x00006, 0x00034>
at Cirrious.MvvmCross.ExtensionMethods.MvxViewExtensionMethods.OnViewCreate<TViewModel> (Cirrious.MvvmCross.Interfaces.Views.IMvxView1,System.Func1<TViewModel>) <IL 0x00012, 0x00045>
at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods.OnViewCreate<TViewModel> (Cirrious.MvvmCross.Touch.Interfaces.IMvxTouchView1)
at Cirrious.MvvmCross.Touch.Views.MvxTouchViewController`1.ViewDidLoad ()
at MyApp.UI.Touch.MainMenuViewController.ViewDidLoad () [0x00000] in /Users/franklyn/Documents/Programming/MyApp/MyApp.UI.Touch/Views/MainMenuViewController.cs:34
Edit - the rest of the exception trace:
at (wrapper runtime-invoke) object.runtime_invoke_void_this_ (object,intptr,intptr,intptr)
18 MyApp 0x00008732 mono_jit_runtime_invoke + 722
19 MyApp 0x0014f39e mono_runtime_invoke + 126
20 MyApp 0x001e6296 monotouch_trampoline + 3686
21 UIKit 0x00a4b817 -[UIViewController loadViewIfRequired] + 536
22 UIKit 0x00a4b882 -[UIViewController view] + 33
23 UIKit 0x00a4bb2a -[UIViewController contentScrollView] + 36
24 UIKit 0x00a62ef5 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 36
25 UIKit 0x00a62fdb -[UINavigationController _layoutViewController:] + 43
26 UIKit 0x00a63286 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 254
27 UIKit 0x00a63381 -[UINavigationController _startTransition:fromViewController:toViewController:] + 72
28 UIKit 0x00a63eab -[UINavigationController _startDeferredTransitionIfNeeded:] + 386
29 UIKit 0x00a63fc9 -[UINavigationController _startDeferredTransitionIfNeeded] + 41
30 UIKit 0x00a64055 -[UINavigationController viewWillLayoutSubviews] + 33
31 UIKit 0x00b693ab -[UILayoutContainerView layoutSubviews] + 233
32 UIKit 0x009ba92d -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 279
33 libobjc.A.dylib 0x022086b0 -[NSObject performSelector:withObject:] + 70
34 QuartzCore 0x01952fc0 -[CALayer layoutSublayers] + 240
35 QuartzCore 0x0194733c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 468
36 QuartzCore 0x01952eaf -[CALayer layoutIfNeeded] + 166
37 UIKit 0x00a598cd -[UIViewController window:setupWithInterfaceOrientation:] + 242
38 UIKit 0x009a21a6 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 5346
39 UIKit 0x009a0cbf -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82
40 UIKit 0x009a0bd9 -[UIWindow _setRotatableViewOrientation:duration:force:] + 89
41 UIKit 0x0099fe34 __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke_0 + 224
42 UIKit 0x0099fc6e -[UIWindow _updateToInterfaceOrientation:duration:force:] + 209
43 UIKit 0x009a0a29 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 853
44 UIKit 0x009a3922 -[UIWindow setDelegate:] + 351
45 UIKit 0x00a4dfec -[UIViewController _tryBecomeRootViewControllerInWindow:] + 164
46 UIKit 0x0099abc4 -[UIWindow addRootViewControllerViewIfPossible] + 481
47 UIKit 0x0099adbf -[UIWindow _setHidden:forced:] + 368
48 UIKit 0x0099af55 -[UIWindow _orderFrontWithoutMakingKey] + 49
49 UIKit 0x009a3f67 -[UIWindow makeKeyAndVisible] + 65
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend (intptr,intptr)
at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x00008] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:126
at MyApp.UI.Touch.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication,MonoTouch.Foundation.NSDictionary) [0x0003b] in /Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/OtherClasses/AppDelegate.cs:46
at (wrapper runtime-invoke) .runtime_invoke_bool__this_object_object (object,intptr,intptr,intptr)
54 MyApp 0x00008732 mono_jit_runtime_invoke + 722
55 MyApp 0x0014f39e mono_runtime_invoke + 126
56 MyApp 0x001e6296 monotouch_trampoline + 3686
57 UIKit 0x009677b7 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 266
58 UIKit 0x00967da7 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1248
59 UIKit 0x00968fab -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 805
60 UIKit 0x0097a315 -[UIApplication handleEvent:withNewEvent:] + 1022
61 UIKit 0x0097b24b -[UIApplication sendEvent:] + 85
62 UIKit 0x0096ccf8 _UIApplicationHandleEvent + 9874
63 GraphicsServices 0x02c98df9 _PurpleEventCallback + 339
64 GraphicsServices 0x02c98ad0 PurpleEventCallback + 46
65 CoreFoundation 0x01f34bf5 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 53
66 CoreFoundation 0x01f34962 __CFRunLoopDoSource1 + 146
67 CoreFoundation 0x01f65bb6 __CFRunLoopRun + 2118
68 CoreFoundation 0x01f64f44 CFRunLoopRunSpecific + 276
69 CoreFoundation 0x01f64e1b CFRunLoopRunInMode + 123
70 UIKit 0x009687da -[UIApplication _run] + 774
71 UIKit 0x0096a65c UIApplicationMain + 1211
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
at MyApp.UI.Touch.Application.Main (string[]) [0x00000] in /Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/OtherClasses/Main.cs:17
at (wrapper runtime-invoke) .runtime_invoke_void_object (object,intptr,intptr,intptr)
76 MyApp 0x00008732 mono_jit_runtime_invoke + 722
77 MyApp 0x0014f39e mono_runtime_invoke + 126
78 MyApp 0x001534c4 mono_runtime_exec_main + 420
79 MyApp 0x00157ff5 mono_runtime_run_main + 725
80 MyApp 0x000651a5 mono_jit_exec + 149
81 MyApp 0x001db7b5 main + 2005
82 MyApp 0x000021f5 start + 53
2013-03-25 08:12:00.009 MyApp[7906:12203] Unhandled managed exception: Exception has been thrown by the target of an invocation. (System.Reflection.TargetInvocationException)
at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0011f] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:536
at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:545
at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00174] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:299
at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:234
at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Activator.cs:229
at Cirrious.MvvmCross.Application.MvxDefaultViewModelLocator.TryLoad (System.Type viewModelType, IDictionary2 parameterValueLookup, IMvxViewModel& model) [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Application.MvxViewModelLoader.LoadViewModel (Cirrious.MvvmCross.Views.MvxShowViewModelRequest request) [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods.LoadViewModel[MainMenuViewModel] (IMvxTouchView1 touchView) [0x00000] in :0
at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods+c__AnonStorey01[MyApp.Core.ViewModels.MainMenuViewModel].<>m__0 () [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.ExtensionMethods.MvxViewExtensionMethods.OnViewCreate[MainMenuViewModel] (IMvxView1 view, System.Func1 viewModelLoader) [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Touch.ExtensionMethods.MvxTouchViewControllerExtensionMethods.OnViewCreate[MainMenuViewModel] (IMvxTouchView1 touchView) [0x00000] in :0
at Cirrious.MvvmCross.Touch.Views.MvxTouchViewController`1[MyApp.Core.ViewModels.MainMenuViewModel].ViewDidLoad () [0x00000] in :0
at MyApp.UI.Touch.MainMenuViewController.ViewDidLoad () [0x00000] in /Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/Views/MainMenuViewController.cs:34
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend (intptr,intptr)
at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x00008] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIWindow.g.cs:126
at MyApp.UI.Touch.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x0003b] in /Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/OtherClasses/AppDelegate.cs:46
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
at MyApp.UI.Touch.Application.Main (System.String[] args) [0x00000] in /Users/franklynweber/Documents/Programming/MyApp/MyApp.UI.Touch/OtherClasses/Main.cs:17
Stacktrace:
Native stacktrace:
0 MyApp 0x0007bf6c mono_handle_native_sigsegv + 284
1 MyApp 0x000c01ad sigabrt_signal_handler + 109
2 libsystem_c.dylib 0x9a5da59b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 libsystem_sim_c.dylib 0x0297457b abort + 140
5 MyApp 0x001ed17b monotouch_unhandled_exception_handler + 283
6 MyApp 0x00077dbc mono_invoke_unhandled_exception_hook + 140
7 MyApp 0x0007bbda mono_handle_exception_internal + 4154
8 MyApp 0x0007bd2f mono_handle_exception + 47
9 MyApp 0x000bce22 mono_x86_throw_exception + 306
10 ??? 0x07f30f8f 0x0 + 133369743
11 ??? 0x0bad1a5d 0x0 + 195893853
12 ??? 0x0bad13dd 0x0 + 195892189
13 ??? 0x0bad1164 0x0 + 195891556
14 ??? 0x0bad112c 0x0 + 195891500
15 ??? 0x11b0a360 0x0 + 296788832
16 ??? 0x11b09fca 0x0 + 296787914
17 ??? 0x11b09de2 0x0 + 296787426
18 ??? 0x11b09cf4 0x0 + 296787188
19 ??? 0x11b09c65 0x0 + 296787045
20 ??? 0x11b09b60 0x0 + 296786784
21 ??? 0x11b09a5c 0x0 + 296786524
22 ??? 0x11b099c4 0x0 + 296786372
23 ??? 0x07fe2059 0x0 + 134094937
24 MyApp 0x00008732 mono_jit_runtime_invoke + 722
25 MyApp 0x0014f39e mono_runtime_invoke + 126
26 MyApp 0x001e6296 monotouch_trampoline + 3686
27 UIKit 0x00a4b817 -[UIViewController loadViewIfRequired] + 536
28 UIKit 0x00a4b882 -[UIViewController view] + 33
29 UIKit 0x00a4bb2a -[UIViewController contentScrollView] + 36
30 UIKit 0x00a62ef5 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 36
31 UIKit 0x00a62fdb -[UINavigationController _layoutViewController:] + 43
32 UIKit 0x00a63286 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 254
33 UIKit 0x00a63381 -[UINavigationController _startTransition:fromViewController:toViewController:] + 72
34 UIKit 0x00a63eab -[UINavigationController _startDeferredTransitionIfNeeded:] + 386
35 UIKit 0x00a63fc9 -[UINavigationController _startDeferredTransitionIfNeeded] + 41
36 UIKit 0x00a64055 -[UINavigationController __viewWillLayoutSubviews] + 33
37 UIKit 0x00b693ab -[UILayoutContainerView layoutSubviews] + 233
38 UIKit 0x009ba92d -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 279
39 libobjc.A.dylib 0x022086b0 -[NSObject performSelector:withObject:] + 70
40 QuartzCore 0x01952fc0 -[CALayer layoutSublayers] + 240
41 QuartzCore 0x0194733c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 468
42 QuartzCore 0x01952eaf -[CALayer layoutIfNeeded] + 166
43 UIKit 0x00a598cd -[UIViewController window:setupWithInterfaceOrientation:] + 242
44 UIKit 0x009a21a6 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 5346
45 UIKit 0x009a0cbf -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82
46 UIKit 0x009a0bd9 -[UIWindow _setRotatableViewOrientation:duration:force:] + 89
47 UIKit 0x0099fe34 __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke_0 + 224
48 UIKit 0x0099fc6e -[UIWindow _updateToInterfaceOrientation:duration:force:] + 209
49 UIKit 0x009a0a29 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 853
50 UIKit 0x009a3922 -[UIWindow setDelegate:] + 351
51 UIKit 0x00a4dfec -[UIViewController _tryBecomeRootViewControllerInWindow:] + 164
52 UIKit 0x0099abc4 -[UIWindow addRootViewControllerViewIfPossible] + 481
53 UIKit 0x0099adbf -[UIWindow _setHidden:forced:] + 368
54 UIKit 0x0099af55 -[UIWindow _orderFrontWithoutMakingKey] + 49
55 UIKit 0x009a3f67 -[UIWindow makeKeyAndVisible] + 65
56 ??? 0x11aee564 0x0 + 296674660
57 ??? 0x11b099a8 0x0 + 296786344
58 ??? 0x0bad24ee 0x0 + 195896558
59 ??? 0x0bad25df 0x0 + 195896799
60 MyApp 0x00008732 mono_jit_runtime_invoke + 722
61 MyApp 0x0014f39e mono_runtime_invoke + 126
62 MyApp 0x001e6296 monotouch_trampoline + 3686
63 UIKit 0x009677b7 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 266
64 UIKit 0x00967da7 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1248
65 UIKit 0x00968fab -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 805
66 UIKit 0x0097a315 -[UIApplication handleEvent:withNewEvent:] + 1022
67 UIKit 0x0097b24b -[UIApplication sendEvent:] + 85
68 UIKit 0x0096ccf8 _UIApplicationHandleEvent + 9874
69 GraphicsServices 0x02c98df9 _PurpleEventCallback + 339
70 GraphicsServices 0x02c98ad0 PurpleEventCallback + 46
71 CoreFoundation 0x01f34bf5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
72 CoreFoundation 0x01f34962 __CFRunLoopDoSource1 + 146
73 CoreFoundation 0x01f65bb6 __CFRunLoopRun + 2118
74 CoreFoundation 0x01f64f44 CFRunLoopRunSpecific + 276
75 CoreFoundation 0x01f64e1b CFRunLoopRunInMode + 123
76 UIKit 0x009687da -[UIApplication _run] + 774
77 UIKit 0x0096a65c UIApplicationMain + 1211
78 ??? 0x0bacf84c 0x0 + 195885132
79 ??? 0x0bace218 0x0 + 195879448
80 ??? 0x0bacdfb0 0x0 + 195878832
81 ??? 0x0bace03f 0x0 + 195878975
82 MyApp 0x00008732 mono_jit_runtime_invoke + 722
83 MyApp 0x0014f39e mono_runtime_invoke + 126
84 MyApp 0x001534c4 mono_runtime_exec_main + 420
85 MyApp 0x00157ff5 mono_runtime_run_main + 725
86 MyApp 0x000651a5 mono_jit_exec + 149
87 MyApp 0x001db7b5 main + 2005
88 MyApp 0x000021f5 start + 53
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
Thanks for any help.
Without the inner exception it's hard to know what has gone wrong - sorry.
I'd guess that there is some problem in initializing the geowatcher - either because:
the plugin isn't registered
you call this line before you've called Cirrious.MvvmCross.Plugins.Location.PluginLoader.Instance.EnsureLoaded()
or because of some 'app specific reason'.
The tutorial app uses the location plugin in: https://github.com/slodge/MvvmCross/tree/vnext/Sample%20-%20Tutorial/Tutorial/Tutorial.UI.Touch
Does the tutorial work for you? If it does, then you'll maybe need to look at comparing the two.
If the crash persists for you, then maybe:
- post the inner exception if you can?
- or post a small repo which demos the problem - I'd certainly need more code than I can see in this 2 line snippet.
Sorry for the lack of documentation. I am making a huge effort right now to create proper documents and tutorials for the new v3 released - but this is all self-funded!
Related
ValueError: zero-size array to reduction operation minimum which has no identity - Seaborn
The below code suddenly stated producing error. It was working fine earlier. I just reinstalled seaborn package. plt.figure(figsize=(26,16)) sns.scatterplot( x="tsne-2d-one", y="tsne-2d-two", hue="label", palette=sns.color_palette("hls", 14), data=df_subset, legend="full", alpha=1, s=100 ) Traceback: --------------------------------------------------------------------------- ValueError Traceback (most recent call last) c:\<path>_venv\lib\site-packages\IPython\core\formatters.py in __call__(self, obj) 339 pass 340 else: --> 341 return printer(obj) 342 # Finally look for special method names 343 method = get_real_method(obj, self.print_method) c:\<path>_venv\lib\site-packages\IPython\core\pylabtools.py in <lambda>(fig) 246 247 if 'png' in formats: --> 248 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs)) 249 if 'retina' in formats or 'png2x' in formats: 250 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs)) c:\<path>_venv\lib\site-packages\IPython\core\pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs) 130 FigureCanvasBase(fig) 131 --> 132 fig.canvas.print_figure(bytes_io, **kw) 133 data = bytes_io.getvalue() 134 if fmt == 'svg': c:\<path>_venv\lib\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs) 2191 else suppress()) 2192 with ctx: -> 2193 self.figure.draw(renderer) 2194 2195 bbox_inches = self.figure.get_tightbbox( c:\<path>_venv\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 39 renderer.start_filter() 40 ---> 41 return draw(artist, renderer, *args, **kwargs) 42 finally: 43 if artist.get_agg_filter() is not None: c:\<path>_venv\lib\site-packages\matplotlib\figure.py in draw(self, renderer) 1861 1862 self.patch.draw(renderer) -> 1863 mimage._draw_list_compositing_images( 1864 renderer, self, artists, self.suppressComposite) 1865 c:\<path>_venv\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite) 129 if not_composite or not has_images: 130 for a in artists: --> 131 a.draw(renderer) 132 else: 133 # Composite any adjacent images together c:\<path>_venv\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 39 renderer.start_filter() 40 ---> 41 return draw(artist, renderer, *args, **kwargs) 42 finally: 43 if artist.get_agg_filter() is not None: c:\<path>_venv\lib\site-packages\matplotlib\cbook\deprecation.py in wrapper(*inner_args, **inner_kwargs) 409 else deprecation_addendum, 410 **kwargs) --> 411 return func(*inner_args, **inner_kwargs) 412 413 return wrapper c:\<path>_venv\lib\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe) 2746 renderer.stop_rasterizing() 2747 -> 2748 mimage._draw_list_compositing_images(renderer, self, artists) 2749 2750 renderer.close_group('axes') c:\<path>_venv\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite) 129 if not_composite or not has_images: 130 for a in artists: --> 131 a.draw(renderer) 132 else: 133 # Composite any adjacent images together c:\<path>_venv\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 39 renderer.start_filter() 40 ---> 41 return draw(artist, renderer, *args, **kwargs) 42 finally: 43 if artist.get_agg_filter() is not None: c:\<path>_venv\lib\site-packages\matplotlib\collections.py in draw(self, renderer) 929 def draw(self, renderer): 930 self.set_sizes(self._sizes, self.figure.dpi) --> 931 Collection.draw(self, renderer) 932 933 c:\<path>_venv\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 39 renderer.start_filter() 40 ---> 41 return draw(artist, renderer, *args, **kwargs) 42 finally: 43 if artist.get_agg_filter() is not None: c:\<path>_venv\lib\site-packages\matplotlib\collections.py in draw(self, renderer) 383 else: 384 combined_transform = transform --> 385 extents = paths[0].get_extents(combined_transform) 386 if (extents.width < self.figure.bbox.width 387 and extents.height < self.figure.bbox.height): c:\<path>_venv\lib\site-packages\matplotlib\path.py in get_extents(self, transform, **kwargs) 601 xys.append(curve([0, *dzeros, 1])) 602 xys = np.concatenate(xys) --> 603 return Bbox([xys.min(axis=0), xys.max(axis=0)]) 604 605 def intersects_path(self, other, filled=True): c:\<path>_venv\lib\site-packages\numpy\core\_methods.py in _amin(a, axis, out, keepdims, initial, where) 32 def _amin(a, axis=None, out=None, keepdims=False, 33 initial=_NoValue, where=True): ---> 34 return umr_minimum(a, axis, None, out, keepdims, initial, where) 35 36 def _sum(a, axis=None, dtype=None, out=None, keepdims=False, ValueError: zero-size array to reduction operation minimum which has no identity Note: df_subset is not empty, I checked. It has 3 columns "tsne-2d-one", "tsne-2d-two", "label" "tsne-2d-one", "tsne-2d-two" contains float datatype values "label" has String/Object data type values Sample data: tsne-2d-one,tsne-2d-two,label -14.02892,-24.425629,A_A-A -13.000096,-23.515806,A_A-A -14.205202,-24.717735,A_A-A -15.494256,-25.991783,A_A-A -13.5905905,-23.419744,A_A-A -13.350816,-25.939915,A_A-A -12.438069,-24.727852,A_A-A -13.54109,-26.080505,A_A-A -14.834715,-26.33772,A_A-A -13.562927,-23.37612,A_A-A -15.59718,-24.024368,A_A-A -14.931401,-22.854977,A_A-A -15.655616,-24.41179,A_A-A -15.716855,-25.620882,A_A-A -15.219434,-23.031553,A_A-A 2.084894,-14.178911,B_B 5.5166216,-12.401592,B_B 2.0064962,-14.086351,B_B 5.5460343,1.7539215,B_B 5.002867,-13.499105,B_B -0.13123433,0.9796202,B_B 7.7138877,-7.102608,B_B -0.119276464,0.99467605,B_B 6.679522,1.4599445,B_B 4.96602,-13.200384,B_B 9.150655,-3.64276,B_B 10.205461,-6.4425406,B_B 9.038797,-3.5547273,B_B 7.0086393,1.1566005,B_B 9.934251,-6.873103,B_B -11.11679,-11.341377,C_C C -14.512915,-8.015724,C_C C -9.953341,-11.557578,C_C C -16.696735,-6.1155863,C_C C -15.87594,-8.795022,C_C C -11.377112,-14.174167,C_C C -13.324324,-9.64841,C_C C -11.897048,-13.814134,C_C C -16.109194,-11.869152,C_C C -16.046644,-8.998125,C_C C -9.286824,-14.231626,C_C C -12.704834,-7.5153055,C_C C -9.349987,-13.253436,C_C C -18.200735,-7.0271044,C_C C -12.994204,-6.0151153,C_C C -3.0917523,-10.06981,D_D_1 4.6217837,-10.767031,D_D_1 -3.1154654,-10.096936,D_D_1 5.0603623,1.1476644,D_D_1 3.369002,-11.283088,D_D_1 -5.780945,-7.966547,D_D_1 6.6392574,-8.486886,D_D_1 -5.7979536,-7.9725084,D_D_1 5.7012763,0.1932977,D_D_1 3.4227533,-11.3441305,D_D_1 -4.905956,-10.156104,D_D_1 5.8067675,-9.307196,D_D_1 -4.96808,-10.07095,D_D_1 6.28622,0.08598101,D_D_1 5.3993483,-9.526921,D_D_1 -11.131304,-11.375446,E_E_E -14.445314,-8.006492,E_E_E -9.945171,-11.480152,E_E_E -16.731579,-6.1148796,E_E_E -15.929554,-8.714455,E_E_E -11.266886,-14.26166,E_E_E -13.352065,-9.705651,E_E_E -12.172098,-13.885426,E_E_E -15.697548,-11.84327,E_E_E -15.805679,-8.887896,E_E_E -9.271222,-14.296528,E_E_E -12.608987,-7.5177,E_E_E -9.163923,-13.434417,E_E_E -18.181078,-6.843873,E_E_E -12.912988,-6.0278206,E_E_E -1.5422965,-7.8732953,F_F_F 3.1139162,-8.750587,F_F_F -2.028107,-7.784009,F_F_F 2.9877954,-1.4773916,F_F_F 1.7015373,-9.468788,F_F_F -4.2344203,-5.2941556,F_F_F 5.2705426,-6.563142,F_F_F -4.2245245,-5.600589,F_F_F 4.684833,-1.3839812,F_F_F 1.722953,-9.421918,F_F_F -1.1982858,-4.9888654,F_F_F 3.6919396,-6.494554,F_F_F -2.0073545,-5.178361,F_F_F 3.9441528,-2.738101,F_F_F 2.5451581,-6.1722994,F_F_F -1.120436,-7.3399386,G_G_G_G 2.8947587,-8.145696,G_G_G_G -1.4918948,-7.1562057,G_G_G_G 2.9648385,-1.7110974,G_G_G_G 1.5439045,-8.104277,G_G_G_G -3.5719488,-4.901991,G_G_G_G 4.9950256,-6.279537,G_G_G_G -3.4592612,-5.118906,G_G_G_G 4.573509,-1.6888899,G_G_G_G 1.4670004,-8.103425,G_G_G_G -1.326964,-4.7369046,G_G_G_G 3.5509024,-6.1993237,G_G_G_G -1.9852517,-4.7963614,G_G_G_G 3.8905938,-2.847331,G_G_G_G 2.3077533,-6.1591887,G_G_G_G -0.6611299,14.413035,H_H 1.6424932,16.130213,H_H -0.7701603,14.268575,H_H 2.9109209,8.180244,H_H 0.5201868,15.787671,H_H -1.6890637,12.033475,H_H 2.8793135,16.313625,H_H -1.6425153,11.930886,H_H 4.051731,8.0262375,H_H 0.43125528,15.851444,H_H -0.049206052,12.614705,H_H 2.4294627,15.448605,H_H -0.1478604,12.405042,H_H 3.6674721,8.151972,H_H 1.3558089,14.236326,H_H -11.285671,15.540629,I_I_I -9.562131,15.355534,I_I_I -11.530592,15.769008,I_I_I -13.046774,14.795182,I_I_I -10.370458,15.011783,I_I_I -12.224443,17.218636,I_I_I -9.128062,16.107723,I_I_I -12.329284,17.033316,I_I_I -13.2455635,15.28421,I_I_I -10.374858,15.010645,I_I_I -11.048521,17.406425,I_I_I -9.423859,16.605726,I_I_I -11.302727,17.159101,I_I_I -13.303642,14.898152,I_I_I -10.067334,17.044987,I_I_I 19.458284,3.601622,J_J 18.161573,1.9801935,J_J 19.400095,4.1047544,J_J 16.417835,5.31509,J_J 18.94254,2.32699,J_J 18.529085,4.935621,J_J 16.578032,2.6348052,J_J 18.3073,5.0299187,J_J 16.369411,4.8019056,J_J 18.929241,2.3260906,J_J 18.18062,3.939813,J_J 16.98714,2.6408002,J_J 17.972517,4.1568704,J_J 16.239166,4.6899467,J_J 17.585348,2.8919232,J_J -20.025661,8.026763,K_K_K -20.538462,6.0866313,K_K_K -19.686363,8.2460785,K_K_K -18.748287,9.191302,K_K_K -20.795744,7.023851,K_K_K -17.74393,7.074227,K_K_K -19.303535,5.2147784,K_K_K -17.688332,7.3439727,K_K_K -17.846653,8.789439,K_K_K -20.777353,7.0788684,K_K_K -18.925882,7.140357,K_K_K -19.634892,5.644755,K_K_K -18.661663,7.5221934,K_K_K -18.29901,8.960838,K_K_K -19.38654,6.43482,K_K_K 13.265437,15.976807,L_L_L 13.597595,19.052914,L_L_L 13.323307,16.138601,L_L_L 12.454088,17.811083,L_L_L 13.339949,19.46192,L_L_L 14.46764,15.587214,L_L_L 14.454488,18.439106,L_L_L 14.335033,15.607529,L_L_L 12.673782,17.41954,L_L_L 13.322454,19.446009,L_L_L 15.088017,16.46231,L_L_L 15.003597,18.347887,L_L_L 14.939234,16.422993,L_L_L 13.032935,17.582718,L_L_L 15.379603,18.11169,L_L_L 2.9893792,11.708033,M_M 4.0582185,14.155455,M_M 2.8813481,11.428211,M_M 2.9041388,8.880342,M_M 4.0471163,13.003807,M_M -0.24122916,10.381815,M_M 3.4628656,15.878884,M_M -0.17790422,10.348041,M_M 4.228249,8.942132,M_M 4.1144986,13.007208,M_M 1.0553777,11.241994,M_M 3.0545413,14.678934,M_M 1.1478767,10.947674,M_M 3.724015,9.194509,M_M 2.356918,13.5421915,M_M 19.131111,-8.112185,N_N_N 20.842833,-8.569077,N_N_N 19.030348,-8.294446,N_N_N 22.435442,-8.890868,N_N_N 20.483664,-8.155657,N_N_N 18.633186,-9.510608,N_N_N 20.852346,-9.7075,N_N_N 18.776926,-9.64985,N_N_N 22.413244,-9.279601,N_N_N 20.41144,-8.146459,N_N_N 19.47922,-10.565168,N_N_N 20.925726,-10.302838,N_N_N 19.37557,-10.4150505,N_N_N 22.429592,-9.683258,N_N_N 20.584888,-10.687437,N_N_N
Problem is related to a matplotlib regression in 3.3.1. Original seaborn issue (closed) Solution is to pin matplotlib to 3.3.0 until 3.3.2 is released, although the next release of seaborn will include a workaround. Update (9/10/20): Seaborn 0.11.0 is now available that contains the workaround to make scatterplots work even with matplotlib 3.3.1.
I've noticed the same error mentioned originally by #Hitsesh Somani is occurring even for some of the example code snippets given on Seaborn's official site (https://seaborn.pydata.org/generated/seaborn.scatterplot.html). For example the below example, copied and pasted directly from Seaborn, gives the same error as mentioned by #Hitesh Somani: import seaborn as sns; sns.set() import matplotlib.pyplot as plt tips = sns.load_dataset("tips") ax = sns.scatterplot(x="total_bill", y="tip", hue="time", data=tips) the above will return the following error: --------------------------------------------------------------------------- ValueError Traceback (most recent call last) c:\users\will\desktop\new folder\tester\lib\site-packages\IPython\core\formatters.py in __call__(self, obj) 339 pass 340 else: --> 341 return printer(obj) 342 # Finally look for special method names 343 method = get_real_method(obj, self.print_method) c:\users\will\desktop\new folder\tester\lib\site-packages\IPython\core\pylabtools.py in <lambda>(fig) 246 247 if 'png' in formats: --> 248 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs)) 249 if 'retina' in formats or 'png2x' in formats: 250 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs)) c:\users\will\desktop\new folder\tester\lib\site-packages\IPython\core\pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs) 130 FigureCanvasBase(fig) 131 --> 132 fig.canvas.print_figure(bytes_io, **kw) 133 data = bytes_io.getvalue() 134 if fmt == 'svg': c:\users\will\desktop\new folder\tester\lib\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs) 2191 else suppress()) 2192 with ctx: -> 2193 self.figure.draw(renderer) 2194 2195 bbox_inches = self.figure.get_tightbbox( c:\users\will\desktop\new folder\tester\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 39 renderer.start_filter() 40 ---> 41 return draw(artist, renderer, *args, **kwargs) 42 finally: 43 if artist.get_agg_filter() is not None: c:\users\will\desktop\new folder\tester\lib\site-packages\matplotlib\figure.py in draw(self, renderer) 1861 1862 self.patch.draw(renderer) -> 1863 mimage._draw_list_compositing_images( 1864 renderer, self, artists, self.suppressComposite) 1865 c:\users\will\desktop\new folder\tester\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite) 129 if not_composite or not has_images: 130 for a in artists: --> 131 a.draw(renderer) 132 else: 133 # Composite any adjacent images together c:\users\will\desktop\new folder\tester\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 39 renderer.start_filter() 40 ---> 41 return draw(artist, renderer, *args, **kwargs) 42 finally: 43 if artist.get_agg_filter() is not None: c:\users\will\desktop\new folder\tester\lib\site-packages\matplotlib\cbook\deprecation.py in wrapper(*inner_args, **inner_kwargs) 409 else deprecation_addendum, 410 **kwargs) --> 411 return func(*inner_args, **inner_kwargs) 412 413 return wrapper c:\users\will\desktop\new folder\tester\lib\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe) 2746 renderer.stop_rasterizing() 2747 -> 2748 mimage._draw_list_compositing_images(renderer, self, artists) 2749 2750 renderer.close_group('axes') c:\users\will\desktop\new folder\tester\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite) 129 if not_composite or not has_images: 130 for a in artists: --> 131 a.draw(renderer) 132 else: 133 # Composite any adjacent images together c:\users\will\desktop\new folder\tester\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 39 renderer.start_filter() 40 ---> 41 return draw(artist, renderer, *args, **kwargs) 42 finally: 43 if artist.get_agg_filter() is not None: c:\users\will\desktop\new folder\tester\lib\site-packages\matplotlib\collections.py in draw(self, renderer) 929 def draw(self, renderer): 930 self.set_sizes(self._sizes, self.figure.dpi) --> 931 Collection.draw(self, renderer) 932 933 c:\users\will\desktop\new folder\tester\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 39 renderer.start_filter() 40 ---> 41 return draw(artist, renderer, *args, **kwargs) 42 finally: 43 if artist.get_agg_filter() is not None: c:\users\will\desktop\new folder\tester\lib\site-packages\matplotlib\collections.py in draw(self, renderer) 383 else: 384 combined_transform = transform --> 385 extents = paths[0].get_extents(combined_transform) 386 if (extents.width < self.figure.bbox.width 387 and extents.height < self.figure.bbox.height): c:\users\will\desktop\new folder\tester\lib\site-packages\matplotlib\path.py in get_extents(self, transform, **kwargs) 601 xys.append(curve([0, *dzeros, 1])) 602 xys = np.concatenate(xys) --> 603 return Bbox([xys.min(axis=0), xys.max(axis=0)]) 604 605 def intersects_path(self, other, filled=True): c:\users\will\desktop\new folder\tester\lib\site-packages\numpy\core\_methods.py in _amin(a, axis, out, keepdims, initial, where) 41 def _amin(a, axis=None, out=None, keepdims=False, 42 initial=_NoValue, where=True): ---> 43 return umr_minimum(a, axis, None, out, keepdims, initial, where) 44 45 def _sum(a, axis=None, dtype=None, out=None, keepdims=False, ValueError: zero-size array to reduction operation minimum which has no identity <Figure size 432x288 with 1 Axes> Where I'm on a Windows 10 machine, with: jupyter core==4.6.3 jupyter-notebook==6.1.3 ipython==7.18.1 matplotlib==3.3.1 numpy==1.19.1 pandas==1.1.1 seaborn==0.10.1 and Python v3.8.5.
Seconding #Brock, there is an error in the matplotlib regression. Changing back to matplotlib 3.3.0, with the conda command below, solved the problem for me. conda install -c conda-forge matplotlib=3.3.0
matplotlib plot negative num in diffrent color
I want use red and green to distinguish positive and negative num which will be used abs(num) in one picture. I search on web and find some method to deal with it. but the result is error. I paste the code and wish sb. to help. "df_combine" file like this: t o h l c nu octime ocsize cum_size 0 2017-07-02 22:01:00 1241.65 1241.85 1241.63 1241.85 0 2017-07-02 22:01:32 32 32 1 2017-07-02 22:02:00 1241.95 1241.95 1241.85 1241.95 0 2017-07-02 22:02:00 -24 12 2 2017-07-02 22:03:00 1242.05 1242.15 1242.05 1242.15 0 2017-07-02 22:03:00 -48 -36 3 2017-07-02 22:04:00 1242.25 1242.25 1242.16 1242.17 0 2017-07-02 22:04:00 -100 -136 4 2017-07-02 22:05:00 1242.16 1242.57 1241.85 1242.57 0 2017-07-02 22:05:00 200 64 holding_info file like this: cum_size factor 0 32.0 True 1 12.0 True 2 -36.0 False 3 -136.0 False 4 64.0 True code like this: import pandas as pd import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt t=df_combine.iloc[:,0] o=df_combine.iloc[:,1] h=df_combine.iloc[:,2] l=df_combine.iloc[:,3] c=df_combine.iloc[:,4] holding_octime=df_combine['t'] holding_size=df_combine['cum_size'] ##df_cumbine is a DataFrame holding_info=pd.Series.to_frame(holding_size) holding_info['factor']=holding_info['cum_size']>0 fig,ax1=plt.subplots() ax1.plot_date(t,o,linestyle='--',color='b',marker='D',alpha=0.6) ##t,o,h,l,c are pd.Series which contains time and price ax1.plot_date(t,c,linestyle='--',color='k',marker='D',alpha=0.6) ax1.plot_date(t,h,color='g',marker='^',alpha=0.3) ax1.plot_date(t,l,color='r',marker='v',alpha=0.3) ax2=ax1.twinx() ax2.plot_date(holding_octime,abs(holding_size),color=holding_info.factor.map({True:'r', False:'k'})) ##octime is a pd.Series which contains time dformat=mpl.dates.DateFormatter('%Y.%m.%d %H:%M') ax1.xaxis.set_major_formatter(dformat) fig.autofmt_xdate() plt.show() find error like this: > --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) C:\Anaconda3\lib\site-packages\IPython\core\formatters.py in __call__(self, obj) 305 pass 306 else: --> 307 return printer(obj) 308 # Finally look for special method names 309 method = get_real_method(obj, self.print_method) C:\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in <lambda>(fig) 238 239 if 'png' in formats: --> 240 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs)) 241 if 'retina' in formats or 'png2x' in formats: 242 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs)) C:\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs) 122 123 bytes_io = BytesIO() --> 124 fig.canvas.print_figure(bytes_io, **kw) 125 data = bytes_io.getvalue() 126 if fmt == 'svg': C:\Anaconda3\lib\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs) 2198 orientation=orientation, 2199 dryrun=True, -> 2200 **kwargs) 2201 renderer = self.figure._cachedRenderer 2202 bbox_inches = self.figure.get_tightbbox(renderer) C:\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs) 543 544 def print_png(self, filename_or_obj, *args, **kwargs): --> 545 FigureCanvasAgg.draw(self) 546 renderer = self.get_renderer() 547 original_dpi = renderer.dpi C:\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in draw(self) 462 463 try: --> 464 self.figure.draw(self.renderer) 465 finally: 466 RendererAgg.lock.release() C:\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 61 def draw_wrapper(artist, renderer, *args, **kwargs): 62 before(artist, renderer) ---> 63 draw(artist, renderer, *args, **kwargs) 64 after(artist, renderer) 65 C:\Anaconda3\lib\site-packages\matplotlib\figure.py in draw(self, renderer) 1142 1143 mimage._draw_list_compositing_images( -> 1144 renderer, self, dsu, self.suppressComposite) 1145 1146 renderer.close_group('figure') C:\Anaconda3\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, dsu, suppress_composite) 137 if not_composite or not has_images: 138 for zorder, a in dsu: --> 139 a.draw(renderer) 140 else: 141 # Composite any adjacent images together C:\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 61 def draw_wrapper(artist, renderer, *args, **kwargs): 62 before(artist, renderer) ---> 63 draw(artist, renderer, *args, **kwargs) 64 after(artist, renderer) 65 C:\Anaconda3\lib\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe) 2424 renderer.stop_rasterizing() 2425 -> 2426 mimage._draw_list_compositing_images(renderer, self, dsu) 2427 2428 renderer.close_group('axes') C:\Anaconda3\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, dsu, suppress_composite) 137 if not_composite or not has_images: 138 for zorder, a in dsu: --> 139 a.draw(renderer) 140 else: 141 # Composite any adjacent images together C:\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 61 def draw_wrapper(artist, renderer, *args, **kwargs): 62 before(artist, renderer) ---> 63 draw(artist, renderer, *args, **kwargs) 64 after(artist, renderer) 65 C:\Anaconda3\lib\site-packages\matplotlib\lines.py in draw(self, renderer) 826 gc = renderer.new_gc() 827 self._set_gc_clip(gc) --> 828 rgbaFace = self._get_rgba_face() 829 rgbaFaceAlt = self._get_rgba_face(alt=True) 830 edgecolor = self.get_markeredgecolor() C:\Anaconda3\lib\site-packages\matplotlib\lines.py in _get_rgba_face(self, alt) 1335 def _get_rgba_face(self, alt=False): 1336 facecolor = self._get_markerfacecolor(alt=alt) -> 1337 if is_string_like(facecolor) and facecolor.lower() == 'none': 1338 rgbaFace = None 1339 else: C:\Anaconda3\lib\site-packages\pandas\core\generic.py in __getattr__(self, name) 2968 if name in self._info_axis: 2969 return self[name] -> 2970 return object.__getattribute__(self, name) 2971 2972 def __setattr__(self, name, value): AttributeError: 'Series' object has no attribute 'lower' <matplotlib.figure.Figure at 0x9db80b8> i study the code from another case like this. if I use ax1.plot instead of ax1.plot_date, then the error information change to : --------------------------------------------------------------------------- TypeError Traceback (most recent call last) C:\Anaconda3\lib\site-packages\matplotlib\colors.py in to_rgba(c, alpha) 140 try: --> 141 rgba = _colors_full_map.cache[c, alpha] 142 except (KeyError, TypeError): # Not in cache, or unhashable. C:\Anaconda3\lib\site-packages\pandas\core\generic.py in __hash__(self) 830 raise TypeError('{0!r} objects are mutable, thus they cannot be' --> 831 ' hashed'.format(self.__class__.__name__)) 832 TypeError: 'Series' objects are mutable, thus they cannot be hashed During handling of the above exception, another exception occurred: ValueError Traceback (most recent call last) C:\Anaconda3\lib\site-packages\IPython\core\formatters.py in __call__(self, obj) 305 pass 306 else: --> 307 return printer(obj) 308 # Finally look for special method names 309 method = get_real_method(obj, self.print_method) C:\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in <lambda>(fig) 225 226 if 'png' in formats: --> 227 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs)) 228 if 'retina' in formats or 'png2x' in formats: 229 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs)) C:\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs) 117 118 bytes_io = BytesIO() --> 119 fig.canvas.print_figure(bytes_io, **kw) 120 data = bytes_io.getvalue() 121 if fmt == 'svg': C:\Anaconda3\lib\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs) 2190 orientation=orientation, 2191 dryrun=True, -> 2192 **kwargs) 2193 renderer = self.figure._cachedRenderer 2194 bbox_inches = self.figure.get_tightbbox(renderer) C:\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs) 543 544 def print_png(self, filename_or_obj, *args, **kwargs): --> 545 FigureCanvasAgg.draw(self) 546 renderer = self.get_renderer() 547 original_dpi = renderer.dpi C:\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in draw(self) 462 463 try: --> 464 self.figure.draw(self.renderer) 465 finally: 466 RendererAgg.lock.release() C:\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 61 def draw_wrapper(artist, renderer, *args, **kwargs): 62 before(artist, renderer) ---> 63 draw(artist, renderer, *args, **kwargs) 64 after(artist, renderer) 65 C:\Anaconda3\lib\site-packages\matplotlib\figure.py in draw(self, renderer) 1141 1142 mimage._draw_list_compositing_images( -> 1143 renderer, self, dsu, self.suppressComposite) 1144 1145 renderer.close_group('figure') C:\Anaconda3\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, dsu, suppress_composite) 137 if not_composite or not has_images: 138 for zorder, a in dsu: --> 139 a.draw(renderer) 140 else: 141 # Composite any adjacent images together C:\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 61 def draw_wrapper(artist, renderer, *args, **kwargs): 62 before(artist, renderer) ---> 63 draw(artist, renderer, *args, **kwargs) 64 after(artist, renderer) 65 C:\Anaconda3\lib\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe) 2407 renderer.stop_rasterizing() 2408 -> 2409 mimage._draw_list_compositing_images(renderer, self, dsu) 2410 2411 renderer.close_group('axes') C:\Anaconda3\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, dsu, suppress_composite) 137 if not_composite or not has_images: 138 for zorder, a in dsu: --> 139 a.draw(renderer) 140 else: 141 # Composite any adjacent images together C:\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 61 def draw_wrapper(artist, renderer, *args, **kwargs): 62 before(artist, renderer) ---> 63 draw(artist, renderer, *args, **kwargs) 64 after(artist, renderer) 65 C:\Anaconda3\lib\site-packages\matplotlib\lines.py in draw(self, renderer) 801 self._set_gc_clip(gc) 802 --> 803 ln_color_rgba = self._get_rgba_ln_color() 804 gc.set_foreground(ln_color_rgba, isRGBA=True) 805 gc.set_alpha(ln_color_rgba[3]) C:\Anaconda3\lib\site-packages\matplotlib\lines.py in _get_rgba_ln_color(self, alt) 1342 1343 def _get_rgba_ln_color(self, alt=False): -> 1344 return mcolors.to_rgba(self._color, self._alpha) 1345 1346 # some aliases.... C:\Anaconda3\lib\site-packages\matplotlib\colors.py in to_rgba(c, alpha) 141 rgba = _colors_full_map.cache[c, alpha] 142 except (KeyError, TypeError): # Not in cache, or unhashable. --> 143 rgba = _to_rgba_no_colorcycle(c, alpha) 144 try: 145 _colors_full_map.cache[c, alpha] = rgba C:\Anaconda3\lib\site-packages\matplotlib\colors.py in _to_rgba_no_colorcycle(c, alpha) 190 # not numpy floats. 191 try: --> 192 c = tuple(map(float, c)) 193 except TypeError: 194 raise ValueError("Invalid RGBA argument: {!r}".format(orig_c)) ValueError: could not convert string to float: 'k' <matplotlib.figure.Figure at 0x263096fa128> why this happen? and what i really what to do is make a bar chart of cumsum size and plot price in the same image or if size>n(linspace maybe 50,100,200),make the whole background which in several time range in different colors. like between 2017-8-19 08:20:10 and 2017-8-19 08:30:20,size=70,then use yellow to fill this range background.and between 2017-8-20 08:20:10 and 2017-8-20 08:30:20,size=150,then use red to fill this range background. just solve one problem is good, some idea can not figure out in one time:)
Issue plotting Seaborn and Matplotlib figures using loop
I am having some trouble saving a series of two Seaborn violin plots and a normal matplotlib plot which runs each time my code iterates over a loop. My code is: for symbol in symbol_list: <DO SOMETHING - CREATE PANDAS DATAFRAME NAMED "df"> img = sns.violinplot(x=df['Onside'].dropna().astype(float)) fig = img.get_figure() fig.savefig(symbol+" Onside Violin Plot.png") fig.clf() sns.violinplot(x=df['Offside'].dropna().astype(float)) fig = img.get_figure() fig.savefig(symbol+" Offside Violin Plot.png") fig.clf() plt.figure(1) plt.subplot(211) plt.hist(df['Onside'],bins=50,alpha=0.5,label="Onside") plt.hist(df['Offside'],bins=50,alpha=0.5,label="Offside") plt.legend(loc='best') plt.xlabel("Pips") plt.ylabel("Number of Trades") plt.subplot(212) plt.bar(df.index,df['Offside'],color='r',width=0.5) plt.bar(df.index,df['Onside'],color='blue',width=0.5) plt.savefig(symbol+'_Onside_Offside') plt.plot() It runs correctly on the first iteration through the loop but on the second go around I get the following error message: --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-51-269b21e53a2f> in <module>() 112 img = sns.violinplot(x=df['Onside'].dropna().astype(float))#.figure.savefig(symbol+" Onside Violin Plot.png") 113 fig = img.get_figure() --> 114 fig.savefig(symbol+" Onside Violin Plot.png") 115 fig.clf() 116 C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\figure.py in savefig(self, *args, **kwargs) 1561 self.set_frameon(frameon) 1562 -> 1563 self.canvas.print_figure(*args, **kwargs) 1564 1565 if frameon: C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs) 2230 orientation=orientation, 2231 bbox_inches_restore=_bbox_inches_restore, -> 2232 **kwargs) 2233 finally: 2234 if bbox_inches and restore_bbox: C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs) 525 526 def print_png(self, filename_or_obj, *args, **kwargs): --> 527 FigureCanvasAgg.draw(self) 528 renderer = self.get_renderer() 529 original_dpi = renderer.dpi C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in draw(self) 472 473 try: --> 474 self.figure.draw(self.renderer) 475 finally: 476 RendererAgg.lock.release() C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 60 def draw_wrapper(artist, renderer, *args, **kwargs): 61 before(artist, renderer) ---> 62 draw(artist, renderer, *args, **kwargs) 63 after(artist, renderer) 64 C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\figure.py in draw(self, renderer) 1157 dsu.sort(key=itemgetter(0)) 1158 for zorder, a, func, args in dsu: -> 1159 func(*args) 1160 1161 renderer.close_group('figure') C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 60 def draw_wrapper(artist, renderer, *args, **kwargs): 61 before(artist, renderer) ---> 62 draw(artist, renderer, *args, **kwargs) 63 after(artist, renderer) 64 C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe) 2317 2318 for zorder, a in dsu: -> 2319 a.draw(renderer) 2320 2321 renderer.close_group('axes') C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 60 def draw_wrapper(artist, renderer, *args, **kwargs): 61 before(artist, renderer) ---> 62 draw(artist, renderer, *args, **kwargs) 63 after(artist, renderer) 64 C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in draw(self, renderer, *args, **kwargs) 1106 renderer.open_group(__name__) 1107 -> 1108 ticks_to_draw = self._update_ticks(renderer) 1109 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw, 1110 renderer) C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in _update_ticks(self, renderer) 949 950 interval = self.get_view_interval() --> 951 tick_tups = [t for t in self.iter_ticks()] 952 if self._smart_bounds: 953 # handle inverted limits C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in <listcomp>(.0) 949 950 interval = self.get_view_interval() --> 951 tick_tups = [t for t in self.iter_ticks()] 952 if self._smart_bounds: 953 # handle inverted limits C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in iter_ticks(self) 892 Iterate through all of the major and minor ticks. 893 """ --> 894 majorLocs = self.major.locator() 895 majorTicks = self.get_major_ticks(len(majorLocs)) 896 self.major.formatter.set_locs(majorLocs) C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\dates.py in __call__(self) 1005 def __call__(self): 1006 'Return the locations of the ticks' -> 1007 self.refresh() 1008 return self._locator() 1009 C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\dates.py in refresh(self) 1025 def refresh(self): 1026 'Refresh internal information based on current limits.' -> 1027 dmin, dmax = self.viewlim_to_dt() 1028 self._locator = self.get_locator(dmin, dmax) 1029 C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\dates.py in viewlim_to_dt(self) 769 vmin, vmax = vmax, vmin 770 --> 771 return num2date(vmin, self.tz), num2date(vmax, self.tz) 772 773 def _get_unit(self): C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\dates.py in num2date(x, tz) 417 tz = _get_rc_timezone() 418 if not cbook.iterable(x): --> 419 return _from_ordinalf(x, tz) 420 else: 421 x = np.asarray(x) C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\dates.py in _from_ordinalf(x, tz) 269 270 ix = int(x) --> 271 dt = datetime.datetime.fromordinal(ix).replace(tzinfo=UTC) 272 273 remainder = float(x) - ix ValueError: ordinal must be >= 1 --------------------------------------------------------------------------- ValueError Traceback (most recent call last) C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\IPython\core\formatters.py in __call__(self, obj) 305 pass 306 else: --> 307 return printer(obj) 308 # Finally look for special method names 309 method = get_real_method(obj, self.print_method) C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in <lambda>(fig) 225 226 if 'png' in formats: --> 227 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs)) 228 if 'retina' in formats or 'png2x' in formats: 229 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs)) C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs) 117 118 bytes_io = BytesIO() --> 119 fig.canvas.print_figure(bytes_io, **kw) 120 data = bytes_io.getvalue() 121 if fmt == 'svg': C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs) 2178 orientation=orientation, 2179 dryrun=True, -> 2180 **kwargs) 2181 renderer = self.figure._cachedRenderer 2182 bbox_inches = self.figure.get_tightbbox(renderer) C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs) 525 526 def print_png(self, filename_or_obj, *args, **kwargs): --> 527 FigureCanvasAgg.draw(self) 528 renderer = self.get_renderer() 529 original_dpi = renderer.dpi C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in draw(self) 472 473 try: --> 474 self.figure.draw(self.renderer) 475 finally: 476 RendererAgg.lock.release() C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 60 def draw_wrapper(artist, renderer, *args, **kwargs): 61 before(artist, renderer) ---> 62 draw(artist, renderer, *args, **kwargs) 63 after(artist, renderer) 64 C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\figure.py in draw(self, renderer) 1157 dsu.sort(key=itemgetter(0)) 1158 for zorder, a, func, args in dsu: -> 1159 func(*args) 1160 1161 renderer.close_group('figure') C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 60 def draw_wrapper(artist, renderer, *args, **kwargs): 61 before(artist, renderer) ---> 62 draw(artist, renderer, *args, **kwargs) 63 after(artist, renderer) 64 C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe) 2317 2318 for zorder, a in dsu: -> 2319 a.draw(renderer) 2320 2321 renderer.close_group('axes') C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) 60 def draw_wrapper(artist, renderer, *args, **kwargs): 61 before(artist, renderer) ---> 62 draw(artist, renderer, *args, **kwargs) 63 after(artist, renderer) 64 C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in draw(self, renderer, *args, **kwargs) 1106 renderer.open_group(__name__) 1107 -> 1108 ticks_to_draw = self._update_ticks(renderer) 1109 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw, 1110 renderer) C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in _update_ticks(self, renderer) 949 950 interval = self.get_view_interval() --> 951 tick_tups = [t for t in self.iter_ticks()] 952 if self._smart_bounds: 953 # handle inverted limits C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in <listcomp>(.0) 949 950 interval = self.get_view_interval() --> 951 tick_tups = [t for t in self.iter_ticks()] 952 if self._smart_bounds: 953 # handle inverted limits C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in iter_ticks(self) 892 Iterate through all of the major and minor ticks. 893 """ --> 894 majorLocs = self.major.locator() 895 majorTicks = self.get_major_ticks(len(majorLocs)) 896 self.major.formatter.set_locs(majorLocs) C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\dates.py in __call__(self) 1005 def __call__(self): 1006 'Return the locations of the ticks' -> 1007 self.refresh() 1008 return self._locator() 1009 C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\dates.py in refresh(self) 1025 def refresh(self): 1026 'Refresh internal information based on current limits.' -> 1027 dmin, dmax = self.viewlim_to_dt() 1028 self._locator = self.get_locator(dmin, dmax) 1029 C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\dates.py in viewlim_to_dt(self) 769 vmin, vmax = vmax, vmin 770 --> 771 return num2date(vmin, self.tz), num2date(vmax, self.tz) 772 773 def _get_unit(self): C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\dates.py in num2date(x, tz) 417 tz = _get_rc_timezone() 418 if not cbook.iterable(x): --> 419 return _from_ordinalf(x, tz) 420 else: 421 x = np.asarray(x) C:\Users\s\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\dates.py in _from_ordinalf(x, tz) 269 270 ix = int(x) --> 271 dt = datetime.datetime.fromordinal(ix).replace(tzinfo=UTC) 272 273 remainder = float(x) - ix ValueError: ordinal must be >= 1 Could anyone please point out where I am going wrong? I assume it's seomthing to do with the "plt" figure not being cleared properly and therefore the code is trying to plot two different indices on the x axis of the same figure, hence the "ordinal must be >= 1" error. Am i in the right ball park?
You need to clear the figure first thing in the loop, otherwise the new content would be plottet to the old figure from the previous loop step. So you can add plt.gcf().clf() at the start of the loop.
Ipython notebook "from mpl_toolkits.mplot3d import Axes3D" has Value Error
I started learning Python 4 months ago and nearly everything went perfect until I got an excercise, where I have to do 3d plots. For that I have to import mpl_toolkits.mplit3d, but I get this error: ValueError Traceback (most recent call last) <ipython-input-3-c39f93eee133> in <module>() ----> 1 get_ipython().magic('matplotlib notebook') 2 from pylab import * 3 from mpl_toolkits.mplot3d import Axes3D 4 5 Lp = 200 /usr/local/lib/python3.4/dist-packages/IPython/core/interactiveshell.py in magic(self, arg_s) 2334 magic_name, _, magic_arg_s = arg_s.partition(' ') 2335 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC) -> 2336 return self.run_line_magic(magic_name, magic_arg_s) 2337 2338 #------------------------------------------------------------------------- /usr/local/lib/python3.4/dist-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line) 2255 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals 2256 with self.builtin_trap: -> 2257 result = fn(*args,**kwargs) 2258 return result 2259 /usr/local/lib/python3.4/dist-packages/IPython/core/magics/pylab.py in matplotlib(self, line) /usr/local/lib/python3.4/dist-packages/IPython/core/magic.py in <lambda>(f, *a, **k) 191 # but it's overkill for just that one bit of state. 192 def magic_deco(arg): --> 193 call = lambda f, *a, **k: f(*a, **k) 194 195 if callable(arg): /usr/local/lib/python3.4/dist-packages/IPython/core/magics/pylab.py in matplotlib(self, line) 98 print("Available matplotlib backends: %s" % backends_list) 99 else: --> 100 gui, backend = self.shell.enable_matplotlib(args.gui) 101 self._show_matplotlib_backend(args.gui, backend) 102 /usr/local/lib/python3.4/dist-packages/IPython/core/interactiveshell.py in enable_matplotlib(self, gui) 3130 gui, backend = pt.find_gui_and_backend(self.pylab_gui_select) 3131 -> 3132 pt.activate_matplotlib(backend) 3133 pt.configure_inline_support(self, backend) 3134 /usr/local/lib/python3.4/dist-packages/IPython/core/pylabtools.py in activate_matplotlib(backend) 270 # the rcParam to update. This needs to be set *before* the module 271 # magic of switch_backend(). --> 272 matplotlib.rcParams['backend'] = backend 273 274 import matplotlib.pyplot /usr/lib/python3/dist-packages/matplotlib/__init__.py in __setitem__(self, key, val) 808 warnings.warn(self.msg_depr_ignore % (key, alt)) 809 return --> 810 cval = self.validate[key](val) 811 dict.__setitem__(self, key, cval) 812 except KeyError: /usr/lib/python3/dist-packages/matplotlib/rcsetup.py in validate_backend(s) 144 return s 145 else: --> 146 return _validate_standard_backends(s) 147 148 validate_qt4 = ValidateInStrings('backend.qt4', ['PyQt4', 'PySide']) /usr/lib/python3/dist-packages/matplotlib/rcsetup.py in __call__(self, s) 55 return self.valid[s] 56 raise ValueError('Unrecognized %s string "%s": valid strings are %s' ---> 57 % (self.key, s, list(self.valid.values()))) 58 59 ValueError: Unrecognized backend string "nbagg": valid strings are ['GTK', 'template', 'svg', 'Qt4Agg', 'GTK3Cairo', 'emf', 'WX', 'GTK3Agg', 'CocoaAgg', 'WebAgg', 'TkAgg', 'agg', 'gdk', 'GTKAgg', 'cairo', 'ps', 'pdf', 'pgf', 'WXAgg', 'MacOSX', 'GTKCairo'] I really dont know what that means. Obviously, I have this package, so what is the problem?
java.io.NotSerializableException: org.apache.myfaces.taglib.core.ViewTag
I am getting the following error whenever a page gets rendered, <Jul 23, 2014 7:05:14 PM GMT+05:30> <Error> <HTTP> <BEA-101362> <[ServletContext#1791852040[app:BANCS-ONLINE module:CommonWeb path:null spec-version:3.0]] could not deserialize the request scoped attribute with name: "org.apache.myfaces.COMPONENT_STACK" java.io.NotSerializableException: org.apache.myfaces.taglib.core.ViewTag at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1190) at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1384) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180) at java.io.ObjectOutputStream.access$300(ObjectOutputStream.java:163) at java.io.ObjectOutputStream$PutFieldImpl.writeFields(ObjectOutputStream.java:1709) Truncated. see log file for complete stacktrace I have checked the call stack of the exception by debuging it. Here it is, Daemon Thread [[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'] (Suspended (exception NotSerializableException)) WLObjectOutputStream(ObjectOutputStream).writeObject0(Object, boolean) line: 1190 WLObjectOutputStream(ObjectOutputStream).writeArray(Object, ObjectStreamClass, boolean) line: 1384 WLObjectOutputStream(ObjectOutputStream).writeObject0(Object, boolean) line: 1180 ObjectOutputStream.access$300(ObjectOutputStream, Object, boolean) line: 163 ObjectOutputStream$PutFieldImpl.writeFields() line: 1709 WLObjectOutputStream(ObjectOutputStream).writeFields() line: 485 Stack<E>(Vector<E>).writeObject(ObjectOutputStream) line: 1073 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 76 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43 Method.invoke(Object, Object...) line: 607 ObjectStreamClass.invokeWriteObject(Object, ObjectOutputStream) line: 1049 WLObjectOutputStream(ObjectOutputStream).writeSerialData(Object, ObjectStreamClass) line: 1502 WLObjectOutputStream(ObjectOutputStream).writeOrdinaryObject(Object, ObjectStreamClass, boolean) line: 1438 WLObjectOutputStream(ObjectOutputStream).writeObject0(Object, boolean) line: 1184 WLObjectOutputStream(ObjectOutputStream).writeObject(Object) line: 353 PassivationUtils.toByteArray(Object, Replacer) line: 33 PassivationUtils.toByteArray(Object) line: 24 PassivationUtils.copy(Object) line: 64 AttributeWrapper.getObject(boolean, WebAppServletContext) line: 97 AttributeWrapper.getObject(WebAppServletContext) line: 65 AttributesMap.get(String, WebAppServletContext) line: 108 ServletRequestImpl.getAttribute(String) line: 773 RequestEventsFilter$EventsRequestWrapper(ServletRequestWrapper).getAttribute(String) line: 116 WebappLifecycleListener.requestDestroyed(ServletRequestEvent) line: 118 ConfigureListener.requestDestroyed(ServletRequestEvent) line: 366 EventsManager.notifyRequestLifetimeEvent(ServletRequest, boolean) line: 389 RequestEventsFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 30 FilterChainImpl.doFilter(ServletRequest, ServletResponse) line: 74 RequestDispatcherImpl.invokeServlet(boolean, ServletRequest, ServletResponse, ServletResponseImpl, int) line: 565 RequestDispatcherImpl.include(ServletRequest, ServletResponse) line: 471 ImportTag(ImportSupport).acquireString() line: 327 ImportTag(ImportSupport).doEndTag() line: 184 policyPartySearch.jsp line: 32 policyPartySearch.jsp line: 31 policyPartySearch.jsp line: 30 policyPartySearch.jsp line: 29 __policypartysearch(JspBase).service(ServletRequest, ServletResponse) line: 34 StubSecurityHelper$ServletServiceAction.run() line: 242 StubSecurityHelper$ServletServiceAction.run() line: 216 StubSecurityHelper.invokeServlet(ServletRequest, HttpServletRequest, ServletRequestImpl, ServletResponse, HttpServletResponse, Servlet) line: 132 JavelinxJSPStub(ServletStubImpl).execute(ServletRequest, ServletResponse, FilterChainImpl) line: 338 JavelinxJSPStub(ServletStubImpl).execute(ServletRequest, ServletResponse) line: 221 RequestDispatcherImpl.invokeServlet(boolean, ServletRequest, ServletResponse, ServletResponseImpl, int) line: 564 RequestDispatcherImpl.forward(ServletRequest, ServletResponse) line: 263 ServletExternalContextImpl.dispatch(String) line: 369 JspViewDeclarationLanguage.buildView(FacesContext, UIViewRoot) line: 99 RenderResponseExecutor.execute(FacesContext) line: 78 LifecycleImpl.render(FacesContext) line: 241 FacesServlet.service(ServletRequest, ServletResponse) line: 199 StubSecurityHelper$ServletServiceAction.run() line: 242 StubSecurityHelper$ServletServiceAction.run() line: 216 StubSecurityHelper.invokeServlet(ServletRequest, HttpServletRequest, ServletRequestImpl, ServletResponse, HttpServletResponse, Servlet) line: 132 ServletStubImpl.execute(ServletRequest, ServletResponse, FilterChainImpl) line: 338 TailFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 25 FilterChainImpl.doFilter(ServletRequest, ServletResponse) line: 74 ApplicationFilter.doFilter(FilterChain, ServletRequest, ServletResponse) line: 802 ApplicationFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 422 FilterChainImpl.doFilter(ServletRequest, ServletResponse) line: 74 RequestEventsFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 27 FilterChainImpl.doFilter(ServletRequest, ServletResponse) line: 74 WebAppServletContext$ServletInvocationAction.wrapRun(ServletStub, HttpServletRequest, HttpServletResponse) line: 3296 WebAppServletContext$ServletInvocationAction.run() line: 3262 AuthenticatedSubject.doAs(AbstractSubject, PrivilegedAction) line: 321 SecurityManager.runAs(AuthenticatedSubject, AuthenticatedSubject, PrivilegedAction) line: 120 WlsSubjectHandle.run(PrivilegedAction) line: 57 WebAppServletContext.doSecuredExecute(ServletInvocationContext, HttpServletRequest, HttpServletResponse, boolean, boolean) line: 2171 WebAppServletContext.securedExecute(HttpServletRequest, HttpServletResponse, boolean) line: 2097 WebAppServletContext.execute(ServletRequestImpl, ServletResponseImpl) line: 2075 ServletRequestImpl.run() line: 1514 ContainerSupportProviderImpl$WlsRequestExecutor.run() line: 254 ExecuteThread.execute(Runnable) line: 256 ExecuteThread.run() line: 221 Moreover I am using myfaces 2.1.15 in my WebApp lib and deploying it in Weblogic 12c. My bean is in request scope and org.apache.myfaces.SERIALIZE_STATE_IN_SESSION is set to false. I am not sure why JSF is trying to Serialize-deserialize the properties. Can anyone please help me out in this. I am really stuck on this now. Please comment if you need more info of my webApp.