Skip to content

Legend title size does not get updated #14

@jankaWIS

Description

@jankaWIS

Maybe it's not a CanD issue but I have not figured out why it's doing so and how to fix it. If I have a plot and want to set a fontsize, I do:

c.set_font("Lucida", size=18)

That works for all parts of the plot (which is also a bit not good -- how could I have two sizes, one for titles and one for ticks?) except for legend title. I have no idea why. Passing the size directly to matplotlib works (commented line). Here is my code and example:

from cand import Canvas, Vector, Point
import matplotlib.pyplot as plt

palette2 = ["navy", "blue", "dodgerblue","slategrey"]

# CanD
a = 6
c = Canvas(a*4+4, 20, "cm")

# set font
c.set_font("Lucida", size=18)

c.add_grid(["cond1"], 1, Point(2, 2, "cm"), Point(a*4, 18.1, "cm"), spacing=Vector(.5, 1, "cm"), unitname="grid")

# extract data
ax = c.axes["cond1"]

for i, col in enumerate(palette2):
    x, y = None, None
    y = np.arange(3)*i
    x = np.array([1,2,3])

    # plot
    ax.scatter(x,y,color=col, label=f"{col}")
    ax.set_xticks(x)

    ax.set_ylabel("y-ax")
    ax.set_xlabel("x-ax")
#    ax.legend(title="Colour", fontsize=8, title_fontsize=14)  
    ax.legend(title="Colour")  

c.show()    

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions