-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Legend title size does not get updated #14
Comments
Thanks for the bug report. Yes, this is a CanD issue, and it does need to be fixed. Right now, CanD doesn't have great support for matplotlib legends. For right now, as a workaround, you might be able to construct a legend using c.add_legend() instead of ax.legend(). Alternatively, as a workaround, you could remove the title on the legend, and add a title for it using c.add_text(). |
(Also, as a side note, it might be easier to use add_axis instead of add_grid here, since you only have one axis.) |
Thanks, glad it's not just me :D. I think that for a workaround, this works: And about your proposed solution, that would only work if only one legend is present in the entire canvas, no? Like having two plots there each with a legend would break it, one couldn't use Could you please elaborate more on how to use the font and fontsize in CanD in general? Like if one would want to have first level titles and suptitles and ticks... I guess one could have a workaround with (as a side note -- it was part of a bigger figure and I just crop this one out and was lazy to make it pretty, sorry, and thanks for pointing it our :)) |
You can use c.add_legend to add as many legends as you want! The best way to add titles/suptitles/etc in CanD is via add_text(). Matplotlib has some defaults built in with default positions and default formatting to make thing simpler. CanD lets you have as many titles as you want with whatever sizes/positioning you want. You can set the font size for ticks and titles with c.set_font() using the ticksize and titlesize arguments. Instead of c.ax([axis name]).set_title("Title"), just call c.add_text("Title", Point(.5, 1.1, "axis_[axis name]")) |
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:
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:
The text was updated successfully, but these errors were encountered: