[R] Superimposing 2 curves on the same graph with par(new=TRUE)

Boris Steipe boris.steipe at utoronto.ca
Mon Mar 23 19:32:08 CET 2015


... and that gives you a "double ordinate plot", a staple of misleading statistics.

Let me give you an analogy: 

Imagine you are on a chemistry mailing list and someone asks about the proper way to mix aluminum powder with fertilizer. Of course, as a chemist you know how. But still - and the same holds for the "double ordinate plot" - just say no.


:-)


For reference (taken from a post on SO):
Junk charts:
  http://junkcharts.typepad.com/junk_charts/2006/06/illusion_of_suc.html
  http://junkcharts.typepad.com/junk_charts/2006/05/the_crossover_l.html
Perecptual Edge ( a more detailed analysis)
  http://www.perceptualedge.com/articles/visual_business_intelligence/dual-scaled_axes.pdf
SMBC's tutorial on infographics (point 4).
  http://www.smbc-comics.com/?id=3167



On Mar 23, 2015, at 2:14 PM, Clint Bowman <clint at ecy.wa.gov> wrote:

> Agreed--I neglected to add the secondary y-axis (shouldn't hit send so fast.)
> 
> Clint Bowman			INTERNET:	clint at ecy.wa.gov
> Air Quality Modeler		INTERNET:	clint at math.utah.edu
> Department of Ecology		VOICE:		(360) 407-6815
> PO Box 47600			FAX:		(360) 407-7534
> Olympia, WA 98504-7600
> 
>        USPS:           PO Box 47600, Olympia, WA 98504-7600
>        Parcels:        300 Desmond Drive, Lacey, WA 98503-1274
> 
> On Mon, 23 Mar 2015, Boris Steipe wrote:
> 
>> ... which is exactly what he shouldn't do because now it the plot falsely asserts that both curves are plotted to the same scale.
>> 
>> 
>> B.
>> 
>> 
>> 
>> On Mar 23, 2015, at 12:34 PM, Clint Bowman <clint at ecy.wa.gov> wrote:
>> 
>>> Try:
>>> plot(Date,MORTSBu,lwd=2,lty="dashed",axes=F,xlab="",ylab="")
>>> 
>>> 
>>> 
>>> Clint Bowman			INTERNET:	clint at ecy.wa.gov
>>> Air Quality Modeler		INTERNET:	clint at math.utah.edu
>>> Department of Ecology		VOICE:		(360) 407-6815
>>> PO Box 47600			FAX:		(360) 407-7534
>>> Olympia, WA 98504-7600
>>> 
>>>       USPS:           PO Box 47600, Olympia, WA 98504-7600
>>>       Parcels:        300 Desmond Drive, Lacey, WA 98503-1274
>>> 
>>> On Mon, 23 Mar 2015, varin sacha wrote:
>>> 
>>>> Dear R-Experts,
>>>> 
>>>> I try to superimpose/present 2 curves/plots on the same graph. I would like the result/graph to be readable.
>>>> For that, I use the par(new=TRUE) argument but on the Y-axis there is a superposition of writings and the Y-axis becomes unreadable.
>>>> How can I solve this problem ?
>>>> 
>>>> Here is a reproducible example :
>>>> Date<-c(1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010)
>>>> 
>>>> MORTSFr<-c(16445,17671,18113,17043,14738,14355,15028,14283,13229,13603,13672,13547,13527,13021,12737,11388,11947,10742,11497,11476,11215,10483,9900,9568,9019,8891,8541,8444,8918,8487,8079,8160,7655,6058,5593,5318,4709,4620,4275,4273,3992)
>>>> 
>>>> MORTSBu<-c(838,889,934,946,960,1030,1021,1040,1153,1149,1199,1219,1229,1123,1119,1113,1070,1153,1153,1280,1567,1114,1299,1307,1390,1264,1014,915,1003,1047,1012,1011,959,960,943,957,1043,1006,1061,901,776)
>>>> 
>>>> plot(Date,MORTSFr,type="l")
>>>> par(new=TRUE)
>>>> 
>>>> plot(Date,MORTSBu,lwd=2,lty="dashed")
>>>> 
>>>> Thanks for your time.
>>>> Best,
>>>> S
>>>> 
>>>> ______________________________________________
>>>> R-help at 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 at 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.
>> 
>> 



More information about the R-help mailing list