[R] Plots from categorial data
Hello everybody, Since my first message was caught by the spam filter, I just try to do it again: I want to use R to generate plots from categorial data. The data contains results from OCR scans over images with are preprocessed by different image filtering techniques. A small sample data set looks as following: data - read.csv(d:/tmp_da/sql_data/filter_d_tool.csv, header=T) data ocrtool filter_setting avg.hit. 1 FineReader2x10.383 2 FineReader2x20.488 3 FineReader3x20.268 4 FineReader3x30.198 5 FineReader4x30.081 6 FineReader4x40.056 7gocr2x10.153 8gocr2x20.102 9gocr3x20.047 10 gocr3x30.052 11 gocr4x30.014 12 gocr4x40.002 13 ocrad2x10.085 14 ocrad2x20.094 15 ocrad3x20.045 16 ocrad3x30.050 17 ocrad4x30.025 18 ocrad4x40.009 I now want to draw a plot with the categories (filter_setting) as X axis, and the avg_hit as Y axis. There should be lines for each ocrtool. But when I draw a plot, the resulting plot always contains bars, even if I specify type=n. plot(data$filter_setting, data$avg.hit., type=n) When I only plot the categories, without data, there appear strange grey (but empty) boxes. plot(data$filter_setting, type=n) Who do I get a clean white box to draw the different lines in? Thanks and regards, Christoph --- Christoph Krammer Student University of Mannheim Laboratory for Dependable Distributed Systems A5, 6 68131 Mannheim Germany __ R-help@stat.math.ethz.ch 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: [R] Plots from categorial data
Hello Hadley, Thanks a lot for your help. I got the plot I want out of this module with a slightly more complicated command. But now, I have an additional problem: In the given case, the filtersetting column contains letters, so R takes the values as categories. But I have other filters, which only have numeric categories like 0.125, 0.25, 1, and so on. But there is no real distance between these values, so the data is still categorial. But if I draw a plot from this data, the result is a plot with axis labels like 0.2, 0.4, 0.6, ... How do I tell R to treat the numbers in the filtersetting column as categories? Thanks and regards, Christoph -Ursprüngliche Nachricht- Von: hadley wickham [mailto:[EMAIL PROTECTED] Gesendet: Sonntag, 1. Juli 2007 12:21 An: Christoph Krammer Cc: r-help@stat.math.ethz.ch Betreff: Re: [R] Plots from categorial data Perhaps this will do what you want: library(ggplot2) qplot(filter_setting, avg.hit, data=data, colour=ocrtool, geom=line) find out more about ggplot2 at http://had.co.nz/ggplot2 Hadley On 7/1/07, Christoph Krammer [EMAIL PROTECTED] wrote: Hello everybody, Since my first message was caught by the spam filter, I just try to do it again: I want to use R to generate plots from categorial data. The data contains results from OCR scans over images with are preprocessed by different image filtering techniques. A small sample data set looks as following: data - read.csv(d:/tmp_da/sql_data/filter_d_tool.csv, header=T) data ocrtool filter_setting avg.hit. 1 FineReader2x10.383 2 FineReader2x20.488 3 FineReader3x20.268 4 FineReader3x30.198 5 FineReader4x30.081 6 FineReader4x40.056 7gocr2x10.153 8gocr2x20.102 9gocr3x20.047 10 gocr3x30.052 11 gocr4x30.014 12 gocr4x40.002 13 ocrad2x10.085 14 ocrad2x20.094 15 ocrad3x20.045 16 ocrad3x30.050 17 ocrad4x30.025 18 ocrad4x40.009 I now want to draw a plot with the categories (filter_setting) as X axis, and the avg_hit as Y axis. There should be lines for each ocrtool. But when I draw a plot, the resulting plot always contains bars, even if I specify type=n. plot(data$filter_setting, data$avg.hit., type=n) When I only plot the categories, without data, there appear strange grey (but empty) boxes. plot(data$filter_setting, type=n) Who do I get a clean white box to draw the different lines in? Thanks and regards, Christoph --- Christoph Krammer Student University of Mannheim Laboratory for Dependable Distributed Systems A5, 6 68131 Mannheim Germany __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Plots from categorial data
Software zur Erkennung von Spam auf dem Rechner hypatia.math.ethz.ch hat die eingegangene E-mail als mögliche Spam-Nachricht identifiziert. Die ursprüngliche Nachricht wurde an diesen Bericht angehängt, so dass Sie sie anschauen können (falls es doch eine legitime E-Mail ist) oder ähnliche unerwünschte Nachrichten in Zukunft markieren können. Bei Fragen zu diesem Vorgang wenden Sie sich bitte an the administrator of that system Vorschau: Hello everybody, I want to use R to generate plots from categorial data. The data contains results from OCR scans over images with are preprocessed by different image filtering techniques. A small sample data set looks as following: [...] Inhaltsanalyse im Detail: (5.5 Punkte, 5.0 benötigt) Pkte Regelname Beschreibung -- -- 0.0 DKIM_POLICY_SIGNSOME Domain Keys Identified Mail: policy says domain signs some mails 1.0 BAYES_60 BODY: Spamwahrscheinlichkeit nach Bayes-Test: 60-80% [score: 0.7481] 4.5 AWLAWL: From: address is in the auto white-list ---BeginMessage--- Hello everybody, I want to use R to generate plots from categorial data. The data contains results from OCR scans over images with are preprocessed by different image filtering techniques. A small sample data set looks as following: data - read.csv(d:/tmp_da/sql_data/filter_d_tool.csv, header=T) data ocrtool filter_setting avg.hit. 1 FineReader2x10.383 2 FineReader2x20.488 3 FineReader3x20.268 4 FineReader3x30.198 5 FineReader4x30.081 6 FineReader4x40.056 7gocr2x10.153 8gocr2x20.102 9gocr3x20.047 10 gocr3x30.052 11 gocr4x30.014 12 gocr4x40.002 13 ocrad2x10.085 14 ocrad2x20.094 15 ocrad3x20.045 16 ocrad3x30.050 17 ocrad4x30.025 18 ocrad4x40.009 I now want to draw a plot with the categories (filter_setting) as X axis, and the avg_hit as Y axis. There should be lines for each ocrtool. But when I draw a plot, the resulting plot always contains bars, even if I specify type=n. plot(data$filter_setting, data$avg.hit., type=n) When I only plot the categories, without data, there appear strange grey (but empty) boxes. plot(data$filter_setting, type=n) Warning messages: 1: Grafikparameter type ist veraltet in: plot.window(xlim, ylim, log, asp, ..) 2: Grafikparameter type ist veraltet in: axis(side, at, as.graphicsAnnot(labels), tick, line, pos, outer, 3: Grafikparameter type ist veraltet in: title(main, sub, xlab, ylab, line, outer, ...) 4: Grafikparameter type ist veraltet in: axis(side, at, as.graphicsAnnot(labels), tick, line, pos, outer, Who do I get a clean white box to draw the different lines in? Thanks and regards, Christoph ---End Message--- __ R-help@stat.math.ethz.ch 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.