Skip to content

Undesired tick marks on top, right axes

9 messages · Bert Gunter, Rich Shepard

#
Every lattice xyplot() I've created before this one has tick marks on only
the left and bottom axes. The current plot has sprouted tick marks on the
top and right side, too, and I want to remove them. I've not found an answer
to this issue in Deepayan's book or on the web. I would appreciate also
learning why the extra tick marks appeared. The dput() data are included.

   The plotting command;

rain.all.sum <- xyplot(Sum ~ Month, data=agg.all, col = 'black', type = 'h',
                        main = 'Monthly Total Precipitation\n2005-2018',
                        xlab = 'Year and Month', ylab = 'Precipitation (in)',
                        scales = list(x = list(at = seq(1,162,by=6), cex = 0.7, rot = 90)))

plot(rain.all.sum)

   The data:

structure(list(Month = structure(1:162, .Label = c("2005-01", 
"2005-02", "2005-03", "2005-04", "2005-05", "2005-06", "2005-07", 
"2005-08", "2005-09", "2005-10", "2005-11", "2005-12", "2006-01", 
"2006-02", "2006-03", "2006-04", "2006-05", "2006-06", "2006-07", 
"2006-08", "2006-09", "2006-10", "2006-11", "2006-12", "2007-01", 
"2007-02", "2007-03", "2007-04", "2007-05", "2007-06", "2007-07", 
"2007-08", "2007-09", "2007-10", "2007-11", "2007-12", "2008-01", 
"2008-02", "2008-03", "2008-04", "2008-05", "2008-06", "2008-07", 
"2008-08", "2008-09", "2008-10", "2008-11", "2008-12", "2009-01", 
"2009-02", "2009-03", "2009-04", "2009-05", "2009-06", "2009-07", 
"2009-08", "2009-09", "2009-10", "2009-11", "2009-12", "2010-01", 
"2010-02", "2010-03", "2010-04", "2010-05", "2010-06", "2010-07", 
"2010-08", "2010-09", "2010-10", "2010-11", "2010-12", "2011-01", 
"2011-02", "2011-03", "2011-04", "2011-05", "2011-06", "2011-07", 
"2011-08", "2011-09", "2011-10", "2011-11", "2011-12", "2012-01", 
"2012-02", "2012-03", "2012-04", "2012-05", "2012-06", "2012-07", 
"2012-08", "2012-09", "2012-10", "2012-11", "2012-12", "2013-01", 
"2013-02", "2013-03", "2013-04", "2013-05", "2013-06", "2013-07", 
"2013-08", "2013-09", "2013-10", "2013-11", "2013-12", "2014-01", 
"2014-02", "2014-03", "2014-04", "2014-05", "2014-06", "2014-07", 
"2014-08", "2014-09", "2014-10", "2014-11", "2014-12", "2015-01", 
"2015-02", "2015-03", "2015-04", "2015-05", "2015-06", "2015-07", 
"2015-08", "2015-09", "2015-10", "2015-11", "2015-12", "2016-01", 
"2016-02", "2016-03", "2016-04", "2016-05", "2016-06", "2016-07", 
"2016-08", "2016-09", "2016-10", "2016-11", "2016-12", "2017-01", 
"2017-02", "2017-03", "2017-04", "2017-05", "2017-06", "2017-07", 
"2017-08", "2017-09", "2017-10", "2017-11", "2017-12", "2018-01", 
"2018-02", "2018-03", "2018-04", "2018-05", "2018-06"), class = "factor"),
     Sum = c(53.51, 24.2, 88.54, 72.85, 77.3, 49.19, 8.77, 5.75,
     27.83, 79.75, 123.89, 168.29, 229.69, 70.91, 74.15, 62.3,
     43.56, 35.08, 3.6, 2.76, 26.83, 47.72, 293.23, 139.84, 103.48,
     120.91, 85.96, 55.91, 26.56, 29.44, 9.9, 15.38, 33.47, 93.6,
     105.61, 277.41, 279.38, 144.26, 220.88, 149.75, 82.28, 55.87,
     5.29, 52.27, 21.1, 64.76, 182.31, 207.13, 196.29, 89.27,
     187.72, 111.67, 111.72, 38.19, 6.07, 15.25, 52.46, 127.75,
     208.43, 146.62, 169.34, 94.54, 154.21, 131.39, 151.27, 135.46,
     9.98, 8.72, 86.67, 142.04, 225.61, 274.93, 196.68, 153.24,
     263.54, 231.49, 122.23, 58.26, 34.65, 2.96, 28.21, 103.92,
     217.52, 166.16, 305.27, 168.73, 333.28, 145.68, 101.2, 127.77,
     15.41, 1.85, 3.49, 245.99, 272.35, 297.05, 177.17, 105.71,
     118.44, 136.34, 161.01, 53.31, 1.15, 23.43, 200.97, 69.12,
     158.51, 131.67, 156.95, 266.38, 291.7, 147.15, 101.49, 78.89,
     26.99, 24.35, 35.76, 210.2, 225.55, 282.85, 153.91, 148.13,
     187.03, 133.99, 62.28, 17.58, 13.41, 35.58, 47.04, 154.92,
     317.77, 604.04, 288.91, 210.86, 266.04, 121.62, 78.17, 85.96,
     29.84, 7.02, 72.13, 404.33, 247.71, 255.5, 138.22, 339.5,
     368.99, 209.41, 110.08, 63.9, 0.62, 6.97, 133.75, 227.1,
     312.99, 178.58, 255.8, 155.05, 135.27, 225.55, 15.23, 1.58
     ), Median = c(0.01, 0, 0, 0.1, 0.1, 0, 0, 0, 0, 0.02, 0.1,
     0.04, 0.5, 0, 0.1, 0.07, 0, 0, 0, 0, 0, 0, 0.57, 0.03, 0,
     0.2, 0.055, 0, 0, 0, 0, 0, 0, 0, 0, 0.21, 0.21, 0.02, 0.2,
     0.11, 0.02, 0, 0, 0, 0, 0, 0.1, 0.165, 0.01, 0.01, 0.15,
     0.01, 0, 0, 0, 0, 0, 0.02, 0.125, 0, 0.1, 0.08, 0.055, 0.1,
     0.13, 0.01, 0, 0, 0, 0, 0.2, 0.17, 0.02, 0.07, 0.23, 0.15,
     0.06, 0, 0, 0, 0, 0.03, 0.1, 0, 0.1, 0.1, 0.2, 0.07, 0, 0.02,
     0, 0, 0, 0.04, 0.115, 0.24, 0.02, 0.03, 0.01, 0.01, 0.02,
     0, 0, 0, 0, 0, 0.02, 0, 0, 0.2, 0.18, 0.05, 0, 0, 0, 0, 0,
     0.08, 0.07, 0.1, 0, 0.01, 0, 0.02, 0, 0, 0, 0, 0, 0, 0.09,
     0.4, 0.18, 0.1, 0.2, 0, 0, 0, 0, 0, 0, 0.29, 0.09, 0.09,
     0, 0.26, 0.3, 0.16, 0, 0, 0, 0, 0, 0, 0.25, 0, 0.16, 0.03,
     0.02, 0.08, 0, 0), Max = c(3, 1.1, 3.2, 1.2, 1.6, 1.48, 0.8,
     0.6, 3.2, 4.9, 3.1, 3.63, 3.4, 2.6, 2, 3.25, 1.6, 2.1, 0.4,
     0.5, 1.1, 2, 6.6, 3.2, 3.6, 5.8, 2.3, 1.7, 1.3, 1.2, 1, 2.1,
     2, 3, 3, 5.9, 3.3, 2.9, 5.2, 1.8, 1.4, 2.2, 0.6, 2.5, 1.02,
     2, 4.4, 3.6, 5.3, 2.2, 2.7, 2.5, 1.5, 1.4, 0.8, 1.4, 1.4,
     2.11, 2.1, 3.3, 3.12, 1.3, 2.4, 1.5, 2.4, 3.5, 0.9, 1.3,
     2.77, 2, 3.2, 2.6, 5.4, 3.4, 2.87, 2.6, 1.6, 1.4, 1.2, 0.2,
     0.91, 2.1, 2.2, 5.2, 4.75, 2.3, 3.4, 2.67, 1.8, 1.9, 0.61,
     0.2, 0.2, 3.4, 3.65, 3.1, 3.15, 2.2, 2, 2.7, 2.3, 1.18, 0.2,
     2.1, 3.3, 1.7, 2.47, 8.8, 2.8, 3.27, 3.29, 2.4, 2.1, 1.73,
     1.03, 1.4, 1.1, 2.9, 3.1, 5.7, 2.69, 2.7, 3.1, 1.3, 1.85,
     0.6, 1.5, 1.1, 1.5, 4.2, 3.8, 4.4, 2.5, 3.2, 2.61, 1.94,
     2.1, 2.1, 1, 0.57, 2.2, 5, 3.02, 2.8, 1.7, 3.08, 5, 2.54,
     2.7, 1.6, 0.1, 0.5, 2.6, 5.35, 3.5, 2.9, 2.3, 2.9, 1.2, 2.47,
     0.6, 0.25)), row.names = c(NA, -162L), class = "data.frame")

