Hi, So far my plotting needs have been sort of ignored as I got acquainted with R this week, but now that I have the basics in place for the program I wanted to write it's time for me to start learning about how to make output that better suits my needs. I think I have two sort of charts I need to concentrate on learning how to produce: 1) Probably a trivial request - a single chart that has multiple lines on it in different colors. I might have 500 to 1000 lines, all starting at 0,0 on the left and proceeding to the right where they end either above 0 or below 0. There will groups of colors depending on the group they are part of. I'd like a legend on the right or bottom that explains the colors. I should be able to add or remove lines at any time. 2) The closest example of the second would be a multi-study chart sort of like is typical in a lot of stock charting programs. Here's (I hope) a simple example: http://stockcharts.com/h-sc/ui?s=BAC I'm not going to plot stock price data, or don't plan to anyway, but the thing I need in a chart is this multi-study aspect - essentially 3 charts in the example, all sitting on top of each other, with their own axises. It might not be immediately clear that the link shows an upper chart with two parts - the price data (with volume and moving averages) and the uppoer portion that has an RSI indicator - in separate studies on the same chart, with a second chart immediately below it that has the MACD indicator. With all the great plots I've seen so far I suspect these requests are pretty easy for the experts so I'm hoping for a few good ideas and maybe a few examples somewhere to help me get started will be all I need. Keep in mind I've not used any command other than plot() and par() so far. I *very* new to this. I started looking at ggplot2 last night. I haven't looked at Lattice. Any recommendations on where I should look next are warmly appreciated. Thanks, Mark
Hi, On Jul 2, 2009, at 10:39 AM, Mark Knecht wrote:> Hi, > So far my plotting needs have been sort of ignored as I got > acquainted with R this week, but now that I have the basics in place > for the program I wanted to write it's time for me to start learning > about how to make output that better suits my needs. I think I have > two sort of charts I need to concentrate on learning how to produce: > > 1) Probably a trivial request - a single chart that has multiple lines > on it in different colors. I might have 500 to 1000 lines, all > starting at 0,0 on the left and proceeding to the right where they > end either above 0 or below 0. There will groups of colors depending > on the group they are part of. I'd like a legend on the right or > bottom that explains the colors. I should be able to add or remove > lines at any time. > > 2) The closest example of the second would be a multi-study chart sort > of like is typical in a lot of stock charting programs. Here's (I > hope) a simple example: > > http://stockcharts.com/h-sc/ui?s=BACOne thing you could do is to peruse the R Graph Gallery to see what people can do: http://addictedtor.free.fr/graphiques/ In particular, the graph below looks *somehow* similar to the chart you link to. http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=109> Keep in mind I've not used any command other than plot() and par() > so far. I *very* new to this. I started looking at ggplot2 last night. > I haven't looked at Lattice.You're looking in the right place. Here's a blog that someone is writing as they learn how to use ggplot2. His latest posts compare how to construct graphics from the lattice book " Lattice: Multivariate Data Visualization with R" using ggplot2: http://learnr.wordpress.com/ That should be very useful. Hope that helps, -steve -- Steve Lianoglou Graduate Student: Physiology, Biophysics and Systems Biology Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact
plot.zoo and xyplot.zoo in the zoo package both produce multipanel plots with one panel per series (or optionally all on one panel or a mixture). library(zoo) example(plot.zoo) example(xyplot.zoo) and see the three zoo vignettes. The quantmod package has charting specifically oriented to securities. On Thu, Jul 2, 2009 at 10:39 AM, Mark Knecht<markknecht at gmail.com> wrote:> Hi, > ? So far my plotting needs have been sort of ignored as I got > acquainted with R this week, but now that I have the basics in place > for the program I wanted to write ?it's time for me to start learning > about how to make output that better suits my needs. I think I have > two sort of charts I need to concentrate on learning how to produce: > > 1) Probably a trivial request - a single chart that has multiple lines > on it in different colors. I might have 500 to 1000 lines, all > starting at 0,0 on the left ?and proceeding to the right where they > end either above 0 or below 0. There will groups of colors depending > on the group they are part of. I'd like a legend on the right or > bottom that explains the colors. I should be able to add or remove > lines at any time. > > 2) The closest example of the second would be a multi-study chart sort > of like is typical in a lot of stock charting programs. Here's (I > hope) a simple example: > > http://stockcharts.com/h-sc/ui?s=BAC > > I'm not going to plot stock price data, or don't plan to anyway, but > the thing I need in a chart is this multi-study aspect - essentially 3 > charts in the example, all sitting on top of each other, with their > own axises. It might not be immediately clear that the link shows an > upper chart with two parts - the price data (with volume and moving > averages) and the uppoer portion that has an RSI indicator - in > separate studies on the same chart, with a second chart immediately > below it that has the MACD indicator. > > ? With all the great plots I've seen so far I suspect these requests > are pretty easy for the experts so I'm hoping for a few good ideas and > maybe a few examples somewhere to help me get started will be all I > need. > > ? Keep in mind I've not used any command other than plot() and par() > so far. I *very* new to this. I started looking at ggplot2 last night. > I haven't looked at Lattice. > > ? Any recommendations on where I should look next are warmly appreciated. > > Thanks, > Mark > > ______________________________________________ > R-help at 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. >