Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
878 views
in Technique[技术] by (71.8m points)

r - How can I ask a great ggplot / lattice / base plot question?

I have read the How to make a great R reproducible example famous thread, but there is no specific advice regarding how to ask a great ggplot, lattice or base-plots great R question.

What are your tips to create an excellent example?

What information should you include or avoid?

How do you state your expected output?

What are the recommended sizes and formatting of attached plots?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

First, follow the agreed-upon standards to ask a great R question and make a great R reproducible example (see this discussion):

  1. Share your data. Data small and simple enough to reproduce the problem.
  2. Don't overload reserved names, such as c, df or data.
  3. As far as possible, use R's or package's standard datasets, such as mtcars or iris. Don't share links to files, most of us don't like downloading files from unknown parties.
  4. Share your code.

For graph/plot/map-generating code, please:

  1. Include calls to library or require used to load packages with which you produced the plots/graphs/maps.
  2. Strip out all the cosmetic parts of the code, unless the problem you want to address has to do specifically with such cosmetics. Excessive and unnecessary code clutters the question, making it more difficult to understand and address.

    1. theme calls to format backgrounds, colors, axes and the like.
    2. labs calls and any similarly used to set titles, subtitles and the like.
    3. Coloring of lines, axis, fills and similar components.
  3. Check if your data is tidy. If you have to make repetitive calls to produce each line in your plot, it's likely your data isn't tidy.

  4. Be specific about whether you are only looking for a base R, ggplot2 or lattice-based solution, or whether a solution from any package is acceptable.

Regarding your expected output, state it in words whenever possible. If an image is needed, please include one with at least these characteristics:

  • Size: It should be big enough to allow potential helpers to appreciate the details of your expected output, but small enough to load quickly, even under an unstable internet connection.
  • Type: use a format that will render in most browsers: jpg and png are good options. Avoid formats that don't or that will require proprietary software to display.
  • It doesn't need to be code-generated. A paint version and even a hand-painted one can be enough, if they are of sufficient quality and focus on the expected details of the plot.
  • Avoid sharing links to download images, specially if in a format that doesn't display in a standard browser: Most of us don't like downloading files from unknown parties.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...