Re: [R] Party plots
Nordlund, Dan (DSHS/RDA) wrote: You need to put the filename in quotes file = C:/Documents and Settings/aelmore/Desktop/foo.pdf Hope this is helpful, Dan Oh yes, this was very helpful (and don't I feel just too silly...). I am, however, still stuck. This is like pulling teeth, how ridiculous that I can't get this simple code to work. Here is what I have: #opening the pdf with a larger document size pdf(file = C:/SFL_2005_PCA27R_7_tree_full.pdf, height = 15, width = 20) That seems to work okay (no errors, at any rate - I get the next prompt line). Then I try: #plotting the pdf plot(SFL_2005_PCA27R_7_tree_full) and this nets me: Error: object SFL_2005_PCA27R_7_tree_full not found Error in plot(SFL_2005_PCA27R_7_tree_full) : error in evaluating the argument 'x' in selecting a method for function 'plot' but turning off the PDF driver works okay: #turning off the device dev.off() null device 1 If I open the pdf with Acrobat, the file is definitely there, albeit still crowded. It's not like the file is empty or anything. I am mystified. -- View this message in context: http://www.nabble.com/Party-plots-tp25277282p25293056.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Party plots
Hi r-help-boun...@r-project.org napsal dne 04.09.2009 13:53:24: Nordlund, Dan (DSHS/RDA) wrote: You need to put the filename in quotes file = C:/Documents and Settings/aelmore/Desktop/foo.pdf Hope this is helpful, Dan Oh yes, this was very helpful (and don't I feel just too silly...). I am, however, still stuck. This is like pulling teeth, how ridiculous that I can't get this simple code to work. Here is what I have: #opening the pdf with a larger document size pdf(file = C:/SFL_2005_PCA27R_7_tree_full.pdf, height = 15, width = 20) That seems to work okay (no errors, at any rate - I get the next prompt line). Then I try: You opened a device for plotting. See ?Devices #plotting the pdf plot(SFL_2005_PCA27R_7_tree_full) No, no. Here you need to do your plotting routine. Something like plot(1:10, rnorm(10)) and this nets me: Error: object SFL_2005_PCA27R_7_tree_full not found Error in plot(SFL_2005_PCA27R_7_tree_full) : error in evaluating the argument 'x' in selecting a method for function 'plot' but turning off the PDF driver works okay: #turning off the device dev.off() null device 1 You turned off pdf divice. Now you can open it by e.g. Acrobat Reader or any suitable programme. Do not forget to quit from Acrobat when trying to use the file again, if it is opened it can not accept data from R. Regards Petr If I open the pdf with Acrobat, the file is definitely there, albeit still crowded. It's not like the file is empty or anything. I am mystified. -- View this message in context: http://www.nabble.com/Party-plots-tp25277282p25293056.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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@r-project.org 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] Party plots SOLVED
Quote from Petr PIKAL No, no. Here you need to do your plotting routine. Something like plot(1:10, rnorm(10)) Now you can open it by e.g. Acrobat Reader or any suitable programme. Do not forget to quit from Acrobat when trying to use the file again, if it is opened it can not accept data from R. Regards Petr quote Ah. This process finally makes sense. Thank you so much. I initially thought we were taking a pdf export of the graphic produced inside the R workspace and re-arranging it into a larger space (somehow... ???). But your comment suggests to me that I'm actually bringing my results (not the graphic) into the pdf device and then plotting them. Duh. So this is what I did, based on that suggestion: # opening a large pdf with of my ctree object pdf(PCA27R_7_ct , height = 15, width = 20) # plotting the pdf plot(PCA27R_7_ct, terminal_panel = node_hist(PCA27R_7.ct, ymax = 5, horizontal = FALSE, freq = TRUE)) # turning off the acrobat driver dev.off() It finally produced my 20 X 15 pdf, rather than the 5.57 X 5.57 default I was getting previously. Man the learning curve for newbie programmers... I cannot tell you guys how helpful it is to have folks like you out there, willing to wade through our messes and offer assistance. Many thanks, Annie -- View this message in context: http://www.nabble.com/Party-plots-tp25277282p25294703.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Party plots
I'm pretty new to R, and not much of a progammer (yet). I'm having trouble navigating the graphical output for the party algorithm. Essentially, my tree is too large for the default page size so the nodes overlap and obscure one another. Anybody know how to change the plot parameters to either: 1) enlarge the page size so the default font fits comfortably (preferred); 2) shrink the graphics to fit the default page size (I worry that this might make exports illegibly small); or 3) show the tree in sections (not optimal, but servicable). Any assistance offered is truly welcome. Thanks -- View this message in context: http://www.nabble.com/Party-plots-tp25277282p25277282.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Party plots
On Thu, 3 Sep 2009, AnnieE wrote: I'm pretty new to R, and not much of a progammer (yet). I'm having trouble navigating the graphical output for the party algorithm. Essentially, my tree is too large for the default page size so the nodes overlap and obscure one another. Anybody know how to change the plot parameters to either: 1) enlarge the page size so the default font fits comfortably (preferred); You can easily plot into a large PDF, e.g., something like this pdf(file = foo.pdf, height = 15, width = 20) plot(foo) dev.off() and then view the PDF in an external viewer, zooming into parts of a tree etc. Depending on the size of the tree in foo, you might have to adjust height/width accordingly. 2) shrink the graphics to fit the default page size (I worry that this might make exports illegibly small); or 3) show the tree in sections (not optimal, but servicable). This is both a bit cumbersome in the current implementation. If you want to play around, you can use the re-implementation in package partykit on R-Forge which has more flexible plotting facilities. However, there is still not much documentation, yet. Hence, I would recommend to try the solution above to see whether it suits your needs... hth, Z __ R-help@r-project.org 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] Party plots
Achim Zeileis wrote: You can easily plot into a large PDF, e.g., something like this pdf(file = foo.pdf, height = 15, width = 20) plot(foo) dev.off() and then view the PDF in an external viewer, zooming into parts of a tree etc. Depending on the size of the tree in foo, you might have to adjust height/width accordingly. Thanks very much. That sounds like just what I'm looking for and have been unable to ferret out in my search through manuals and forums. I'm still a bit stuck though, because of my unfamiliarity with pulling stuff in and out of R. How do you get the initial .pdf file that you're manipulating here? I tried saving the R graphic to a PDF on my desktop and then running pdf (file = C:/Documents and Settings/aelmore/Desktop/foo.pdf, height = 15, width = 20) plot (foo) dev.off() but that netted me the error: unexpected '/' in pdf(file = C:/ and of course trying it without the string returned the error: object foo not found. What am I missing? Is the graphic that R displays when I call for a plot somehow available for use here? If so, I don't know what it's called/how to access it. The name of the regression tree that it represents doesn't work. That attempt gave me the error: cannot coerce type 'S4' to vector of type 'character.' So, as you see, closer but still stuck. Thanks again in advance for any assistance. -- View this message in context: http://www.nabble.com/Party-plots-tp25277282p25283024.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Party plots
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of AnnieE Sent: Thursday, September 03, 2009 12:57 PM To: r-help@r-project.org Subject: Re: [R] Party plots Achim Zeileis wrote: You can easily plot into a large PDF, e.g., something like this pdf(file = foo.pdf, height = 15, width = 20) plot(foo) dev.off() and then view the PDF in an external viewer, zooming into parts of a tree etc. Depending on the size of the tree in foo, you might have to adjust height/width accordingly. Thanks very much. That sounds like just what I'm looking for and have been unable to ferret out in my search through manuals and forums. I'm still a bit stuck though, because of my unfamiliarity with pulling stuff in and out of R. How do you get the initial .pdf file that you're manipulating here? I tried saving the R graphic to a PDF on my desktop and then running pdf (file = C:/Documents and Settings/aelmore/Desktop/foo.pdf, height = 15, width = 20) plot (foo) dev.off() You need to put the filename in quotes file = C:/Documents and Settings/aelmore/Desktop/foo.pdf Hope this is helpful, Dan but that netted me the error: unexpected '/' in pdf(file = C:/ and of course trying it without the string returned the error: object foo not found. What am I missing? Is the graphic that R displays when I call for a plot somehow available for use here? If so, I don't know what it's called/how to access it. The name of the regression tree that it represents doesn't work. That attempt gave me the error: cannot coerce type 'S4' to vector of type 'character.' So, as you see, closer but still stuck. Thanks again in advance for any assistance. Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204 __ R-help@r-project.org 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.