-1

My task is simple, just to plot the following, but the plot in the middle should be a filled.contour plot: http://gallery.r-enthusiasts.com/graph/Scatterplot_with_marginal_histograms_78

Background: I prefer filled.contour rather than hist2d. Because, I could use kernel smooth, so the plot for discrete data won't be too ugly. I also tried image() and then contour(), but the number on contour is not clear and no indication about the color.

My problem: in filled.contour function, it uses layout() for filledcontour() plot and rect() plot (color bar). However, I use layout() in outside code to organize 2 histograms and one filled.contour plot. Looks like, the layout outside is shadowed by filled.contour(). I am not sure how R deal with this problem. Should I rewrite filled.contour() somehow?

If we can plot in R like matplotlib in python, something like the following link will make life much easier: http://matplotlib.org/examples/pylab_examples/scatter_hist.html

Dinre
  • 4,196
  • 17
  • 26
whatsnext
  • 617
  • 7
  • 19
  • There is already some nice work out there on SO: http://stackoverflow.com/questions/11546256/two-way-density-plot-combined-with-one-way-density-plot-with-selected-regions-in/11552979#11552979 and stackoverflow.com/questions/8545035/scatterplot-with-marginal-histograms-in-ggplot2/8545618 . I'm pretty sure I can do it in base graphics but I'm not sure it's worth the trouble when existing ggplot solutions are already available. Please respond regarding whether those are adequate. – IRTFM Mar 08 '13 at 19:19
  • 2
    Also ... if those are not adequate you should post data and code documenting a reasonable starting point for enhancement. Otherwise people here are likely to downvote the question as showing minimal effort on your part. – IRTFM Mar 08 '13 at 19:24
  • +1 to DWin's comment. You're going to need a picture of your current graph, plus some sample data and code to work from in order to get much interest from the SO community. – Dinre Mar 08 '13 at 20:14
  • Downvoting for crossposting and voting to close. – IRTFM Mar 08 '13 at 20:37

1 Answers1

0

This looks like an identical question to this one on CrossValidated. See the answer there (which is to use .filled.contour instead of filled.contour.

Community
  • 1
  • 1
Greg Snow
  • 48,497
  • 6
  • 83
  • 110