-
Notifications
You must be signed in to change notification settings - Fork 250
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
font family and color in guide.annotation #1323
Comments
Gadfly plots are drawn using the graphics package Compose.jl. The Gadfly font defaults: Line 3 in aa4855c
|
Thank you, that's very helpful. I can't find here how to change the font
color (in particular, how to make that match the color of the other labels
in the plot). Is that possible? If not, that's not a big problem. But it
would be nice to have this option.
Op ma 30 sep. 2019 om 10:01 schreef Mattriks <notifications@github.com>:
… Gadfly plots are drawn using the graphics package Compose.jl
<https://github.com/GiovineItalia/Compose.jl>.
There are some examples of text in Compose here
<http://giovineitalia.github.io/Compose.jl/latest/tutorial/#Text-1> and
here
***@***.***)-1>.
Also in the Gadfly docs for Geom.abline
***@***.***)-1>
(p1 uses Guide.annotation).
The font() property should work, assuming that font is available.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1323?email_source=notifications&email_token=AIFACLHR233JRHQP4DPYQDLQMGW45A5CNFSM4I3XJCAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD74ZE2Y#issuecomment-536449643>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIFACLHP2Z5WNK7HEMGZW4LQMGW45ANCNFSM4I3XJCAA>
.
|
For Gadfly, the text properties (including color) for plot labels are found here. Does that solve "not matching the color of the other labels"? If not, please provide example code of what you are doing. |
Well, I could of course change the color of the "other" labels to black. Then the color would match the labels generated via I don't have any special use case in mind. A MWE of what I'm doing is this:
The label XXX appears in a darker font than the other ones. |
In this example, I've changed the font color of the Compose.text to Gadfly's using Colors
p1 = plot(x=xcoords, y=ycoords, color=cols, Geom.point, Guide.title("Title"),
Guide.annotation(compose(context(), Compose.text(0.4115, 0.89, "XXX"), fontsize(10pt),
font("Helvetica-Neue"), fill("black"), stroke(nothing)) ))
p2 = plot(x=xcoords, y=ycoords, color=cols, Geom.point, Guide.title("Title"),
Guide.annotation(compose(context(), Compose.text(0.4115, 0.89, "XXX"), fontsize(10pt),
font("Helvetica-Neue"), fill(colorant"#564a55"), stroke(nothing)) ))
hstack(p1, p2) Does that help? |
That solves the problem! Many thanks!
Op di 1 okt. 2019 om 12:20 schreef Mattriks <notifications@github.com>:
… In this example, I've changed the font color of the Compose.text to
Gadfly's major_label_font color.
using Colors
p1 = plot(x=xcoords, y=ycoords, color=cols, Geom.point, Guide.title("Title"),
Guide.annotation(compose(context(), Compose.text(0.4115, 0.89, "XXX"), fontsize(10pt),
font("Helvetica-Neue"), fill("black"), stroke(nothing)) ))
p2 = plot(x=xcoords, y=ycoords, color=cols, Geom.point, Guide.title("Title"),
Guide.annotation(compose(context(), Compose.text(0.4115, 0.89, "XXX"), fontsize(10pt),
font("Helvetica-Neue"), fill(colorant"#564a55"), stroke(nothing)) ))hstack(p1, p2)
Does that help?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1323?email_source=notifications&email_token=AIFACLE7X5RLW6NKV5F4NK3QMMP5PA5CNFSM4I3XJCAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAAYRVI#issuecomment-536971477>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIFACLBIL4FVQ7HONC46AT3QMMP5PANCNFSM4I3XJCAA>
.
|
I'm using
Guide.annotation
to add some text to a plot. As far as I can see, both the font family is different from the one Gadfly uses by default and also the color of the font is different (black instead of gray). I tried correcting the former by usingfont("Helvetica Neue")
, but that doesn't seem to do anything. And I wasn't able to find out how I can change the font color (if that can be done at all; changing the font size of the annotation works fine). I'd be grateful for any advice.The text was updated successfully, but these errors were encountered: