Plots.jl: Changing fonts in pyplot

Created on 12 Sep 2016  Â·  6Comments  Â·  Source: JuliaPlots/Plots.jl

How do I change the font face with the pyplot backend? I've set titlefont = font("Times", 14) and so on, but only the size change seems to get picked up. I'm also not having any luck directly altering the matplotlib rcParams dictionary.

PyPlot

Most helpful comment

So there was a slight problem in pyplot font families... umm.. I was never setting them! :)

dev branch:

using Plots; pyplot()
f=font(13,"cursive")
p = plot(rand(10), title="HI", titlefont=f, tickfont=f, legendfont=f, yguide="I'm a Y", guidefont=f)

tmp

I could make it easier to change the font family... but that should be a different issue.

All 6 comments

You have the right idea. Maybe "Times" isn't supported?

On Monday, September 12, 2016, Scott Thomas [email protected]
wrote:

How do I change the font face with the pyplot backend? I've set titlefont
= font("Times", 14) and so on, but only the size change seems to get
picked up. I'm also not having any luck directly altering the matplotlib
rcParams dictionary.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/tbreloff/Plots.jl/issues/482, or mute the thread
https://github.com/notifications/unsubscribe-auth/AA492qMh7X2ySGQFoq3DNvM-Rvhs1RFjks5qpVz8gaJpZM4J6n8s
.

This works fine:

using PyPlot
rc("font", family="serif")
plot(rand(20))
title("Here's the title")

But not this:

using Plots
pyplot(tickfont=font("serif"), titlefont=font("serif"))
plot(rand(20), title="Here's the title")

I have just managed to make it work by calling PyPlot.rc("font", family="serif") before plot though.

Ok thanks. Do any other fonts work? tickfont? legwndfont?

On Monday, September 12, 2016, Scott Thomas [email protected]
wrote:

I have just managed to make it work by calling PyPlot.rc("font",
family="serif") before plot though.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/tbreloff/Plots.jl/issues/482#issuecomment-246382009,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA492psW61BN7pcsr7eM8jSwOtxQI-iiks5qpW0pgaJpZM4J6n8s
.

Nope, none of those.

So there was a slight problem in pyplot font families... umm.. I was never setting them! :)

dev branch:

using Plots; pyplot()
f=font(13,"cursive")
p = plot(rand(10), title="HI", titlefont=f, tickfont=f, legendfont=f, yguide="I'm a Y", guidefont=f)

tmp

I could make it easier to change the font family... but that should be a different issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ereday picture ereday  Â·  3Comments

Cody-G picture Cody-G  Â·  3Comments

SebastianM-C picture SebastianM-C  Â·  4Comments

dancsi picture dancsi  Â·  4Comments

pkofod picture pkofod  Â·  3Comments