Rich
#
Well, you might try ?xyplot -- in particular the "scales" list section
and in particular there the "tck" parameter. Adding
tck = c(1, 0)
to the "scales ="  list will probably solve your problem.

-- Bert
On Tue, Sep 11, 2018 at 2:46 PM Rich Shepard <rshepard at appl-ecosys.com> wrote:
#
On Tue, 11 Sep 2018, Bert Gunter wrote:

            
Bert,

   How interesting. This removed the tick marks on top but left them on the
right axes. Will think more about this.

Regards,

Rich
#
??

Not when I run your code with the tck specification added. Show us
your xyplot invocation. It should be
scales = list(tck = c(1,0), x= etc.)

Bert
On Tue, Sep 11, 2018 at 3:51 PM Rich Shepard <rshepard at appl-ecosys.com> wrote:
#
On Tue, 11 Sep 2018, Bert Gunter wrote:

            
Bert,

   Command:

rain.all.sum <- xyplot(Sum ~ Month, data=agg.all, col = 'black', type = 'h',
                        main = 'Monthly Total Precipitation\n2005-2018',
                        xlab = 'Year and Month', ylab = 'Precipitation (in)',
                        scales = list(x = list(tck = c(1, 0), at = seq(1,162,by=6),
                                               cex = 0.7, rot = 90)))

rain.all.sum.pdf attached.

Regards,

Rich

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rain.all.sum.pdf
Type: application/pdf
Size: 6640 bytes
Desc: 
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20180911/bc738398/attachment.pdf>
#
As I thought, you did not do what I told you to.

Look *carefully* at the two to see your error.

-- Bert
On Tue, Sep 11, 2018 at 5:01 PM Rich Shepard <rshepard at appl-ecosys.com> wrote:
#
On Tue, 11 Sep 2018, Bert Gunter wrote:

            
Bert,

   You're correct, of course. After moving the tck parameter in front of the
x list the right-side ticks are gone. Unfortunately, so are the data: the
panel is empty.

   Corrected command:

rain.all.sum <- xyplot(Sum ~ Month, data=agg.all, col = 'black', type = 'p, h',
                        main = 'Monthly Total Precipitation\n2005-2018',
                        xlab = 'Year and Month', ylab = 'Precipitation (in)',
                        scales = list(tck = c(1,0), x = list(at = seq(1,162,by=6),
                                               cex = 0.7, rot = 90)))

   Tomorrow I'll work on why the panel display disappeared along with the
right axes tick marks. Parentheses all match according to emacs.

Thanks,

Rich
#
You do that. Your error is obvious.
-- Bert
On Tue, Sep 11, 2018 at 5:39 PM Rich Shepard <rshepard at appl-ecosys.com> wrote:
#
On Tue, 11 Sep 2018, Bert Gunter wrote:

            
Bert,

   Yep. Forgot to remove the 'p' from the type attribute.

Mea culpa!

Rich