unanticipated axis labels

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

unanticipated axis labels

Richard M. Heiberger
library(lattice)
library(latticeExtra)

barchart(matrix(c(1:6, 5:6)), main="unanticipated left axis labels", ylab="unanticipated inside labels") +
  latticeExtra::layer(panel.axis("left", half=FALSE, labels=1:8        ))

barchart(matrix(c(1:6, 5:6)), main="ok 1", ylab="anticipated") +
  latticeExtra::layer(panel.axis("left", half=FALSE, labels=1:8, at=1:8))
                                                           
barchart(matrix(c(1:6, 5:6)), main="ok 2", ylab="anticipated") +
  latticeExtra::layer(panel.axis("left", half=FALSE,             at=1:8))

barchart(matrix(c(1:6, 5:6)), main="ok 3", ylab="anticipated") +
  latticeExtra::layer(panel.axis("left", half=FALSE                    ))



______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: unanticipated axis labels

Deepayan Sarkar
On Tue, Mar 16, 2021 at 11:35 PM Richard M. Heiberger <[hidden email]> wrote:
>
> library(lattice)
> library(latticeExtra)
>
> barchart(matrix(c(1:6, 5:6)), main="unanticipated left axis labels", ylab="unanticipated inside labels") +
>   latticeExtra::layer(panel.axis("left", half=FALSE, labels=1:8        ))

So to summarize, your problem case happens when you explicitly specify
'labels' but not 'at' in panel.axis(), right?

Unfortunately, this is not intended to work at all, so what you are
seeing is undefined behaviour. This is hinted at, but not quite
explicitly spelled out, in the documentation. I will fix that, and
maybe add a warning as well.

-Deepayan

> barchart(matrix(c(1:6, 5:6)), main="ok 1", ylab="anticipated") +
>   latticeExtra::layer(panel.axis("left", half=FALSE, labels=1:8, at=1:8))
>
> barchart(matrix(c(1:6, 5:6)), main="ok 2", ylab="anticipated") +
>   latticeExtra::layer(panel.axis("left", half=FALSE,             at=1:8))
>
> barchart(matrix(c(1:6, 5:6)), main="ok 3", ylab="anticipated") +
>   latticeExtra::layer(panel.axis("left", half=FALSE                    ))
>
>
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: [External] unanticipated axis labels

Richard M. Heiberger
exactly!
a warning when running would be very helpful.

Thank you.

Rich

> On Mar 17, 2021, at 02:41, Deepayan Sarkar <[hidden email]> wrote:
>
> On Tue, Mar 16, 2021 at 11:35 PM Richard M. Heiberger <[hidden email]> wrote:
>>
>> library(lattice)
>> library(latticeExtra)
>>
>> barchart(matrix(c(1:6, 5:6)), main="unanticipated left axis labels", ylab="unanticipated inside labels") +
>>  latticeExtra::layer(panel.axis("left", half=FALSE, labels=1:8        ))
>
> So to summarize, your problem case happens when you explicitly specify
> 'labels' but not 'at' in panel.axis(), right?
>
> Unfortunately, this is not intended to work at all, so what you are
> seeing is undefined behaviour. This is hinted at, but not quite
> explicitly spelled out, in the documentation. I will fix that, and
> maybe add a warning as well.
>
> -Deepayan
>
>> barchart(matrix(c(1:6, 5:6)), main="ok 1", ylab="anticipated") +
>>  latticeExtra::layer(panel.axis("left", half=FALSE, labels=1:8, at=1:8))
>>
>> barchart(matrix(c(1:6, 5:6)), main="ok 2", ylab="anticipated") +
>>  latticeExtra::layer(panel.axis("left", half=FALSE,             at=1:8))
>>
>> barchart(matrix(c(1:6, 5:6)), main="ok 3", ylab="anticipated") +
>>  latticeExtra::layer(panel.axis("left", half=FALSE                    ))
>>
>>
>>
>> ______________________________________________
>> [hidden email] 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.

______________________________________________
[hidden email] 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.