Change font-face in title

View: New views
8 Messages — Rating Filter:   Alert me  

Change font-face in title

by Albin Blaschka-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Dear List,

Is there a possibility to change the font-face for a part of the title
of a plot?

For example I have the following...

plot(nirs, type="l", xlab="Wellenlänge [nm]", col="darkslategray",
    main = "Spektrum Deschampsia caespitosa")

...and I would like to change the part of the title-string "Deschampsia
caespitosa" to italics? Is that possible? If yes, how?

The only possibility which came to my mind was "tricking" with the
subtitle or with using text()...but that would be ugly...

System: Both Linux and Windows, R-Version 2.7.1

Thanks in advance,
Albin Blaschka

--
---------------------------------------------------------------------
| Albin Blaschka, Mag. rer.nat - Salzburg, Austria
| http://www.albinblaschka.info   http://www.thinkanimal.info
| It's hard to live in the mountains, hard, but not hopeless!

______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: Change font-face in title

by Gabor Grothendieck :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Try this:

plot(1, type="l", xlab="Wellenlänge [nm]", col="darkslategray",
     main = ~ Spektrum ~ italic(Deschampsia ~ caespitosa))

On Sat, Jul 19, 2008 at 11:31 AM, Albin Blaschka
<albin.blaschka@...> wrote:

>
>
> Dear List,
>
> Is there a possibility to change the font-face for a part of the title of a
> plot?
>
> For example I have the following...
>
> plot(nirs, type="l", xlab="Wellenlänge [nm]", col="darkslategray",
>   main = "Spektrum Deschampsia caespitosa")
>
> ...and I would like to change the part of the title-string "Deschampsia
> caespitosa" to italics? Is that possible? If yes, how?
>
> The only possibility which came to my mind was "tricking" with the subtitle
> or with using text()...but that would be ugly...
>
> System: Both Linux and Windows, R-Version 2.7.1
>
> Thanks in advance,
> Albin Blaschka
>
> --
> ---------------------------------------------------------------------
> | Albin Blaschka, Mag. rer.nat - Salzburg, Austria
> | http://www.albinblaschka.info   http://www.thinkanimal.info
> | It's hard to live in the mountains, hard, but not hopeless!
>
> ______________________________________________
> R-help@... mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: Change font-face in title

by jholtman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is this what you want:

plot(0,main=expression(paste("test ", italic("italic"), " and more")))



On Sat, Jul 19, 2008 at 11:31 AM, Albin Blaschka
<albin.blaschka@...> wrote:

>
>
> Dear List,
>
> Is there a possibility to change the font-face for a part of the title of a
> plot?
>
> For example I have the following...
>
> plot(nirs, type="l", xlab="Wellenlänge [nm]", col="darkslategray",
>   main = "Spektrum Deschampsia caespitosa")
>
> ...and I would like to change the part of the title-string "Deschampsia
> caespitosa" to italics? Is that possible? If yes, how?
>
> The only possibility which came to my mind was "tricking" with the subtitle
> or with using text()...but that would be ugly...
>
> System: Both Linux and Windows, R-Version 2.7.1
>
> Thanks in advance,
> Albin Blaschka
>
> --
> ---------------------------------------------------------------------
> | Albin Blaschka, Mag. rer.nat - Salzburg, Austria
> | http://www.albinblaschka.info   http://www.thinkanimal.info
> | It's hard to live in the mountains, hard, but not hopeless!
>
> ______________________________________________
> R-help@... mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: Change font-face in title

by Gabor Grothendieck :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Or this which looks slightly better:

plot(1, type="l", xlab="Wellenlänge [nm]", col="darkslategray",
      main = ~ Spektrum ~ italic("Deschampsia caespitosa"))


On Sat, Jul 19, 2008 at 11:56 AM, Gabor Grothendieck
<ggrothendieck@...> wrote:

