Skip to content
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

Feature request: refined styling of labels #1073

Open
IgorDouven opened this issue Dec 27, 2017 · 6 comments
Open

Feature request: refined styling of labels #1073

IgorDouven opened this issue Dec 27, 2017 · 6 comments

Comments

@IgorDouven
Copy link

Suppose I have a title like: "Histogram of significant p-values", and I would like the p (and only the p) to be italicised. Maybe I'm overlooking something, but I cannot find any way to do that, or more generally to style just parts of a label (which can for instance easily be done in ggplot2). It would be nice to have this feature.

@bjarthur
Copy link
Member

see http://giovineitalia.github.io/Compose.jl/latest/#Text-1

plot(x=rand(1000), Geom.histogram, Guide.title("Histogram of <i>p</i>-values"))

will leave this open, as there is a bug for Guide.title("<i>p</i>-values")

@IgorDouven
Copy link
Author

Thanks! This gave the error:

ERROR: Could not parse pango markup.

I suppose that's due to the bug? (Or a problem with Cairo?)

@Mattriks
Copy link
Member

As well as pango markup, Julia can generate symbols (including italic symbols, symbols with hats, super and subscript etc): https://docs.julialang.org/en/latest/manual/unicode-input/
There is an example here, where I mix the 2 forms:
https://discourse.julialang.org/t/plotting-histogram-on-the-y-axis-at-the-end-of-a-time-series/5381/4

@IgorDouven
Copy link
Author

Thanks, very nice indeed. I noticed that Guide.title(" p = .2 ") works, but Guide.title("p = .2") throws an error. Perhaps it is obvious why to anyone with experience in HTML -- which I don't have.

@Mattriks
Copy link
Member

Mattriks commented Jul 7, 2020

@IgorDouven Does Guide.title("𝑝= .2") work for you on Gadfly 1.3?
(It may have been fixed by GiovineItalia/Compose.jl#394?)

@IgorDouven
Copy link
Author

IgorDouven commented Jul 7, 2020

For the past years, I have been consistently using HTML syntax in Gadfly labels (so in this case, <i>p</> etc.). That works very well for me. I'm not sure I can italicize text in the editor I'm using (VSCode). But next time I run a notebook in Jupyter lab, I'll check whether your solution works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants