1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Set fontsize of axis and legends in seaborn.objects

Discussão em 'Python' iniciado por Stack, Setembro 13, 2024.

  1. Stack

    Stack Membro Participativo

    I am using seaborn.objects to create a faceted plot. I have read the documentation but setting font size argument does not do anything (Seaborn.objects Documentation)

    My Df:

    {'storage': {0: '4 °C',
    1: '4 °C',
    2: 'fresh',
    3: 'fresh',
    4: 'frozen',
    5: 'frozen',
    6: '4 °C',
    7: '4 °C',
    8: 'fresh',
    9: 'fresh',
    10: 'frozen',
    11: 'frozen',
    12: '4 °C',
    13: '4 °C',
    14: 'fresh',
    15: 'fresh',
    21: 'fresh'},
    'time': {0: '4 h',
    1: '6 h',
    2: '4 h',
    3: '6 h',
    4: '4 h',
    5: '6 h',
    6: '4 h',
    7: '6 h',
    8: '4 h',
    9: '6 h',
    10: '4 h',
    11: '6 h',
    12: '4 h',
    13: '6 h',
    14: '4 h',
    15: '6 h',
    21: '6 h'},
    'Predicted Class': {0: 'resting',
    1: 'resting',
    2: 'resting',
    3: 'resting',
    4: 'resting',
    5: 'resting',
    6: 'swollen',
    7: 'swollen',
    8: 'swollen',
    9: 'swollen',
    10: 'swollen',
    11: 'swollen',
    12: 'germling',
    13: 'germling',
    14: 'germling',
    15: 'germling',
    21: 'hyphae'},
    '%': {0: 25.57,
    1: 4.87,
    2: 12.19,
    3: 4.87,
    4: 99.87,
    5: 99.77,
    6: 72.89,
    7: 60.23,
    8: 86.93,
    9: 42.83,
    10: 0.13,
    11: 0.23,
    12: 1.54,
    13: 34.9,
    14: 0.88,
    15: 51.4,
    21: 0.9}}


    import seaborn.objects as so


    # Create the Plot object
    plot = so.Plot(counts2_melted_df, x="storage", y="%", color="Predicted Class", text="%")

    # Facet the plot by 'strain' with an increased height for each row
    plot = plot.layout(size=(8,8)) # Adjust the scale factor for height

    # Add the bar and stack
    plot = plot.add(so.Bar(), so.Stack()).scale(color=color_palette)

    plot = plot.label(x="Storage Condition", y="Percentage of Morphotype (%)")

    plot= plot.theme({"axes.facecolor": "w", "axes.edgecolor": "slategray"})

    plot = plot.facet(row="time")

    #Render the plot to get the underlying matplotlib axes
    plot.plot()


    I have tried

    plot = plot.label(x="Storage Condition", fontsize=28)
    plot = plot.label(y="Percentage of Morphotype (%)", fontsize=28)


    Any suggestions? I need to increase the font size drastically to make the plot readable on a poster.

    I would be grateful for any help!

    Continue reading...

Compartilhe esta Página