> Try this:
>
> plot(1, type="l", xlab="Wellenlänge [nm]", col="darkslategray",
>     main = ~ Spektrum ~ italic(Deschampsia ~ caespitosa))
>
> On Sat, Jul 19, 2008 at 11:31 AM, Albin Blaschka
> <albin.blaschka@...> wrote:
>>
>>
>> Dear List,
>>
>> Is there a possibility to change the font-face for a part of the title of a
>> plot?
>>
>> For example I have the following...
>>
>> plot(nirs, type="l", xlab="Wellenlänge [nm]", col="darkslategray",
>>   main = "Spektrum Deschampsia caespitosa")
>>
>> ...and I would like to change the part of the title-string "Deschampsia
>> caespitosa" to italics? Is that possible? If yes, how?
>>
>> The only possibility which came to my mind was "tricking" with the subtitle
>> or with using text()...but that would be ugly...
>>
>> System: Both Linux and Windows, R-Version 2.7.1
>>
>> Thanks in advance,
>> Albin Blaschka
>>
>> --
>> ---------------------------------------------------------------------
>> | Albin Blaschka, Mag. rer.nat - Salzburg, Austria
>> | http://www.albinblaschka.info   http://www.thinkanimal.info
>> | It's hard to live in the mountains, hard, but not hopeless!
>>
>> ______________________________________________
>> R-help@... mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: Change font-face in title

by Albin Blaschka-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

jim holtman wrote:

> Is this what you want:
>
> plot(0,main=expression(paste("test ", italic("italic"), " and more")))
>  
> On Sat, Jul 19, 2008 at 11:31 AM, Albin Blaschka
> <albin.blaschka@...> wrote:
>>
>> Dear List,
>>
>> Is there a possibility to change the font-face for a part of the title of a
>> plot?

Hello all who answered that quick!

All given examples work as wished, the one quoted above seems to give
the optically "nicest" result, at least on my good ol' IBM Thinkpad R40,
Kubuntu Hardy Heron!

best wishes from Salzburg, Austria,

Albin
--
---------------------------------------------------------------------
| Albin Blaschka, Mag. rer.nat - Salzburg, Austria
| http://www.albinblaschka.info   http://www.thinkanimal.info
| It's hard to live in the mountains, hard, but not hopeless!

______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: Change font-face in title

by Mike Prager :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

"Gabor Grothendieck" <ggrothendieck@...> wrote:
>
> plot(1, type="l", xlab="Wellenlänge [nm]", col="darkslategray",
>       main = ~ Spektrum ~ italic("Deschampsia caespitosa"))
 
That clearly works, but why?  Does the tilde cause the rest of
the text to be parsed as an expression?  This looks extremely
useful, and I am grasping for the underlying principle.

--
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.

______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: Change font-face in title

by Gabor Grothendieck :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

See ?title where its mentioned that calls are ok and a formula
is a call.  Actually the first ~ is not needed since its already
a formula.

On Tue, Jul 22, 2008 at 1:12 PM, Mike Prager <mike.prager@...> wrote:

> "Gabor Grothendieck" <ggrothendieck@...> wrote:
>>
>> plot(1, type="l", xlab="Wellenlänge [nm]", col="darkslategray",
>>       main = ~ Spektrum ~ italic("Deschampsia caespitosa"))
>
> That clearly works, but why?  Does the tilde cause the rest of
> the text to be parsed as an expression?  This looks extremely
> useful, and I am grasping for the underlying principle.
>
> --
> Mike Prager, NOAA, Beaufort, NC
> * Opinions expressed are personal and not represented otherwise.
> * Any use of tradenames does not constitute a NOAA endorsement.
>
> ______________________________________________
> R-help@... mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: Change font-face in title

by Mike Prager :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, thanks!

"Gabor Grothendieck" <ggrothendieck@...> wrote:

> See ?title where its mentioned that calls are ok and a formula
> is a call.  Actually the first ~ is not needed since its already
> a formula.
>
> On Tue, Jul 22, 2008 at 1:12 PM, Mike Prager <mike.prager@...> wrote:
> > "Gabor Grothendieck" <ggrothendieck@...> wrote:
> >>
> >> plot(1, type="l", xlab="Wellenlänge [nm]", col="darkslategray",
> >>       main = ~ Spektrum ~ italic("Deschampsia caespitosa"))
> >
> > That clearly works, but why?  Does the tilde cause the rest of
> > the text to be parsed as an expression?  This looks extremely
> > useful, and I am grasping for the underlying principle.
> >

--
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.

______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.