py2ls 0.2.4.5__py3-none-any.whl → 0.2.4.7__py3-none-any.whl

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/plot.py CHANGED
@@ -11,7 +11,7 @@ import logging
11
11
  import os
12
12
  import re
13
13
  from typing import Union
14
- from .ips import fsave, fload, mkdir, listdir, figsave, strcmp, unique, get_os, ssplit,plt_font,flatten
14
+ from .ips import fsave, fload, mkdir, listdir, figsave, strcmp, unique, get_os, ssplit,flatten,plt_font
15
15
  from .stats import *
16
16
  from .netfinder import get_soup, fetch
17
17
 
@@ -1868,6 +1868,7 @@ def figsets(*args, **kwargs):
1868
1868
  plt.rcParams["font.size"]=fontsize
1869
1869
  fontname = kwargs.pop("fontname","Arial")
1870
1870
  fontname=plt_font(fontname) # 显示中文
1871
+
1871
1872
  sns_themes = ["white", "whitegrid", "dark", "darkgrid", "ticks"]
1872
1873
  sns_contexts = ["notebook", "talk", "poster"] # now available "paper"
1873
1874
  scienceplots_styles = [
@@ -2336,40 +2337,20 @@ def get_color(
2336
2337
  if n == 1:
2337
2338
  colorlist = ["#3A4453"]
2338
2339
  elif n == 2:
2339
- colorlist = ["#3A4453", "#DF5932"]
2340
+ colorlist = ["#3A4453", "#FBAF63"]
2340
2341
  elif n == 3:
2341
- colorlist = ["#3A4453", "#DF5932", "#299D8F"]
2342
+ colorlist = ["#3A4453", "#FBAF63", "#299D8F"]
2342
2343
  elif n == 4:
2343
- # colorlist = ["#3A4453", "#DF5932", "#EBAA00", "#0B4083"]
2344
- colorlist = ["#81C6BD", "#FBAF63", "#F2675B", "#72A1C9"]
2344
+ colorlist = ["#087cf7", "#FBAF63", "#3C898A","#FF2C00"]
2345
2345
  elif n == 5:
2346
- colorlist = [
2347
- "#3A4453",
2348
- "#427AB2",
2349
- "#F09148",
2350
- "#DBDB8D",
2351
- "#C59D94",
2352
- "#AFC7E8",
2353
- ]
2346
+ colorlist = ["#459AA9", "#B25E9D", "#4B8C3B","#EF8632","#FF2C00"]
2354
2347
  elif n == 6:
2355
- colorlist = [
2356
- "#3A4453",
2357
- "#427AB2",
2358
- "#F09148",
2359
- "#DBDB8D",
2360
- "#C59D94",
2361
- "#E53528",
2362
- ]
2348
+ colorlist = ["#459AA9", "#B25E9D", "#4B8C3B","#EF8632", "#24578E","#FF2C00"]
2349
+ elif n==7:
2350
+ colorlist = [ "#7F7F7F", "#459AA9", "#B25E9D", "#4B8C3B","#EF8632", "#24578E" "#FF2C00"]
2363
2351
  else:
2364
- colorlist = [
2365
- "#474747",
2366
- "#FF2C00",
2367
- "#0C5DA5",
2368
- "#845B97",
2369
- "#58BBCC",
2370
- "#FF9500",
2371
- "#D57DBE",
2372
- ]
2352
+ colorlist = ['#FF7F0E','#2CA02C','#D62728','#9467BD','#E377C2','#7F7F7F','#7BB8CC','#06daf2']
2353
+
2373
2354
  by = "start"
2374
2355
  elif any(["cub" in cmap.lower(), "sns" in cmap.lower()]):
2375
2356
  if kwargs:
@@ -3105,9 +3086,9 @@ def plotxy(
3105
3086
  palette = kws_scatter.pop(
3106
3087
  "palette",
3107
3088
  (
3108
- sns.color_palette("tab10", data[hue].nunique())
3089
+ sns.color_palette("tab20", data[hue].nunique())
3109
3090
  if hue is not None
3110
- else sns.color_palette("tab10")
3091
+ else sns.color_palette("tab20")
3111
3092
  ),
3112
3093
  )
3113
3094
  s = kws_scatter.pop("s", 10)
@@ -3201,7 +3182,7 @@ def volcano(
3201
3182
  top_genes=[5, 5], # [down-regulated, up-regulated]
3202
3183
  thr_x=np.log2(1.5), # default: 0.585
3203
3184
  thr_y=-np.log10(0.05),
3204
- sort_xy="x", #'y'
3185
+ sort_xy="x", #'y', 'xy'
3205
3186
  colors=("#00BFFF", "#9d9a9a", "#FF3030"),
3206
3187
  s=20,
3207
3188
  fill=True, # plot filled scatter
@@ -3498,37 +3479,106 @@ def sns_func_info(dir_save=None):
3498
3479
  )
3499
3480
 
3500
3481
 
3501
-
3502
-
3503
-
3504
-
3482
+ def get_color_overlap(*colors):
3483
+ import matplotlib.colors as mcolors
3484
+
3485
+ """Blend multiple colors by averaging their RGB values."""
3486
+ rgbs = [mcolors.to_rgb(color) for color in colors]
3487
+ blended_rgb = [sum(channel) / len(channel) for channel in zip(*rgbs)]
3488
+ return mcolors.to_hex(blended_rgb)
3489
+
3490
+
3491
+ def desaturate_color(color, saturation_factor=0.5):
3492
+ """Reduce the saturation of a color by a given factor (between 0 and 1)."""
3493
+ import matplotlib.colors as mcolors
3494
+ import colorsys
3495
+ # Convert the color to RGB
3496
+ rgb = mcolors.to_rgb(color)
3497
+ # Convert RGB to HLS (Hue, Lightness, Saturation)
3498
+ h, l, s = colorsys.rgb_to_hls(*rgb)
3499
+ # Reduce the saturation
3500
+ s *= saturation_factor
3501
+ # Convert back to RGB
3502
+ return colorsys.hls_to_rgb(h, l, s)
3503
+
3504
+ def textsets(text, fontname='Arial', fontsize=11, fontweight="normal", fontstyle="normal",
3505
+ fontcolor='k', backgroundcolor=None, shadow=False, ha="center", va="center"):
3506
+ if text: # Ensure text exists
3507
+ if fontname:
3508
+ text.set_fontname(plt_font(fontname))
3509
+ if fontsize:
3510
+ text.set_fontsize(fontsize)
3511
+ if fontweight:
3512
+ text.set_fontweight(fontweight)
3513
+ if fontstyle:
3514
+ text.set_fontstyle(fontstyle)
3515
+ if fontcolor:
3516
+ text.set_color(fontcolor)
3517
+ if backgroundcolor:
3518
+ text.set_backgroundcolor(backgroundcolor)
3519
+ text.set_horizontalalignment(ha)
3520
+ text.set_verticalalignment(va)
3521
+ if shadow:
3522
+ text.set_path_effects([
3523
+ matplotlib.patheffects.withStroke(linewidth=3, foreground="gray")
3524
+ ])
3505
3525
  def venn(
3506
3526
  lists:list,
3507
- labels:list,
3527
+ labels:list=None,
3508
3528
  ax=None,
3509
3529
  colors=None,
3510
- edgecolor="0.25",
3511
- alpha=0.75,
3512
- linewidth=.75,
3530
+ edgecolor=None,
3531
+ alpha=0.5,
3532
+ saturation=.75,
3533
+ linewidth=0, # default no edge
3513
3534
  linestyle="-",
3514
3535
  fontname='Arial',
3515
- fontsize=11,
3536
+ fontsize=10,
3537
+ fontcolor='k',
3516
3538
  fontweight="normal",
3517
3539
  fontstyle="normal",
3518
- label_align="center",
3519
- label_baseline="center",
3520
- subset_fontsize=9,
3540
+ ha="center",
3541
+ va="center",
3542
+ shadow=False,
3543
+ subset_fontsize=10,
3521
3544
  subset_fontweight="normal",
3522
3545
  subset_fontstyle="normal",
3523
- subset_label_format="{:d}",
3524
- shadow=False,
3546
+ subset_fontcolor='k',
3547
+ backgroundcolor=None,
3525
3548
  custom_texts=None,
3526
- hatches=None,
3527
- per_circle_styles=None,
3549
+ show_percentages=True, # display percentage
3550
+ fmt="{:.1%}",
3551
+ ellipse_shape=False, # 椭圆形
3552
+ ellipse_scale=[1.5, 1], #not perfect, 椭圆形的形状
3528
3553
  **kwargs
3529
3554
  ):
3530
3555
  """
3531
3556
  Advanced Venn diagram plotting function with extensive customization options.
3557
+ Usage:
3558
+ # Define the two sets
3559
+ set1 = [1, 2, 3, 4, 5]
3560
+ set2 = [4, 5, 6, 7, 8]
3561
+ set3 = [1, 2, 4, 7, 9, 10, 11, 6, 103]
3562
+ _, axs = plt.subplots(1, 2)
3563
+ venn(
3564
+ [set1, set2],
3565
+ ["Set A", "Set B"],
3566
+ colors=["r", "b"],
3567
+ edgecolor="r",
3568
+ linewidth=0,
3569
+ ax=axs[0],
3570
+ )
3571
+ venn(
3572
+ [set1, set2, set3],
3573
+ ["Set A", "Set B", "Set 3"],
3574
+ colors=["r", "g", "b"],
3575
+ saturation=0.8,
3576
+ linewidth=[3, 5, 7],
3577
+ linestyle=[":", "-", "--"],
3578
+ # edgecolor="r",
3579
+ # alpha=1,
3580
+ ax=axs[1],
3581
+ )
3532
3582
 
3533
3583
  Parameters:
3534
3584
  lists: list of sets, 2 or 3 sets
@@ -3551,126 +3601,218 @@ def venn(
3551
3601
  subset_label_format: string, format for subset labels (e.g., "{:.2f}" for floats)
3552
3602
  shadow: bool, add shadow effect to the patches
3553
3603
  custom_texts: list of custom texts to replace the subset labels
3554
- hatches: list of hatch patterns for the patches
3555
- per_circle_styles: dict, custom styles for each circle (e.g., {'circle_1': {'color': 'red'}})
3556
3604
  **kwargs: additional keyword arguments passed to venn2 or venn3
3557
3605
  """
3558
3606
  if ax is None:
3559
3607
  ax = plt.gca()
3560
3608
  lists=[set(flatten(i, verbose=False)) for i in lists]
3561
3609
  # Function to apply text styles to labels
3562
- def apply_text_style(text, fontname, fontsize, fontweight, fontstyle):
3563
- if text: # Ensure text exists
3564
- if fontname:
3565
- text.set_fontname(fontname)
3566
- if fontsize:
3567
- text.set_fontsize(fontsize)
3568
- if fontweight:
3569
- text.set_fontweight(fontweight)
3570
- if fontstyle:
3571
- text.set_fontstyle(fontstyle)
3572
- # Alignment customization
3573
- text.set_horizontalalignment(label_align)
3574
- text.set_verticalalignment(label_baseline)
3575
-
3610
+ if colors is None:
3611
+ colors=["r","b"] if len(lists)==2 else ["r","g","b"]
3612
+ if labels is None:
3613
+ labels=["set1","set2"] if len(lists)==2 else ["set1","set2","set3"]
3614
+ if edgecolor is None:
3615
+ edgecolor=colors
3616
+ colors = [desaturate_color(color, saturation) for color in colors]
3617
+ # Check colors and auto-calculate overlaps
3576
3618
  if len(lists) == 2:
3619
+ def get_count_and_percentage(set_count, subset_count):
3620
+ percent = subset_count / set_count if set_count > 0 else 0
3621
+ return f"{subset_count}\n({fmt.format(percent)})" if show_percentages else f"{subset_count}"
3622
+
3577
3623
  from matplotlib_venn import venn2, venn2_circles
3624
+ # Auto-calculate overlap color for 2-set Venn diagram
3625
+ overlap_color = get_color_overlap(colors[0], colors[1]) if colors else None
3626
+
3627
+ # Draw the venn diagram
3578
3628
  v = venn2(subsets=lists, set_labels=labels, ax=ax, **kwargs)
3579
- venn_circles = venn2_circles(subsets=lists, ax=ax,color=edgecolor)
3629
+ venn_circles = venn2_circles(subsets=lists, ax=ax)
3630
+ set1,set2=lists[0],lists[1]
3631
+ v.get_patch_by_id('10').set_color(colors[0])
3632
+ v.get_patch_by_id('01').set_color(colors[1])
3633
+ v.get_patch_by_id('11').set_color(get_color_overlap(colors[0], colors[1]) if colors else None)
3634
+ # v.get_label_by_id('10').set_text(len(set1 - set2))
3635
+ # v.get_label_by_id('01').set_text(len(set2 - set1))
3636
+ # v.get_label_by_id('11').set_text(len(set1 & set2))
3637
+ v.get_label_by_id('10').set_text(get_count_and_percentage(len(set1), len(set1 - set2)))
3638
+ v.get_label_by_id('01').set_text(get_count_and_percentage(len(set2), len(set2 - set1)))
3639
+ v.get_label_by_id('11').set_text(get_count_and_percentage(len(set1 | set2), len(set1 & set2)))
3640
+
3641
+
3580
3642
  if not isinstance(linewidth,list):
3581
3643
  linewidth=[linewidth]
3582
3644
  if isinstance(linestyle,str):
3583
3645
  linestyle=[linestyle]
3646
+ if not isinstance(edgecolor, list):
3647
+ edgecolor=[edgecolor]
3584
3648
  linewidth=linewidth*2 if len(linewidth)==1 else linewidth
3585
3649
  linestyle=linestyle*2 if len(linestyle)==1 else linestyle
3650
+ edgecolor=edgecolor*2 if len(edgecolor)==1 else edgecolor
3586
3651
  for i in range(2):
3587
3652
  venn_circles[i].set_lw(linewidth[i])
3588
3653
  venn_circles[i].set_ls(linestyle[i])
3654
+ venn_circles[i].set_edgecolor(edgecolor[i])
3655
+ # 椭圆
3656
+ if ellipse_shape:
3657
+ import matplotlib.patches as patches
3658
+ for patch in v.patches:
3659
+ patch.set_visible(False) # Hide original patches if using ellipses
3660
+ center1 = v.get_circle_center(0)
3661
+ center2 = v.get_circle_center(1)
3662
+ ellipse1 = patches.Ellipse(
3663
+ (center1.x, center1.y),
3664
+ width=ellipse_scale[0],
3665
+ height=ellipse_scale[1],
3666
+ edgecolor=edgecolor[0] if edgecolor else colors[0],
3667
+ facecolor=colors[0],
3668
+ lw=linewidth if isinstance(linewidth, (int, float)) else 1.0, # Ensure lw is a number
3669
+ ls=linestyle[0],
3670
+ alpha=alpha if isinstance(alpha, (int, float)) else 0.5 # Ensure alpha is a number
3671
+ )
3672
+ ellipse2 = patches.Ellipse(
3673
+ (center2.x, center2.y),
3674
+ width=ellipse_scale[0],
3675
+ height=ellipse_scale[1],
3676
+ edgecolor=edgecolor[1] if edgecolor else colors[1],
3677
+ facecolor=colors[1],
3678
+ lw=linewidth if isinstance(linewidth, (int, float)) else 1.0, # Ensure lw is a number
3679
+ ls=linestyle[0],
3680
+ alpha=alpha if isinstance(alpha, (int, float)) else 0.5 # Ensure alpha is a number
3681
+ )
3682
+ ax.add_patch(ellipse1)
3683
+ ax.add_patch(ellipse2)
3589
3684
  # Apply styles to set labels
3590
3685
  for i, text in enumerate(v.set_labels):
3591
- apply_text_style(text, fontname, fontsize, fontweight, fontstyle)
3686
+ textsets(text, fontname=fontname, fontsize=fontsize, fontweight=fontweight, fontstyle=fontstyle,
3687
+ fontcolor=fontcolor,ha=ha,va=va,shadow=shadow)
3592
3688
 
3593
3689
  # Apply styles to subset labels
3594
3690
  for i, text in enumerate(v.subset_labels):
3595
3691
  if text: # Ensure text exists
3596
3692
  if custom_texts: # Custom text handling
3597
- text.set_text(custom_texts[i])
3598
- else: # Default subset label formatting
3599
- subset_size = (
3600
- len(lists[i % 2])
3601
- if i in [0, 1]
3602
- else len(lists[0].intersection(lists[1]))
3603
- )
3604
- text.set_text(subset_label_format.format(subset_size))
3605
- apply_text_style(
3606
- text, None, subset_fontsize, subset_fontweight, subset_fontstyle
3607
- )
3693
+ text.set_text(custom_texts[i])
3694
+ textsets(text, fontname=fontname, fontsize=subset_fontsize, fontweight=subset_fontweight, fontstyle=subset_fontstyle,
3695
+ fontcolor=subset_fontcolor,ha=ha,va=va,shadow=shadow)
3696
+
3608
3697
  elif len(lists) == 3:
3698
+ def get_label(set_count, subset_count):
3699
+ percent = subset_count / set_count if set_count > 0 else 0
3700
+ return f"{subset_count}\n({fmt.format(percent)})" if show_percentages else f"{subset_count}"
3701
+
3609
3702
  from matplotlib_venn import venn3, venn3_circles
3610
- v = venn3(
3611
- subsets=lists, set_labels=labels, set_colors=colors, ax=ax, **kwargs
3612
- )
3613
- venn_circles = venn3_circles(
3614
- subsets=lists, ax=ax,color=edgecolor
3615
- )
3616
- if not isinstance(linewidth,list):
3617
- linewidth=[linewidth]
3618
- if isinstance(linestyle,str):
3619
- linestyle=[linestyle]
3620
- linewidth=linewidth*3 if len(linewidth)==1 else linewidth
3621
- linestyle=linestyle*3 if len(linestyle)==1 else linestyle
3622
- for i in range(3):
3623
- venn_circles[i].set_lw(linewidth[i])
3624
- venn_circles[i].set_ls(linestyle[i])
3703
+ # Auto-calculate overlap colors for 3-set Venn diagram
3704
+ colorAB = get_color_overlap(colors[0], colors[1]) if colors else None
3705
+ colorAC = get_color_overlap(colors[0], colors[2]) if colors else None
3706
+ colorBC = get_color_overlap(colors[1], colors[2]) if colors else None
3707
+ colorABC = get_color_overlap(colors[0], colors[1], colors[2]) if colors else None
3708
+ set1,set2,set3=lists[0],lists[1],lists[2]
3709
+
3710
+ # Draw the venn diagram
3711
+ v = venn3(subsets=lists, set_labels=labels, ax=ax,**kwargs)
3712
+ v.get_patch_by_id('100').set_color(colors[0])
3713
+ v.get_patch_by_id('010').set_color(colors[1])
3714
+ v.get_patch_by_id('001').set_color(colors[2])
3715
+ v.get_patch_by_id('110').set_color(colorAB)
3716
+ v.get_patch_by_id('101').set_color(colorAC)
3717
+ v.get_patch_by_id('011').set_color(colorBC)
3718
+ v.get_patch_by_id('111').set_color(colorABC)
3719
+
3720
+ # Correctly labeling subset sizes
3721
+ # v.get_label_by_id('100').set_text(len(set1 - set2 - set3))
3722
+ # v.get_label_by_id('010').set_text(len(set2 - set1 - set3))
3723
+ # v.get_label_by_id('001').set_text(len(set3 - set1 - set2))
3724
+ # v.get_label_by_id('110').set_text(len(set1 & set2 - set3))
3725
+ # v.get_label_by_id('101').set_text(len(set1 & set3 - set2))
3726
+ # v.get_label_by_id('011').set_text(len(set2 & set3 - set1))
3727
+ # v.get_label_by_id('111').set_text(len(set1 & set2 & set3))
3728
+ v.get_label_by_id('100').set_text(get_label(len(set1), len(set1 - set2 - set3)))
3729
+ v.get_label_by_id('010').set_text(get_label(len(set2), len(set2 - set1 - set3)))
3730
+ v.get_label_by_id('001').set_text(get_label(len(set3), len(set3 - set1 - set2)))
3731
+ v.get_label_by_id('110').set_text(get_label(len(set1 | set2), len(set1 & set2 - set3)))
3732
+ v.get_label_by_id('101').set_text(get_label(len(set1 | set3), len(set1 & set3 - set2)))
3733
+ v.get_label_by_id('011').set_text(get_label(len(set2 | set3), len(set2 & set3 - set1)))
3734
+ v.get_label_by_id('111').set_text(get_label(len(set1 | set2 | set3), len(set1 & set2 & set3)))
3735
+
3625
3736
 
3626
3737
  # Apply styles to set labels
3627
3738
  for i, text in enumerate(v.set_labels):
3628
- apply_text_style(text, fontname, fontsize, fontweight, fontstyle)
3739
+ textsets(text, fontname=fontname, fontsize=fontsize, fontweight=fontweight, fontstyle=fontstyle,
3740
+ fontcolor=fontcolor,ha=ha,va=va,shadow=shadow)
3629
3741
 
3630
3742
  # Apply styles to subset labels
3631
3743
  for i, text in enumerate(v.subset_labels):
3632
3744
  if text: # Ensure text exists
3633
3745
  if custom_texts: # Custom text handling
3634
3746
  text.set_text(custom_texts[i])
3635
- else: # Default subset label formatting
3636
- subset_size = (
3637
- len(lists[i])
3638
- if i < 3
3639
- else len(lists[0].intersection(lists[1], lists[2]))
3640
- )
3641
- text.set_text(subset_label_format.format(subset_size))
3642
- apply_text_style(
3643
- text, None, subset_fontsize, subset_fontweight, subset_fontstyle
3644
- )
3747
+ textsets(text, fontname=fontname, fontsize=subset_fontsize, fontweight=subset_fontweight, fontstyle=subset_fontstyle,
3748
+ fontcolor=subset_fontcolor,ha=ha,va=va,shadow=shadow)
3749
+
3750
+ venn_circles = venn3_circles(subsets=lists, ax=ax)
3751
+ if not isinstance(linewidth,list):
3752
+ linewidth=[linewidth]
3753
+ if isinstance(linestyle,str):
3754
+ linestyle=[linestyle]
3755
+ if not isinstance(edgecolor, list):
3756
+ edgecolor=[edgecolor]
3757
+ linewidth=linewidth*3 if len(linewidth)==1 else linewidth
3758
+ linestyle=linestyle*3 if len(linestyle)==1 else linestyle
3759
+ edgecolor=edgecolor*3 if len(edgecolor)==1 else edgecolor
3760
+
3761
+ # edgecolor=[to_rgba(i) for i in edgecolor]
3762
+
3763
+ for i in range(3):
3764
+ venn_circles[i].set_lw(linewidth[i])
3765
+ venn_circles[i].set_ls(linestyle[i])
3766
+ venn_circles[i].set_edgecolor(edgecolor[i])
3767
+
3768
+ #椭圆形
3769
+ if ellipse_shape:
3770
+ import matplotlib.patches as patches
3771
+ for patch in v.patches:
3772
+ patch.set_visible(False) # Hide original patches if using ellipses
3773
+ center1 = v.get_circle_center(0)
3774
+ center2 = v.get_circle_center(1)
3775
+ center3 = v.get_circle_center(2)
3776
+ ellipse1 = patches.Ellipse(
3777
+ (center1.x, center1.y),
3778
+ width=ellipse_scale[0],
3779
+ height=ellipse_scale[1],
3780
+ edgecolor=edgecolor[0] if edgecolor else colors[0],
3781
+ facecolor=colors[0],
3782
+ lw=linewidth if isinstance(linewidth, (int, float)) else 1.0, # Ensure lw is a number
3783
+ ls=linestyle[0],
3784
+ alpha=alpha if isinstance(alpha, (int, float)) else 0.5 # Ensure alpha is a number
3785
+ )
3786
+ ellipse2 = patches.Ellipse(
3787
+ (center2.x, center2.y),
3788
+ width=ellipse_scale[0],
3789
+ height=ellipse_scale[1],
3790
+ edgecolor=edgecolor[1] if edgecolor else colors[1],
3791
+ facecolor=colors[1],
3792
+ lw=linewidth if isinstance(linewidth, (int, float)) else 1.0, # Ensure lw is a number
3793
+ ls=linestyle[0],
3794
+ alpha=alpha if isinstance(alpha, (int, float)) else 0.5 # Ensure alpha is a number
3795
+ )
3796
+ ellipse3 = patches.Ellipse(
3797
+ (center3.x, center3.y),
3798
+ width=ellipse_scale[0],
3799
+ height=ellipse_scale[1],
3800
+ edgecolor=edgecolor[1] if edgecolor else colors[1],
3801
+ facecolor=colors[1],
3802
+ lw=linewidth if isinstance(linewidth, (int, float)) else 1.0, # Ensure lw is a number
3803
+ ls=linestyle[0],
3804
+ alpha=alpha if isinstance(alpha, (int, float)) else 0.5 # Ensure alpha is a number
3805
+ )
3806
+ ax.add_patch(ellipse1)
3807
+ ax.add_patch(ellipse2)
3808
+ ax.add_patch(ellipse3)
3645
3809
  else:
3646
3810
  raise ValueError("只支持2或者3个list")
3647
- # Set circle and patch customizations (edge color, transparency, hatches)
3648
- for i, patch in enumerate(v.patches):
3811
+
3812
+ # Set transparency level
3813
+ for patch in v.patches:
3649
3814
  if patch:
3650
- if colors:
3651
- patch.set_facecolor(colors[i % len(colors)])
3652
- patch.set_edgecolor("none")
3653
3815
  patch.set_alpha(alpha)
3654
- if hatches:
3655
- patch.set_hatch(hatches[i % len(hatches)])
3656
- if shadow:
3657
- from matplotlib.patches import Shadow
3658
- shadow_patch = Shadow(patch, -0.02, -0.02, alpha=0.2)
3659
- ax.add_patch(shadow_patch)
3660
- # # usage:
3661
- # venn(
3662
- # [rf_features, svm_features, lasso_features],
3663
- # ["Random Forest", "SVM-RFE", "a"],
3664
- # ax=axs[0], # Specify the axes
3665
- # colors=["#BDC8E0", "#E5C0C1", "#D0E9CB"],
3666
- # edgecolor="r",
3667
- # alpha=1,
3668
- # linewidth=[1, 2, 18],# 分别设置字体大小
3669
- # linestyle=["-", "--", ":"],
3670
- # fontsize=20,
3671
- # label_baseline="top",
3672
- # subset_label_format="{:.2f}%",
3673
- # subset_fontsize=18,
3674
- # shadow=False,
3675
- # # custom_texts=["a", "b", "c"],
3676
- # )
3816
+ if 'none' in edgecolor or 0 in linewidth:
3817
+ patch.set_edgecolor("none")
3818
+ return ax
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py2ls
3
- Version: 0.2.4.5
3
+ Version: 0.2.4.7
4
4
  Summary: py(thon)2(too)ls
5
5
  Author: Jianfeng
6
6
  Author-email: Jianfeng.Liu0413@gmail.com
@@ -17,7 +17,7 @@ py2ls/.git/hooks/pre-receive.sample,sha256=pMPSuce7P9jRRBwxvU7nGlldZrRPz0ndsxAlI
17
17
  py2ls/.git/hooks/prepare-commit-msg.sample,sha256=6d3KpBif3dJe2X_Ix4nsp7bKFjkLI5KuMnbwyOGqRhk,1492
18
18
  py2ls/.git/hooks/push-to-checkout.sample,sha256=pT0HQXmLKHxt16-mSu5HPzBeZdP0lGO7nXQI7DsSv18,2783
19
19
  py2ls/.git/hooks/update.sample,sha256=jV8vqD4QPPCLV-qmdSHfkZT0XL28s32lKtWGCXoU0QY,3650
20
- py2ls/.git/index,sha256=O4t8fvweL1JsEypzrWigO2hAxCpfQwC4VOW3q8panRk,4232
20
+ py2ls/.git/index,sha256=sPKeqbWaVtDr3kILep6S-tkzgNPfGUog5UQ5meN6K-8,4232
21
21
  py2ls/.git/info/exclude,sha256=ZnH-g7egfIky7okWTR8nk7IxgFjri5jcXAbuClo7DsE,240
22
22
  py2ls/.git/logs/HEAD,sha256=8ID7WuAe_TlO9g-ARxhIJYdgdL3u3m7-1qrOanaIUlA,3535
23
23
  py2ls/.git/logs/refs/heads/main,sha256=8ID7WuAe_TlO9g-ARxhIJYdgdL3u3m7-1qrOanaIUlA,3535
@@ -173,7 +173,7 @@ py2ls/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
173
173
  py2ls/README.md,sha256=CwvJWAnSXnCnrVHlnEbrxxi6MbjbE_MT6DH2D53S818,11572
174
174
  py2ls/__init__.py,sha256=Nn8jTIvySX7t7DMJ8VNRVctTStgXGjHldOIdZ35PdW8,165
175
175
  py2ls/batman.py,sha256=E7gYofbDzN7S5oCmO_dd5Z1bxxhoYMJSD6s-VaF388E,11398
176
- py2ls/bio.py,sha256=7q-zIxGU76g9AABUcrCLW2GrowTw-ljN_8zKbjdi7p0,67677
176
+ py2ls/bio.py,sha256=HoI432AY1lXVcO2iB_1vpmpmDEj07brRNgOyLUazfxk,87655
177
177
  py2ls/brain_atlas.py,sha256=w1o5EelRjq89zuFJUNSz4Da8HnTCwAwDAZ4NU4a-bAY,5486
178
178
  py2ls/chat.py,sha256=Yr22GoIvoWhpV3m4fdwV_I0Mn77La346_ymSinR-ORA,3793
179
179
  py2ls/correlators.py,sha256=RbOaJIPLCHJtUm5SFi_4dCJ7VFUPWR0PErfK3K26ad4,18243
@@ -214,16 +214,17 @@ py2ls/export_requirements.py,sha256=x2WgUF0jYKz9GfA1MVKN-MdsM-oQ8yUeC6Ua8oCymio,
214
214
  py2ls/fetch_update.py,sha256=9LXj661GpCEFII2wx_99aINYctDiHni6DOruDs_fdt8,4752
215
215
  py2ls/freqanalysis.py,sha256=F4218VSPbgL5tnngh6xNCYuNnfR-F_QjECUUxrPYZss,32594
216
216
  py2ls/ich2ls.py,sha256=3E9R8oVpyYZXH5PiIQgT3CN5NxLe4Dwtm2LwaeacE6I,21381
217
- py2ls/ips.py,sha256=4CmSK5Ye4eHPSkTbrbS9KZ20mz-GA7xw2vEa1o1fI4k,227789
217
+ py2ls/ips.py,sha256=o3B1mv1Oscu5R32070z8j0GbcRT_K4gBIrVSUEyWdM8,234266
218
218
  py2ls/ml2ls.py,sha256=XSe2-sLNzUVSvVRkeRGfhrB_q8C49SDK1sekYC1Bats,50277
219
+ py2ls/mol.py,sha256=AZnHzarIk_MjueKdChqn1V6e4tUle3X1NnHSFA6n3Nw,10645
219
220
  py2ls/netfinder.py,sha256=RJFr80tGEJiuwEx99IBOhI5-ZuXnPdWnGUYpF7XCEwI,56426
220
221
  py2ls/ocr.py,sha256=5lhUbJufIKRSOL6wAWVLEo8TqMYSjoI_Q-IO-_4u3DE,31419
221
- py2ls/plot.py,sha256=h-pcdlQN7Aqqgxw52Rsq5Wvu8LzgiYwO1F6CBvKpTkg,145989
222
+ py2ls/plot.py,sha256=dVEKkHqLqgrKv8mx_lIeFDtRi4A9ThRFlYne6kr-jfk,153856
222
223
  py2ls/setuptools-70.1.0-py3-none-any.whl,sha256=2bi3cUVal8ip86s0SOvgspteEF8SKLukECi-EWmFomc,882588
223
224
  py2ls/sleep_events_detectors.py,sha256=bQA3HJqv5qnYKJJEIhCyhlDtkXQfIzqksnD0YRXso68,52145
224
225
  py2ls/stats.py,sha256=DMoJd8Z5YV9T1wB-4P52F5K5scfVK55DT8UP4Twcebo,38627
225
226
  py2ls/translator.py,sha256=zBeq4pYZeroqw3DT-5g7uHfVqKd-EQptT6LJ-Adi8JY,34244
226
227
  py2ls/wb_detector.py,sha256=7y6TmBUj9exCZeIgBAJ_9hwuhkDh1x_-yg4dvNY1_GQ,6284
227
- py2ls-0.2.4.5.dist-info/METADATA,sha256=z1aLD2Jcfn3klBZIptJYjHcdwMRZ4hOe9GdjsmI8bBU,20038
228
- py2ls-0.2.4.5.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
229
- py2ls-0.2.4.5.dist-info/RECORD,,
228
+ py2ls-0.2.4.7.dist-info/METADATA,sha256=G3vO4DXYQEGFPw6PeRX54YXnqHyOy9pgv6jfxxqluyg,20038
229
+ py2ls-0.2.4.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
230
+ py2ls-0.2.4.7.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.8.1
2
+ Generator: poetry-core 1.9.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any