py2ls 0.1.8.8__tar.gz → 0.1.9.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/PKG-INFO +1 -1
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/ips.py +2 -7
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/plot.py +284 -255
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/pyproject.toml +1 -1
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/README.md +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.DS_Store +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/COMMIT_EDITMSG +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/FETCH_HEAD +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/HEAD +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/config +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/description +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/hooks/applypatch-msg.sample +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/hooks/commit-msg.sample +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/hooks/fsmonitor-watchman.sample +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/hooks/post-update.sample +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/hooks/pre-applypatch.sample +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/hooks/pre-commit.sample +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/hooks/pre-merge-commit.sample +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/hooks/pre-push.sample +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/hooks/pre-rebase.sample +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/hooks/pre-receive.sample +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/hooks/prepare-commit-msg.sample +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/hooks/push-to-checkout.sample +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/hooks/update.sample +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/index +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/info/exclude +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/logs/HEAD +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/logs/refs/heads/main +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/logs/refs/remotes/origin/HEAD +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/logs/refs/remotes/origin/main +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/01/d5bd8065e6860c0bd23ff9fa57161806a099e1 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/09/08da26de58c114225ad81f484b80bf5d351b34 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/0b/409e1bc918277010f5679b402d1d1dda53e15c +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/14/449a0e6ba4ea2f1a73acf63ef91c9c6193f9ed +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/15/a8e468aacfcb440e090020f36d0b985d45da23 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/1a/b4585881a6a42889f01aa0cfe25fd5acfaf46f +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/1c/3f92adda34344bcbbbf9d409c79855ae2aaea8 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/1d/fe9d9633b24ea560354f4f93d39c6e5f163ea0 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/20/72c28e83f4347959d29f7b3a6c1fc3e4ee6b59 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/24/6b368b986f758630c46dc02b7fa512b53422f7 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/25/b796accd261b9135fd32a2c00785f68edf6c46 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/30/a2f8da47ee947811dc8d993f5a06a45de374f4 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/32/fd627b62fad7cf3b2f9e34ab9777126a0987ad +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/36/b4a1b7403abc6c360f8fe2cb656ab945254971 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/36/e56a361f526eafa59c5235a5c990bf288b5f9c +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/36/ef43e50009e59db11812c258846d9e38718173 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/39/7ead045fbbcfb17c62019eb18fe21ed05dbee5 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/3b/bd972aa7ad680858f8dfbd0f7fcd97756f0d6f +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/3c/bbe5f4173d165127b9ad96119f1ec24c306ffc +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/3f/d6561300938afbb3d11976cf9c8f29549280d9 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/41/dcf4b3bf0460946b2da93776cf9e836d62178f +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/43/dbd49b2ee367c5434dd545e3b5795434f2ef0b +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/48/a88fc5806305d0bb0755ee6801161b79696972 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/4f/7afb40dff2153d857fc85748c2eecb85125042 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/50/08ddfcf53c02e82d7eee2e57c38e5672ef89f6 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/53/e0deb1cb4c2c606bced6e7f9a66b0fda60980d +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/56/e4e8b2d5545e0256090f45aa8fc42c5fe067d0 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/57/bd1c0199483ab316235b094543b85edec6c35e +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/58/20a729045d4dc7e37ccaf8aa8eec126850afe2 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/5a/192565abf89c9d765af846ce6d53a92b1ce7ad +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/60/f273eb1c412d916fa3f11318a7da7a9911b52a +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/61/570cec8c061abe74121f27f5face6c69b98f99 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/62/4488173ed2c8936fa5cea3cf5dd3f26a30b86e +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/62/7c81b23b4e56e87b042b650b0103653cc9e34a +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/62/d90ccf8cbefdc2e4fd475e7c6f4f76e9fdf801 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/63/100154b27846e8010e55b6bf4b3d7762c14c5f +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/64/27a4edff08f93d98f511418423f09f2ab90bcd +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/68/6df3072c8b025fb18106ed2df505994ad062a9 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/69/13c452ca319f7cbf6a0836dc10a5bb033c84e4 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/6a/52e747a2b349b128d1490d9e896d2323818eb7 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/6b/7fde264d93a7a0986d394c46c7650d0ce2ab92 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/6c/cebb29b7f3f5b0c889f6dadbf9ff066554587d +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/6d/ee29dbdcc84edeeacede105110446f3ccac963 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/71/36b2074a2754be8b58127d82250e5b37e3c373 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/78/3d4167bc95c9d2175e0df03ef1c1c880ba75ab +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/79/7ae089b2212a937840e215276005ce76881307 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/7e/5956c806b5edc344d46dab599dec337891ba1f +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/81/8f26b7bf042269729020cf944fc362d66ba27e +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/84/59071b722a255b774a80b27746033f8141ab39 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/87/ef1fc3f7f1ddc4d0ab9b3e65381ce9f3388621 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/8b/84f56978e1de8f2ae82abce5f8b3e182d365cd +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/8e/55a7d2b96184030211f20c9b9af201eefcac82 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/91/c69ad88fe0ba94aa7859fb5f7edac5e6f1a3f7 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/94/74152b4b463d70ae5ad07f0c658be3e296026b +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/97/1aef09ea939f46b60b9646f8d524c78a9220f4 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/9d/0df52899fe95279059286d9c0ec42287edc168 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/a1/5389729850729fc7bd78a54f26fce77f30be12 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/a4/63fdd23e5efd713db8a71f316f3a1c7bd60916 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/a5/ec8f74642fbba27f7ea78c53b372ae0c7dedce +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/a7/3e13eafee65c5b8d73ad2d3ea46d0eee82f0d3 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/b0/56be4be89ba6b76949dd641df45bb7036050c8 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/b0/9cd7856d58590578ee1a4f3ad45d1310a97f87 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/b2/18e6a0f0f1c4df8cdefa9852058348abc713b7 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/b5/61831c7dce8ea51e7ee6b6fa35745f14d8242d +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/b7/2c9e75ab7d0afe594664650aa8f6c772f5ac64 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/bb/81ccc0513f18fc160b54a82861e9a80d23f4f6 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/bb/934eb33bc1a8b85630bf680caffd99560c1b8f +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/bf/67907e337021ebff434e02b19b30a741c144af +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/c1/20fc812b9ad311c34a3608512d6a9d976bb48e +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/c4/cba65f1163661999ee4b8ed23342b63bc1300c +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/c6/7f17e5707313600efcb85e9a3fedea35dba591 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/c6/f32aced880bd165a251cb52b26b0c1107e2141 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/cd/822b3574a88ebdd1ed82fd6983f37e626d52b4 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/cf/0c0d9c6fb09473aaeb7f7e2edbd770c3f2ef3d +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/d6/9ab1c4aadf279936dd778e8346ba60f74705b6 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/d8/4688b54c0040a30976b3a6540bc47adf7ce680 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/d9/005f2cc7fc4e65f14ed5518276007c08cf2fd0 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/d9/c2403fd166ce791b4e9d0c6792ed8342c71fcd +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/d9/dfa5aee51e92a541b707e8e7baea6f06deff98 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/db/141dbaa93594df2a8156182f361ee4db829359 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/db/ffa8ea7bda721d0cee7b9e4ce5b2ef927733ff +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/dd/87fb5f606fe380d81e6fe3a2c98f9f99e3e09b +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/df/e0770424b2a19faf507a501ebfc23be8f54e7b +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/e3/1356f90ea6dd0577b5e0b40b206319adcbf085 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/e3/5a4dafc50850cacac7bf76c56db2715cbda2c4 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/e9/391ffe371f1cc43b42ef09b705d9c767c2e14f +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/f1/e50757fddc28b445545dc7e2759b54cdd0f42e +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/f4/b64d3107b39e3ad6f540c6607004ea34e6c024 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/f7/c98ba5c2f903e603b1f5e63d49fbc8a43815cc +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/f9/045a08e96eb76848fc4d68e3e3e687cca39a2d +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/fa/147e6bb78a2e8db241d231295fd7f1ed061af8 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/objects/fc/292e793ecfd42240ac43be407023bd731fa9e7 +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/refs/heads/main +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/refs/remotes/origin/HEAD +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.git/refs/remotes/origin/main +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.gitattributes +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/.gitignore +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/LICENSE +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/README.md +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/__init__.py +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/brain_atlas.py +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/chat.py +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/correlators.py +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/data/.DS_Store +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/data/db2ls_sql_chtsht.json +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/data/docs_links.json +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/data/lang_code_iso639.json +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/db2ls.py +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/doc.py +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/export_requirements.py +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/freqanalysis.py +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/netfinder.py +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/setuptools-70.1.0-py3-none-any.whl +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/sleep_events_detectors.py +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/stats.py +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/translator.py +0 -0
- {py2ls-0.1.8.8 → py2ls-0.1.9.0}/py2ls/wb_detector.py +0 -0
@@ -45,7 +45,8 @@ from langdetect import detect
|
|
45
45
|
from duckduckgo_search import DDGS
|
46
46
|
|
47
47
|
from . import netfinder
|
48
|
-
|
48
|
+
|
49
|
+
# from .plot import get_color
|
49
50
|
|
50
51
|
try:
|
51
52
|
get_ipython().run_line_magic("load_ext", "autoreload")
|
@@ -1354,18 +1355,12 @@ def fsave(
|
|
1354
1355
|
|
1355
1356
|
def save_json(fpath_fname, var_dict_or_df):
|
1356
1357
|
with open(fpath_fname, "w") as f_json:
|
1357
|
-
# Check if var_dict_or_df is a DataFrame
|
1358
1358
|
if isinstance(var_dict_or_df, pd.DataFrame):
|
1359
|
-
# Convert DataFrame to a list of dictionaries
|
1360
1359
|
var_dict_or_df = var_dict_or_df.to_dict(orient="dict")
|
1361
|
-
|
1362
|
-
# Check if var_dict_or_df is a dictionary
|
1363
1360
|
if isinstance(var_dict_or_df, dict):
|
1364
|
-
# Convert NumPy arrays to lists
|
1365
1361
|
for key, value in var_dict_or_df.items():
|
1366
1362
|
if isinstance(value, np.ndarray):
|
1367
1363
|
var_dict_or_df[key] = value.tolist()
|
1368
|
-
|
1369
1364
|
# Save the dictionary or list of dictionaries to a JSON file
|
1370
1365
|
json.dump(var_dict_or_df, f_json, indent=4)
|
1371
1366
|
|
@@ -8,6 +8,7 @@ import matplotlib
|
|
8
8
|
import matplotlib.ticker as tck
|
9
9
|
from cycler import cycler
|
10
10
|
import logging
|
11
|
+
from .ips import fsave
|
11
12
|
|
12
13
|
# Suppress INFO messages from fontTools
|
13
14
|
logging.getLogger("fontTools").setLevel(logging.WARNING)
|
@@ -16,7 +17,10 @@ logging.getLogger("fontTools").setLevel(logging.WARNING)
|
|
16
17
|
def catplot(data, *args, **kwargs):
|
17
18
|
"""
|
18
19
|
catplot(data, opt=None, ax=None)
|
19
|
-
|
20
|
+
The catplot function is designed to provide a flexible way to create various types of
|
21
|
+
categorical plots. It supports multiple plot layers such as bars, error bars, scatter
|
22
|
+
plots, box plots, violin plots, and lines. Each plot type is handled by its own internal
|
23
|
+
function, allowing for separation of concerns and modularity in the design.
|
20
24
|
Args:
|
21
25
|
data (array): data matrix
|
22
26
|
"""
|
@@ -57,7 +61,7 @@ def catplot(data, *args, **kwargs):
|
|
57
61
|
xloc, opt_e["loc"], opt_e["x_width"], data.shape[0]
|
58
62
|
)
|
59
63
|
error_positions = np.nanmean(error_positions, axis=0)
|
60
|
-
errors = np.nanstd(data, axis=0)
|
64
|
+
errors = np.nanstd(data, axis=0, ddof=1)
|
61
65
|
if opt_e["error"] == "sem":
|
62
66
|
errors /= np.sqrt(np.sum(~np.isnan(data), axis=0))
|
63
67
|
|
@@ -212,6 +216,9 @@ def catplot(data, *args, **kwargs):
|
|
212
216
|
color=bx_opt["MeanLineColor"],
|
213
217
|
linewidth=bx_opt["MeanLineWidth"],
|
214
218
|
)
|
219
|
+
# MeanLine or MedianLine only keep only one
|
220
|
+
if bx_opt["MeanLine"]: # MeanLine has priority
|
221
|
+
bx_opt["MedianLine"] = False
|
215
222
|
bxp = ax.boxplot(
|
216
223
|
data,
|
217
224
|
positions=X_bx,
|
@@ -231,6 +238,9 @@ def catplot(data, *args, **kwargs):
|
|
231
238
|
widths=bx_opt["x_width"],
|
232
239
|
label=label,
|
233
240
|
)
|
241
|
+
if not bx_opt["MedianLine"]:
|
242
|
+
for median in bxp["medians"]:
|
243
|
+
median.set_visible(False)
|
234
244
|
|
235
245
|
if bx_opt["BoxLineWidth"] < 0.1:
|
236
246
|
bx_opt["EdgeColor"] = "none"
|
@@ -452,260 +462,277 @@ def catplot(data, *args, **kwargs):
|
|
452
462
|
# custom_order = ['s', 'bx', 'e']
|
453
463
|
# full_order = sort_catplot_layers(custom_order)
|
454
464
|
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
465
|
+
col = kwargs.get("col", None)
|
466
|
+
if not col:
|
467
|
+
# figsets
|
468
|
+
kw_figsets = kwargs.get("figsets", None)
|
469
|
+
# check the data type
|
470
|
+
if isinstance(data, pd.DataFrame):
|
471
|
+
df = data.copy()
|
472
|
+
x = kwargs.get("x", None)
|
473
|
+
y = kwargs.get("y", None)
|
474
|
+
hue = kwargs.get("hue", None)
|
475
|
+
data = df2array(data=data, x=x, y=y, hue=hue)
|
476
|
+
xticklabels = []
|
477
|
+
if hue is not None:
|
478
|
+
for i in df[x].unique().tolist():
|
479
|
+
for j in df[hue].unique().tolist():
|
480
|
+
xticklabels.append(i + "-" + j)
|
481
|
+
x_len = len(df[x].unique().tolist())
|
482
|
+
hue_len = len(df[hue].unique().tolist())
|
483
|
+
xticks = generate_xticks_with_gap(x_len, hue_len)
|
484
|
+
default_x_width = 0.85
|
485
|
+
legend_hue = df[hue].unique().tolist()
|
486
|
+
default_colors = get_color(hue_len)
|
487
|
+
else:
|
488
|
+
for i in df[x].unique().tolist():
|
489
|
+
xticklabels.append(i)
|
490
|
+
xticks = np.arange(1, len(xticklabels) + 1).tolist()
|
491
|
+
legend_hue = xticklabels
|
492
|
+
default_colors = get_color(len(xticklabels))
|
493
|
+
default_x_width = 0.5
|
494
|
+
|
495
|
+
# when the xticklabels are too long, rotate the labels a bit
|
496
|
+
|
497
|
+
xangle = 30 if max([len(i) for i in xticklabels]) > 5 else 0
|
498
|
+
if kw_figsets is not None:
|
499
|
+
kw_figsets = {
|
500
|
+
"ylabel": y,
|
501
|
+
# "xlabel": x,
|
502
|
+
"xticks": xticks,
|
503
|
+
"xticklabels": xticklabels,
|
504
|
+
"xangle": xangle,
|
505
|
+
**kw_figsets,
|
506
|
+
}
|
507
|
+
else:
|
508
|
+
kw_figsets = {
|
509
|
+
"ylabel": y,
|
510
|
+
# "xlabel": x,
|
511
|
+
"xticks": xticks,
|
512
|
+
"xticklabels": xticklabels,
|
513
|
+
"xangle": xangle,
|
514
|
+
}
|
474
515
|
else:
|
475
|
-
|
476
|
-
xticklabels.append(i)
|
477
|
-
xticks = np.arange(1, len(xticklabels) + 1)
|
478
|
-
legend_hue = xticklabels
|
516
|
+
xticks = np.arange(1, data.shape[1] + 1).tolist()
|
479
517
|
default_x_width = 0.5
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
518
|
+
default_colors = get_color(len(xticks))
|
519
|
+
legend_hue = None
|
520
|
+
xangle = 0
|
521
|
+
|
522
|
+
# full_order
|
523
|
+
opt = kwargs.get("opt", {})
|
524
|
+
ax = kwargs.get("ax", None)
|
525
|
+
if "ax" not in locals() or ax is None:
|
526
|
+
ax = plt.gca()
|
527
|
+
opt.setdefault("c", default_colors)
|
528
|
+
# if len(opt["c"]) < data.shape[1]:
|
529
|
+
# additional_colors = plt.cm.winter(
|
530
|
+
# np.linspace(0, 1, data.shape[1] - len(opt["c"]))
|
531
|
+
# )
|
532
|
+
# opt["c"] = np.vstack([opt["c"], additional_colors[:, :3]])
|
533
|
+
|
534
|
+
opt.setdefault("loc", {})
|
535
|
+
opt["loc"].setdefault("go", 0)
|
536
|
+
opt["loc"].setdefault("xloc", xticks)
|
537
|
+
|
538
|
+
# export setting
|
539
|
+
opt.setdefault("export", {})
|
540
|
+
opt["export"].setdefault("path", None)
|
541
|
+
print(opt["export"])
|
542
|
+
|
543
|
+
# opt.setdefault('layer', {})
|
544
|
+
opt.setdefault("layer", ["b", "bx", "e", "v", "s", "l"])
|
545
|
+
|
546
|
+
opt.setdefault("b", {})
|
547
|
+
opt["b"].setdefault("go", 1)
|
548
|
+
opt["b"].setdefault("loc", "c")
|
549
|
+
opt["b"].setdefault("FaceColor", opt["c"])
|
550
|
+
opt["b"].setdefault("FaceAlpha", 1)
|
551
|
+
opt["b"].setdefault("EdgeColor", "k")
|
552
|
+
opt["b"].setdefault("EdgeAlpha", 1)
|
553
|
+
opt["b"].setdefault("LineStyle", "-")
|
554
|
+
opt["b"].setdefault("LineWidth", 0.8)
|
555
|
+
opt["b"].setdefault("x_width", default_x_width)
|
556
|
+
opt["b"].setdefault("ShowBaseLine", "off")
|
557
|
+
opt["b"].setdefault("hatch", None)
|
558
|
+
|
559
|
+
opt.setdefault("e", {})
|
560
|
+
opt["e"].setdefault("go", 1)
|
561
|
+
opt["e"].setdefault("loc", "l")
|
562
|
+
opt["e"].setdefault("LineWidth", 1)
|
563
|
+
opt["e"].setdefault("CapLineWidth", 1)
|
564
|
+
opt["e"].setdefault("CapSize", 2)
|
565
|
+
opt["e"].setdefault("Marker", "none")
|
566
|
+
opt["e"].setdefault("LineStyle", "none")
|
567
|
+
opt["e"].setdefault("LineColor", "k")
|
568
|
+
opt["e"].setdefault("LineJoin", "round")
|
569
|
+
opt["e"].setdefault("MarkerSize", "auto")
|
570
|
+
opt["e"].setdefault("FaceColor", opt["c"])
|
571
|
+
opt["e"].setdefault("MarkerEdgeColor", "none")
|
572
|
+
opt["e"].setdefault("Visible", True)
|
573
|
+
opt["e"].setdefault("Orientation", "vertical")
|
574
|
+
opt["e"].setdefault("error", "sem")
|
575
|
+
opt["e"].setdefault("x_width", opt["b"]["x_width"] / 5)
|
576
|
+
opt["e"].setdefault("cap_dir", "b")
|
577
|
+
|
578
|
+
opt.setdefault("s", {})
|
579
|
+
opt["s"].setdefault("go", 1)
|
580
|
+
opt["s"].setdefault("loc", "r")
|
581
|
+
opt["s"].setdefault("FaceColor", "w")
|
582
|
+
opt["s"].setdefault("cmap", None)
|
583
|
+
opt["s"].setdefault("FaceAlpha", 1)
|
584
|
+
opt["s"].setdefault("x_width", opt["b"]["x_width"] / 5)
|
585
|
+
opt["s"].setdefault("Marker", "o")
|
586
|
+
opt["s"].setdefault("MarkerSize", 15)
|
587
|
+
opt["s"].setdefault("LineWidth", 0.8)
|
588
|
+
opt["s"].setdefault("MarkerEdgeColor", "k")
|
589
|
+
|
590
|
+
opt.setdefault("l", {})
|
591
|
+
opt["l"].setdefault("go", 1)
|
592
|
+
opt["l"].setdefault("LineStyle", "-")
|
593
|
+
opt["l"].setdefault("LineColor", "k")
|
594
|
+
opt["l"].setdefault("LineWidth", 0.5)
|
595
|
+
opt["l"].setdefault("LineAlpha", 0.5)
|
596
|
+
|
597
|
+
opt.setdefault("bx", {})
|
598
|
+
opt["bx"].setdefault("go", 0)
|
599
|
+
opt["bx"].setdefault("loc", "r")
|
600
|
+
opt["bx"].setdefault("FaceColor", opt["c"])
|
601
|
+
opt["bx"].setdefault("EdgeColor", "k")
|
602
|
+
opt["bx"].setdefault("FaceAlpha", 0.85)
|
603
|
+
opt["bx"].setdefault("EdgeAlpha", 1)
|
604
|
+
opt["bx"].setdefault("LineStyle", "-")
|
605
|
+
opt["bx"].setdefault("x_width", 0.2)
|
606
|
+
opt["bx"].setdefault("ShowBaseLine", "off")
|
607
|
+
opt["bx"].setdefault("Notch", False)
|
608
|
+
opt["bx"].setdefault("Outliers", "on")
|
609
|
+
opt["bx"].setdefault("OutlierMarker", "+")
|
610
|
+
opt["bx"].setdefault("OutlierColor", "r")
|
611
|
+
opt["bx"].setdefault("OutlierSize", 6)
|
612
|
+
# opt['bx'].setdefault('PlotStyle', 'traditional')
|
613
|
+
# opt['bx'].setdefault('FactorDirection', 'auto')
|
614
|
+
opt["bx"].setdefault("Whisker", 0.5)
|
615
|
+
opt["bx"].setdefault("Orientation", "vertical")
|
616
|
+
opt["bx"].setdefault("BoxLineWidth", 0.5)
|
617
|
+
opt["bx"].setdefault("FaceColor", "k")
|
618
|
+
opt["bx"].setdefault("WhiskerLineStyle", "-")
|
619
|
+
opt["bx"].setdefault("WhiskerLineColor", "k")
|
620
|
+
opt["bx"].setdefault("WhiskerLineWidth", 0.5)
|
621
|
+
opt["bx"].setdefault("Caps", True)
|
622
|
+
opt["bx"].setdefault("CapLineColor", "k")
|
623
|
+
opt["bx"].setdefault("CapLineWidth", 0.5)
|
624
|
+
opt["bx"].setdefault("CapSize", 0.2)
|
625
|
+
opt["bx"].setdefault("MedianLine", True)
|
626
|
+
opt["bx"].setdefault("MedianLineStyle", "-")
|
627
|
+
opt["bx"].setdefault("MedianStyle", "line")
|
628
|
+
opt["bx"].setdefault("MedianLineColor", "k")
|
629
|
+
opt["bx"].setdefault("MedianLineWidth", 2)
|
630
|
+
opt["bx"].setdefault("MedianLineTop", False)
|
631
|
+
opt["bx"].setdefault("MeanLine", False)
|
632
|
+
opt["bx"].setdefault("showmeans", opt["bx"]["MeanLine"])
|
633
|
+
opt["bx"].setdefault("MeanLineStyle", "-")
|
634
|
+
opt["bx"].setdefault("MeanLineColor", "w")
|
635
|
+
opt["bx"].setdefault("MeanLineWidth", 2)
|
636
|
+
|
637
|
+
# Violin plot options
|
638
|
+
opt.setdefault("v", {})
|
639
|
+
opt["v"].setdefault("go", 0)
|
640
|
+
opt["v"].setdefault("x_width", 0.3)
|
641
|
+
opt["v"].setdefault("loc", "r")
|
642
|
+
opt["v"].setdefault("EdgeColor", "none")
|
643
|
+
opt["v"].setdefault("FaceColor", opt["c"])
|
644
|
+
opt["v"].setdefault("FaceAlpha", 0.3)
|
645
|
+
opt["v"].setdefault("BandWidth", "scott")
|
646
|
+
opt["v"].setdefault("Function", "pdf")
|
647
|
+
opt["v"].setdefault("Kernel", "gau")
|
648
|
+
opt["v"].setdefault("NumPoints", 500)
|
649
|
+
opt["v"].setdefault("BoundaryCorrection", "reflection")
|
650
|
+
|
651
|
+
data_m = np.nanmean(data, axis=0)
|
652
|
+
nr, nc = data.shape
|
653
|
+
|
654
|
+
for key in kwargs.keys():
|
655
|
+
if key in opt:
|
656
|
+
if isinstance(kwargs[key], dict):
|
657
|
+
opt[key].update(kwargs[key])
|
658
|
+
else:
|
659
|
+
opt[key] = kwargs[key]
|
660
|
+
if isinstance(opt["loc"]["xloc"], list):
|
661
|
+
xloc = np.array(opt["loc"]["xloc"])
|
492
662
|
else:
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
ax = plt.gca()
|
663
|
+
xloc = opt["loc"]["xloc"]
|
664
|
+
layers = sort_catplot_layers(opt["layer"])
|
665
|
+
|
666
|
+
label_which = kwargs.get("label_which", "barplot")
|
667
|
+
if "b" in label_which:
|
668
|
+
legend_which = "b"
|
669
|
+
elif "s" in label_which:
|
670
|
+
legend_which = "s"
|
671
|
+
elif "bx" in label_which:
|
672
|
+
legend_which = "bx"
|
673
|
+
elif "e" in label_which:
|
674
|
+
legend_which = "e"
|
675
|
+
elif "v" in label_which:
|
676
|
+
legend_which = "v"
|
677
|
+
else:
|
678
|
+
legend_which = None
|
510
679
|
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
680
|
+
for layer in layers:
|
681
|
+
if layer == "b" and opt["b"]["go"]:
|
682
|
+
if legend_which == "b":
|
683
|
+
plot_bars(data, data_m, opt["b"], xloc, ax, label=legend_hue)
|
684
|
+
else:
|
685
|
+
plot_bars(data, data_m, opt["b"], xloc, ax, label=None)
|
686
|
+
elif layer == "e" and opt["e"]["go"]:
|
687
|
+
if legend_which == "e":
|
688
|
+
plot_errors(data, data_m, opt["e"], xloc, ax, label=legend_hue)
|
689
|
+
else:
|
690
|
+
plot_errors(data, data_m, opt["e"], xloc, ax, label=None)
|
691
|
+
elif layer == "s" and opt["s"]["go"]:
|
692
|
+
if legend_which == "s":
|
693
|
+
plot_scatter(data, opt["s"], xloc, ax, label=legend_hue)
|
694
|
+
else:
|
695
|
+
plot_scatter(data, opt["s"], xloc, ax, label=None)
|
696
|
+
elif layer == "bx" and opt["bx"]["go"]:
|
697
|
+
if legend_which == "bx":
|
698
|
+
plot_boxplot(data, opt["bx"], xloc, ax, label=legend_hue)
|
699
|
+
else:
|
700
|
+
plot_boxplot(data, opt["bx"], xloc, ax, label=None)
|
701
|
+
elif layer == "v" and opt["v"]["go"]:
|
702
|
+
if legend_which == "v":
|
703
|
+
plot_violin(data, opt["v"], xloc, ax, label=legend_hue)
|
704
|
+
else:
|
705
|
+
plot_violin(data, opt["v"], xloc, ax, label=None)
|
706
|
+
elif all([layer == "l", opt["l"]["go"], opt["s"]["go"]]):
|
707
|
+
plot_lines(data, opt["l"], opt["s"], ax)
|
524
708
|
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
opt["loc"].setdefault("xloc", xticks)
|
535
|
-
|
536
|
-
# export setting
|
537
|
-
opt.setdefault("export", {})
|
538
|
-
opt["export"].setdefault("path", None)
|
539
|
-
print(opt["export"])
|
540
|
-
|
541
|
-
# opt.setdefault('layer', {})
|
542
|
-
opt.setdefault("layer", ["b", "bx", "e", "v", "s", "l"])
|
543
|
-
|
544
|
-
opt.setdefault("b", {})
|
545
|
-
opt["b"].setdefault("go", 1)
|
546
|
-
opt["b"].setdefault("loc", "c")
|
547
|
-
opt["b"].setdefault("FaceColor", opt["c"])
|
548
|
-
opt["b"].setdefault("FaceAlpha", 0.65)
|
549
|
-
opt["b"].setdefault("EdgeColor", "k")
|
550
|
-
opt["b"].setdefault("EdgeAlpha", 1)
|
551
|
-
opt["b"].setdefault("LineStyle", "-")
|
552
|
-
opt["b"].setdefault("LineWidth", 0.8)
|
553
|
-
opt["b"].setdefault("x_width", default_x_width)
|
554
|
-
opt["b"].setdefault("ShowBaseLine", "off")
|
555
|
-
opt["b"].setdefault("hatch", None)
|
556
|
-
|
557
|
-
opt.setdefault("e", {})
|
558
|
-
opt["e"].setdefault("go", 1)
|
559
|
-
opt["e"].setdefault("loc", "l")
|
560
|
-
opt["e"].setdefault("LineWidth", 1)
|
561
|
-
opt["e"].setdefault("CapLineWidth", 1)
|
562
|
-
opt["e"].setdefault("CapSize", 2)
|
563
|
-
opt["e"].setdefault("Marker", "none")
|
564
|
-
opt["e"].setdefault("LineStyle", "none")
|
565
|
-
opt["e"].setdefault("LineColor", "k")
|
566
|
-
opt["e"].setdefault("LineJoin", "round")
|
567
|
-
opt["e"].setdefault("MarkerSize", "auto")
|
568
|
-
opt["e"].setdefault("FaceColor", opt["c"])
|
569
|
-
opt["e"].setdefault("MarkerEdgeColor", "none")
|
570
|
-
opt["e"].setdefault("Visible", True)
|
571
|
-
opt["e"].setdefault("Orientation", "vertical")
|
572
|
-
opt["e"].setdefault("error", "sem")
|
573
|
-
opt["e"].setdefault("x_width", opt["b"]["x_width"] / 5)
|
574
|
-
opt["e"].setdefault("cap_dir", "b")
|
575
|
-
|
576
|
-
opt.setdefault("s", {})
|
577
|
-
opt["s"].setdefault("go", 1)
|
578
|
-
opt["s"].setdefault("loc", "r")
|
579
|
-
opt["s"].setdefault("FaceColor", opt["c"])
|
580
|
-
opt["s"].setdefault("cmap", None)
|
581
|
-
opt["s"].setdefault("FaceAlpha", 1)
|
582
|
-
opt["s"].setdefault("x_width", opt["b"]["x_width"] / 5)
|
583
|
-
opt["s"].setdefault("Marker", "o")
|
584
|
-
opt["s"].setdefault("MarkerSize", 10)
|
585
|
-
opt["s"].setdefault("LineWidth", 0.5)
|
586
|
-
opt["s"].setdefault("MarkerEdgeColor", "k")
|
587
|
-
|
588
|
-
opt.setdefault("l", {})
|
589
|
-
opt["l"].setdefault("go", 1)
|
590
|
-
opt["l"].setdefault("LineStyle", "-")
|
591
|
-
opt["l"].setdefault("LineColor", "k")
|
592
|
-
opt["l"].setdefault("LineWidth", 0.5)
|
593
|
-
opt["l"].setdefault("LineAlpha", 0.5)
|
594
|
-
|
595
|
-
opt.setdefault("bx", {})
|
596
|
-
opt["bx"].setdefault("go", 0)
|
597
|
-
opt["bx"].setdefault("loc", "r")
|
598
|
-
opt["bx"].setdefault("FaceColor", opt["c"])
|
599
|
-
opt["bx"].setdefault("EdgeColor", "k")
|
600
|
-
opt["bx"].setdefault("FaceAlpha", 0.7)
|
601
|
-
opt["bx"].setdefault("EdgeAlpha", 1)
|
602
|
-
opt["bx"].setdefault("LineStyle", "-")
|
603
|
-
opt["bx"].setdefault("x_width", 0.2)
|
604
|
-
opt["bx"].setdefault("ShowBaseLine", "off")
|
605
|
-
opt["bx"].setdefault("Notch", False)
|
606
|
-
opt["bx"].setdefault("Outliers", "on")
|
607
|
-
opt["bx"].setdefault("OutlierMarker", "+")
|
608
|
-
opt["bx"].setdefault("OutlierColor", "r")
|
609
|
-
opt["bx"].setdefault("OutlierSize", 6)
|
610
|
-
# opt['bx'].setdefault('PlotStyle', 'traditional')
|
611
|
-
# opt['bx'].setdefault('FactorDirection', 'auto')
|
612
|
-
opt["bx"].setdefault("Whisker", 0.5)
|
613
|
-
opt["bx"].setdefault("Orientation", "vertical")
|
614
|
-
opt["bx"].setdefault("BoxLineWidth", 0.5)
|
615
|
-
opt["bx"].setdefault("FaceColor", "k")
|
616
|
-
opt["bx"].setdefault("WhiskerLineStyle", "-")
|
617
|
-
opt["bx"].setdefault("WhiskerLineColor", "k")
|
618
|
-
opt["bx"].setdefault("WhiskerLineWidth", 0.5)
|
619
|
-
opt["bx"].setdefault("Caps", True)
|
620
|
-
opt["bx"].setdefault("CapLineColor", "k")
|
621
|
-
opt["bx"].setdefault("CapLineWidth", 0.5)
|
622
|
-
opt["bx"].setdefault("CapSize", 0.2)
|
623
|
-
opt["bx"].setdefault("MedianLineStyle", "-")
|
624
|
-
opt["bx"].setdefault("MedianStyle", "line")
|
625
|
-
opt["bx"].setdefault("MedianLineColor", "k")
|
626
|
-
opt["bx"].setdefault("MedianLineWidth", 2)
|
627
|
-
opt["bx"].setdefault("MedianLineTop", False)
|
628
|
-
opt["bx"].setdefault("MeanLine", False)
|
629
|
-
opt["bx"].setdefault("showmeans", opt["bx"]["MeanLine"])
|
630
|
-
opt["bx"].setdefault("MeanLineStyle", "-")
|
631
|
-
opt["bx"].setdefault("MeanLineColor", "w")
|
632
|
-
opt["bx"].setdefault("MeanLineWidth", 2)
|
633
|
-
|
634
|
-
# Violin plot options
|
635
|
-
opt.setdefault("v", {})
|
636
|
-
opt["v"].setdefault("go", 0)
|
637
|
-
opt["v"].setdefault("x_width", 0.3)
|
638
|
-
opt["v"].setdefault("loc", "r")
|
639
|
-
opt["v"].setdefault("EdgeColor", "none")
|
640
|
-
opt["v"].setdefault("FaceColor", opt["c"])
|
641
|
-
opt["v"].setdefault("FaceAlpha", 0.3)
|
642
|
-
opt["v"].setdefault("BandWidth", "scott")
|
643
|
-
opt["v"].setdefault("Function", "pdf")
|
644
|
-
opt["v"].setdefault("Kernel", "gau")
|
645
|
-
opt["v"].setdefault("NumPoints", 500)
|
646
|
-
opt["v"].setdefault("BoundaryCorrection", "reflection")
|
647
|
-
|
648
|
-
data_m = np.nanmean(data, axis=0)
|
649
|
-
nr, nc = data.shape
|
650
|
-
|
651
|
-
for key in kwargs.keys():
|
652
|
-
if key in opt:
|
653
|
-
if isinstance(kwargs[key], dict):
|
654
|
-
opt[key].update(kwargs[key])
|
655
|
-
else:
|
656
|
-
opt[key] = kwargs[key]
|
657
|
-
if isinstance(opt["loc"]["xloc"], list):
|
658
|
-
xloc = np.array(opt["loc"]["xloc"])
|
659
|
-
else:
|
660
|
-
xloc = opt["loc"]["xloc"]
|
661
|
-
layers = sort_catplot_layers(opt["layer"])
|
662
|
-
|
663
|
-
label_which = kwargs.get("label_which", "barplot")
|
664
|
-
if "b" in label_which:
|
665
|
-
legend_which = "b"
|
666
|
-
elif "s" in label_which:
|
667
|
-
legend_which = "s"
|
668
|
-
elif "bx" in label_which:
|
669
|
-
legend_which = "bx"
|
670
|
-
elif "e" in label_which:
|
671
|
-
legend_which = "e"
|
672
|
-
elif "v" in label_which:
|
673
|
-
legend_which = "v"
|
709
|
+
if kw_figsets is not None:
|
710
|
+
figsets(ax=ax, **kw_figsets)
|
711
|
+
show_legend = kwargs.get("show_legend", True)
|
712
|
+
if show_legend:
|
713
|
+
ax.legend()
|
714
|
+
export_style = kwargs.get("export_style", None)
|
715
|
+
if export_style:
|
716
|
+
fsave(export_style, opt)
|
717
|
+
return ax, opt
|
674
718
|
else:
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
plot_scatter(data, opt["s"], xloc, ax, label=None)
|
693
|
-
elif layer == "bx" and opt["bx"]["go"]:
|
694
|
-
if legend_which == "bx":
|
695
|
-
plot_boxplot(data, opt["bx"], xloc, ax, label=legend_hue)
|
696
|
-
else:
|
697
|
-
plot_boxplot(data, opt["bx"], xloc, ax, label=None)
|
698
|
-
elif layer == "v" and opt["v"]["go"]:
|
699
|
-
if legend_which == "v":
|
700
|
-
plot_violin(data, opt["v"], xloc, ax, label=legend_hue)
|
701
|
-
else:
|
702
|
-
plot_violin(data, opt["v"], xloc, ax, label=None)
|
703
|
-
elif all([layer == "l", opt["l"]["go"], opt["s"]["go"]]):
|
704
|
-
plot_lines(data, opt["l"], opt["s"], ax)
|
705
|
-
|
706
|
-
if kw_figsets is not None:
|
707
|
-
figsets(ax=ax, **kw_figsets)
|
708
|
-
return ax
|
719
|
+
col_names = data[col].unique().tolist()
|
720
|
+
nrow, ncol = kwargs.get("subplots", [len(col_names), 1])
|
721
|
+
figsize = kwargs.get("figsize", [3 * ncol, 3 * nrow])
|
722
|
+
fig, axs = plt.subplots(nrow, ncol, figsize=figsize, squeeze=False)
|
723
|
+
axs = axs.flatten()
|
724
|
+
key2rm = ["data", "ax", "col", "subplots"]
|
725
|
+
for k2rm in key2rm:
|
726
|
+
if k2rm in kwargs:
|
727
|
+
del kwargs[k2rm]
|
728
|
+
for i, ax in enumerate(axs):
|
729
|
+
# ax = axs[i][0] if len(col_names) > 1 else axs[0]
|
730
|
+
if i < len(col_names):
|
731
|
+
df_sub = data.loc[data[col] == col_names[i]]
|
732
|
+
catplot(ax=ax, data=df_sub, **kwargs)
|
733
|
+
ax.set_title(col_names[i])
|
734
|
+
print(f"Axis layout shape: {axs.shape}")
|
735
|
+
return axs
|
709
736
|
|
710
737
|
|
711
738
|
def get_cmap():
|
@@ -1356,14 +1383,16 @@ def stdshade(ax=None, *args, **kwargs):
|
|
1356
1383
|
yMean = np.nanmean(y, axis=0)
|
1357
1384
|
if paraStdSem == "sem":
|
1358
1385
|
if smth > 1:
|
1359
|
-
wings = savgol_filter(
|
1386
|
+
wings = savgol_filter(
|
1387
|
+
np.nanstd(y, axis=0, ddof=1) / np.sqrt(y.shape[0]), smth, 1
|
1388
|
+
)
|
1360
1389
|
else:
|
1361
|
-
wings = np.nanstd(y, axis=0) / np.sqrt(y.shape[0])
|
1390
|
+
wings = np.nanstd(y, axis=0, ddof=1) / np.sqrt(y.shape[0])
|
1362
1391
|
elif paraStdSem == "std":
|
1363
1392
|
if smth > 1:
|
1364
|
-
wings = savgol_filter(np.nanstd(y, axis=0), smth, 1)
|
1393
|
+
wings = savgol_filter(np.nanstd(y, axis=0, ddof=1), smth, 1)
|
1365
1394
|
else:
|
1366
|
-
wings = np.nanstd(y, axis=0)
|
1395
|
+
wings = np.nanstd(y, axis=0, ddof=1)
|
1367
1396
|
|
1368
1397
|
# fill_kws = kwargs.get('fill_kws', {})
|
1369
1398
|
# line_kws = kwargs.get('line_kws', {})
|
@@ -1668,6 +1697,6 @@ def generate_xticks_with_gap(x_len, hue_len):
|
|
1668
1697
|
for i in range(max(x_len, hue_len), 0, -1) # i iterates from 3 to 1
|
1669
1698
|
]
|
1670
1699
|
concatenated_array = np.concatenate(arrays)
|
1671
|
-
positive_array = concatenated_array[concatenated_array > 0]
|
1700
|
+
positive_array = concatenated_array[concatenated_array > 0].tolist()
|
1672
1701
|
|
1673
1702
|
return positive_array
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|