Re: [R] Degree symbol as axis label superscript

2021-12-01 Thread Rich Shepard

On Wed, 1 Dec 2021, ani jaya wrote:


one of my solution :
text(x,y,"\u00B0C", cex=1.1, font=2)
it will produce "°C"


Ani,

That's what I did.

Thank you,

Rich

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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: [R] Degree symbol as axis label superscript [RESOLVED]

2021-12-01 Thread Rich Shepard

On Tue, 30 Nov 2021, David Winsemius wrote:


There's nothing special about following a digit. You can have it follow
anything. Since you were going to need to quote the parentheses anywa,
then have it superscripted above the level of the paren:
plot(1,1, ylab = expression(Temperature~"("^degree*C*")")   )


Thank you, David. I tried something like that missed the correct quoting.

Regards,

Rich

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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: [R] Degree symbol as axis label superscript

2021-11-30 Thread Bert Gunter
Yes, but I should acknowledge my ignorance in not realizing that "\u00b0"
(hex 176) is a simpler way to get the character in R without the OS tool
than intToUtf8() .  If you need math notation beyond simple symbol
characters, plotmath is certainly indispensable.

Bert

On Tue, Nov 30, 2021 at 7:51 PM Andrew Simmons  wrote:

> Using the degree character seems perfectly legit to me. The reason I
> suggest looking at plotmath is that I think plotmath is easier to read
> (that is, if you're escaping your characters with \u), and because for
> anything more complicated like set notation, big sums, integrals, you'll
> need to get used to plotmath to make your labels. Either way, nice
> suggestion, both work perfectly well for this situation
>
> On Tue, Nov 30, 2021, 16:24 Bert Gunter  wrote:
>
>> True, but unnecessary with UTF-8 encodings of unicode (subject to some
>> caveats, though):
>>
>> plot(1:5, runif(5),xlab = "Temp (°F)", ylab = "result")
>>
>> should work fine, where the º ("degree") symbol was inserted by the
>> symbol insertion facility on my Mac. Windows has something similar.
>> See the comments in the plotmath documentation just before the
>> examples for more details on this, along with some caveats about the
>> need for a suitable display/plot device.
>>
>> More laboriously, but perhaps more informatively, one can look up
>> "unicode code point for degree symbol" to find that it is decimal 176.
>> Then R's intToUtf8() function converts this to the UTF-8 encoding that
>> **should** display as a "degree" symbol, subject to the above
>> referenced caveats.
>> Hence:
>> > intToUtf8(176)
>> [1] "°"  ##degree character
>>
>> ## So, for example, you can do:
>> > degrF <-paste0(intToUtf8(176),"F")
>> > degrF
>> [1] "°F" ("degrees F")
>>
>> > plot(1:5, runif(5),xlab = paste0("Temp (", degrF,")"), ylab = "result")
>>
>> As Andrew said, you can use plotmath to do this, too; it just isn't
>> needed for simple insertion of "standard" symbols.
>>
>> NOTE: As I am far from an expert on all of this, I would appreciate
>> clarification or correction of any errors or misstatements in the
>> above.
>>
>> Bert Gunter
>>
>>
>> On Tue, Nov 30, 2021 at 11:34 AM Andrew Simmons 
>> wrote:
>> >
>> > Excuse my brevity, but take a look at ?plotmath
>> >
>> > It has tons of tips for making pretty labels
>> >
>> > On Tue, Nov 30, 2021, 14:05 Rich Shepard 
>> wrote:
>> >
>> > > I want to present the temperature on the Y-axis label as 'Water
>> Temperature
>> > > (oC)' with the degree symbol as a superscript.
>> > >
>> > > My web search found a couple of methods; one put the entire example
>> string
>> > > in the axis label, the other is close, but still incorrect.
>> > >
>> > > Source example:
>> > > #define expression with superscript
>> > > x_expression <- expression(x^3 ~ variable ~ label)
>> > > # The example axis label is:
>> > > 'X3 variable label' (with the 3 as a superscript)
>> > >
>> > > My use:
>> > > # Set degree symbol as superscript in plot's y axis:
>> > > y_expression <- expression(^o ~ C)
>> > >
>> > > R's error message:
>> > > Error in source("../scripts/all_temp_plots.r") :
>> > >../scripts/all_temp_plots.r:10:28: unexpected '^'
>> > > 9: # Set degree symbol as superscript in plot's y axis:
>> > > 10: y_expression <- expression(^
>> > > ^
>> > >
>> > > What is the proper way to display a degree symbol in a plot's axis
>> label?
>> > >
>> > > Rich
>> > >
>> > > __
>> > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> > > 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.
>> > >
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > __
>> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> > 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.
>>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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: [R] Degree symbol as axis label superscript

2021-11-30 Thread Andrew Simmons
Using the degree character seems perfectly legit to me. The reason I
suggest looking at plotmath is that I think plotmath is easier to read
(that is, if you're escaping your characters with \u), and because for
anything more complicated like set notation, big sums, integrals, you'll
need to get used to plotmath to make your labels. Either way, nice
suggestion, both work perfectly well for this situation

On Tue, Nov 30, 2021, 16:24 Bert Gunter  wrote:

> True, but unnecessary with UTF-8 encodings of unicode (subject to some
> caveats, though):
>
> plot(1:5, runif(5),xlab = "Temp (°F)", ylab = "result")
>
> should work fine, where the º ("degree") symbol was inserted by the
> symbol insertion facility on my Mac. Windows has something similar.
> See the comments in the plotmath documentation just before the
> examples for more details on this, along with some caveats about the
> need for a suitable display/plot device.
>
> More laboriously, but perhaps more informatively, one can look up
> "unicode code point for degree symbol" to find that it is decimal 176.
> Then R's intToUtf8() function converts this to the UTF-8 encoding that
> **should** display as a "degree" symbol, subject to the above
> referenced caveats.
> Hence:
> > intToUtf8(176)
> [1] "°"  ##degree character
>
> ## So, for example, you can do:
> > degrF <-paste0(intToUtf8(176),"F")
> > degrF
> [1] "°F" ("degrees F")
>
> > plot(1:5, runif(5),xlab = paste0("Temp (", degrF,")"), ylab = "result")
>
> As Andrew said, you can use plotmath to do this, too; it just isn't
> needed for simple insertion of "standard" symbols.
>
> NOTE: As I am far from an expert on all of this, I would appreciate
> clarification or correction of any errors or misstatements in the
> above.
>
> Bert Gunter
>
>
> On Tue, Nov 30, 2021 at 11:34 AM Andrew Simmons 
> wrote:
> >
> > Excuse my brevity, but take a look at ?plotmath
> >
> > It has tons of tips for making pretty labels
> >
> > On Tue, Nov 30, 2021, 14:05 Rich Shepard 
> wrote:
> >
> > > I want to present the temperature on the Y-axis label as 'Water
> Temperature
> > > (oC)' with the degree symbol as a superscript.
> > >
> > > My web search found a couple of methods; one put the entire example
> string
> > > in the axis label, the other is close, but still incorrect.
> > >
> > > Source example:
> > > #define expression with superscript
> > > x_expression <- expression(x^3 ~ variable ~ label)
> > > # The example axis label is:
> > > 'X3 variable label' (with the 3 as a superscript)
> > >
> > > My use:
> > > # Set degree symbol as superscript in plot's y axis:
> > > y_expression <- expression(^o ~ C)
> > >
> > > R's error message:
> > > Error in source("../scripts/all_temp_plots.r") :
> > >../scripts/all_temp_plots.r:10:28: unexpected '^'
> > > 9: # Set degree symbol as superscript in plot's y axis:
> > > 10: y_expression <- expression(^
> > > ^
> > >
> > > What is the proper way to display a degree symbol in a plot's axis
> label?
> > >
> > > Rich
> > >
> > > __
> > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > > 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.
> > >
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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: [R] Degree symbol as axis label superscript

2021-11-30 Thread ani jaya
one of my solution :

text(x,y,"\u00B0C", cex=1.1, font=2)

it will produce "°C"

text(x,y,"\u00B3C", cex=1.1, font=2)
it will produce "superscript(3)C"

so basically change the character after the "\u00B..." will produce
the superscript.

Best, Ani

On Wed, Dec 1, 2021 at 4:05 AM Rich Shepard  wrote:
>
> I want to present the temperature on the Y-axis label as 'Water Temperature
> (oC)' with the degree symbol as a superscript.
>
> My web search found a couple of methods; one put the entire example string
> in the axis label, the other is close, but still incorrect.
>
> Source example:
> #define expression with superscript
> x_expression <- expression(x^3 ~ variable ~ label)
> # The example axis label is:
> 'X3 variable label' (with the 3 as a superscript)
>
> My use:
> # Set degree symbol as superscript in plot's y axis:
> y_expression <- expression(^o ~ C)
>
> R's error message:
> Error in source("../scripts/all_temp_plots.r") :
>../scripts/all_temp_plots.r:10:28: unexpected '^'
> 9: # Set degree symbol as superscript in plot's y axis:
> 10: y_expression <- expression(^
> ^
>
> What is the proper way to display a degree symbol in a plot's axis label?
>
> Rich
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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: [R] Degree symbol as axis label superscript [RESOLVED]

2021-11-30 Thread David Winsemius



On 11/30/21 1:22 PM, Rich Shepard wrote:

On Tue, 30 Nov 2021, David Winsemius wrote:


Really? What was wrong with this?
plot(1, 1, xlab=expression(32^degree) )  # the example given on 
?plotmath


David,

Absolutely nothing. When there's no specific degree value in the label
because the axis represents a range of values there's no digit preceeding
the ^ symbol.

The axis label is 'Temperature (oC)' with the degree symbol preceeding a
character, not following a specific digit.



There's nothing special about following a digit. You can have it follow 
anything. Since you were going to need to quote the parentheses anywa, 
then have it superscripted above the level of the paren:



plot(1,1, ylab = expression(Temperature~"("^degree*C*")")   )

--

David.



Rich

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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: [R] Degree symbol as axis label superscript

2021-11-30 Thread Bert Gunter
True, but unnecessary with UTF-8 encodings of unicode (subject to some
caveats, though):

plot(1:5, runif(5),xlab = "Temp (°F)", ylab = "result")

should work fine, where the º ("degree") symbol was inserted by the
symbol insertion facility on my Mac. Windows has something similar.
See the comments in the plotmath documentation just before the
examples for more details on this, along with some caveats about the
need for a suitable display/plot device.

More laboriously, but perhaps more informatively, one can look up
"unicode code point for degree symbol" to find that it is decimal 176.
Then R's intToUtf8() function converts this to the UTF-8 encoding that
**should** display as a "degree" symbol, subject to the above
referenced caveats.
Hence:
> intToUtf8(176)
[1] "°"  ##degree character

## So, for example, you can do:
> degrF <-paste0(intToUtf8(176),"F")
> degrF
[1] "°F" ("degrees F")

> plot(1:5, runif(5),xlab = paste0("Temp (", degrF,")"), ylab = "result")

As Andrew said, you can use plotmath to do this, too; it just isn't
needed for simple insertion of "standard" symbols.

NOTE: As I am far from an expert on all of this, I would appreciate
clarification or correction of any errors or misstatements in the
above.

Bert Gunter


On Tue, Nov 30, 2021 at 11:34 AM Andrew Simmons  wrote:
>
> Excuse my brevity, but take a look at ?plotmath
>
> It has tons of tips for making pretty labels
>
> On Tue, Nov 30, 2021, 14:05 Rich Shepard  wrote:
>
> > I want to present the temperature on the Y-axis label as 'Water Temperature
> > (oC)' with the degree symbol as a superscript.
> >
> > My web search found a couple of methods; one put the entire example string
> > in the axis label, the other is close, but still incorrect.
> >
> > Source example:
> > #define expression with superscript
> > x_expression <- expression(x^3 ~ variable ~ label)
> > # The example axis label is:
> > 'X3 variable label' (with the 3 as a superscript)
> >
> > My use:
> > # Set degree symbol as superscript in plot's y axis:
> > y_expression <- expression(^o ~ C)
> >
> > R's error message:
> > Error in source("../scripts/all_temp_plots.r") :
> >../scripts/all_temp_plots.r:10:28: unexpected '^'
> > 9: # Set degree symbol as superscript in plot's y axis:
> > 10: y_expression <- expression(^
> > ^
> >
> > What is the proper way to display a degree symbol in a plot's axis label?
> >
> > Rich
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
> >
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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: [R] Degree symbol as axis label superscript [RESOLVED]

2021-11-30 Thread Rich Shepard

On Tue, 30 Nov 2021, David Winsemius wrote:


Really? What was wrong with this?
plot(1, 1, xlab=expression(32^degree) )  # the example given on ?plotmath


David,

Absolutely nothing. When there's no specific degree value in the label
because the axis represents a range of values there's no digit preceeding
the ^ symbol.

The axis label is 'Temperature (oC)' with the degree symbol preceeding a
character, not following a specific digit.

Rich

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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: [R] Degree symbol as axis label superscript [RESOLVED]

2021-11-30 Thread Rich Shepard

On Tue, 30 Nov 2021, Bill Dunlap wrote:


The following makes degree signs appropriately, as shown in ?plotmath:
   plot(68, 20, xlab=expression(degree*F), ylab=expression(degree*C))
If you want the word "degree" spelled out, put it in quotes.


Bill,

I missed that last point; thought it was always spelled out.

Thanks,

Rich

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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: [R] Degree symbol as axis label superscript [RESOLVED]

2021-11-30 Thread Bill Dunlap
The following makes degree signs appropriately, as shown in ?plotmath:
plot(68, 20, xlab=expression(degree*F), ylab=expression(degree*C))
If you want the word "degree" spelled out, put it in quotes.

-Bill

On Tue, Nov 30, 2021 at 12:31 PM Rich Shepard 
wrote:

> On Tue, 30 Nov 2021, Rich Shepard wrote:
>
> > Thanks, Andrew. I will.
>
> plotmath didn't have the solution; the use of the LaTeX ^ for a superscript
> had a character or number preceeding it. Using 'degree' prints that string
> on the axis.
>
> What does work is using the unicode for the degree symbol as prefix to
> either C or F. In my case:
> ylab('Water Temperature (\u00B0C)')
> does the job.
>
> I found this solution with the DDG search string, 'degree symbol in R plot
> axis label'. This stackexchange thread has the answer:
> <
> https://stackoverflow.com/questions/51799118/writing-the-symbol-degrees-celsius-in-axis-titles-with-r-plotly
> >
>
> Regards,
>
> Rich
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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: [R] Degree symbol as axis label superscript [RESOLVED]

2021-11-30 Thread David Winsemius



On 11/30/21 12:29 PM, Rich Shepard wrote:

On Tue, 30 Nov 2021, Rich Shepard wrote:


Thanks, Andrew. I will.


plotmath didn't have the solution; 



Really? What was wrong with this?


plot(1, 1, xlab=expression(32^degree) )  # the example given on ?plotmath


--

David.




the use of the LaTeX ^ for a superscript
had a character or number preceeding it. Using 'degree' prints that 
string

on the axis.

What does work is using the unicode for the degree symbol as prefix to
either C or F. In my case:
ylab('Water Temperature (\u00B0C)')
does the job.

I found this solution with the DDG search string, 'degree symbol in R 
plot

axis label'. This stackexchange thread has the answer:
 



Regards,

Rich

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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: [R] Degree symbol as axis label superscript [RESOLVED]

2021-11-30 Thread Andrew Simmons
I think you have to not put the word degree in quotes, something like:


graphics::plot(
x = 1,

xlab = quote(
32 * degree
)
)


works for me, though yours seems like a good solution too

On Tue, Nov 30, 2021 at 3:31 PM Rich Shepard 
wrote:

> On Tue, 30 Nov 2021, Rich Shepard wrote:
>
> > Thanks, Andrew. I will.
>
> plotmath didn't have the solution; the use of the LaTeX ^ for a superscript
> had a character or number preceeding it. Using 'degree' prints that string
> on the axis.
>
> What does work is using the unicode for the degree symbol as prefix to
> either C or F. In my case:
> ylab('Water Temperature (\u00B0C)')
> does the job.
>
> I found this solution with the DDG search string, 'degree symbol in R plot
> axis label'. This stackexchange thread has the answer:
> <
> https://stackoverflow.com/questions/51799118/writing-the-symbol-degrees-celsius-in-axis-titles-with-r-plotly
> >
>
> Regards,
>
> Rich
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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: [R] Degree symbol as axis label superscript [RESOLVED]

2021-11-30 Thread Rich Shepard

On Tue, 30 Nov 2021, Rich Shepard wrote:


Thanks, Andrew. I will.


plotmath didn't have the solution; the use of the LaTeX ^ for a superscript
had a character or number preceeding it. Using 'degree' prints that string
on the axis.

What does work is using the unicode for the degree symbol as prefix to
either C or F. In my case:
ylab('Water Temperature (\u00B0C)')
does the job.

I found this solution with the DDG search string, 'degree symbol in R plot
axis label'. This stackexchange thread has the answer:


Regards,

Rich

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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: [R] Degree symbol as axis label superscript

2021-11-30 Thread Rich Shepard

On Tue, 30 Nov 2021, Andrew Simmons wrote:


Excuse my brevity, but take a look at ?plotmath
It has tons of tips for making pretty labels


Thanks, Andrew. I will.

Rich

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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: [R] Degree symbol as axis label superscript

2021-11-30 Thread Andrew Simmons
Excuse my brevity, but take a look at ?plotmath

It has tons of tips for making pretty labels

On Tue, Nov 30, 2021, 14:05 Rich Shepard  wrote:

> I want to present the temperature on the Y-axis label as 'Water Temperature
> (oC)' with the degree symbol as a superscript.
>
> My web search found a couple of methods; one put the entire example string
> in the axis label, the other is close, but still incorrect.
>
> Source example:
> #define expression with superscript
> x_expression <- expression(x^3 ~ variable ~ label)
> # The example axis label is:
> 'X3 variable label' (with the 3 as a superscript)
>
> My use:
> # Set degree symbol as superscript in plot's y axis:
> y_expression <- expression(^o ~ C)
>
> R's error message:
> Error in source("../scripts/all_temp_plots.r") :
>../scripts/all_temp_plots.r:10:28: unexpected '^'
> 9: # Set degree symbol as superscript in plot's y axis:
> 10: y_expression <- expression(^
> ^
>
> What is the proper way to display a degree symbol in a plot's axis label?
>
> Rich
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Degree symbol as axis label superscript

2021-11-30 Thread Rich Shepard

I want to present the temperature on the Y-axis label as 'Water Temperature
(oC)' with the degree symbol as a superscript.

My web search found a couple of methods; one put the entire example string
in the axis label, the other is close, but still incorrect.

Source example:
#define expression with superscript
x_expression <- expression(x^3 ~ variable ~ label)
# The example axis label is:
'X3 variable label' (with the 3 as a superscript)

My use:
# Set degree symbol as superscript in plot's y axis:
y_expression <- expression(^o ~ C)

R's error message:
Error in source("../scripts/all_temp_plots.r") :
  ../scripts/all_temp_plots.r:10:28: unexpected '^'
9: # Set degree symbol as superscript in plot's y axis:
10: y_expression <- expression(^
   ^

What is the proper way to display a degree symbol in a plot's axis label?

Rich

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.