I am trying to create a heatmap using the ggplot2 package. I have trouble controlling the color and brake on summer and I have 18 questions, 22 firms and the average value of the firms reacts to the scale of 1 to 5.
Say I value (0-1) (1-2) (2-3) (3-4) (4-5) color coded. Either different colors (blue, green, red, yellow, purple) or a gradient scale. And also NA values = black brief: How do I choose colors and breaks?
I would also like to fix the order on the axis for "Question 1, Question 2 ... Q18" Similarly, for firms, at this time I believe that this class is the "factor" which causes this problem.
& gt; Head (Mind, 20) Firm Question value 1 1 question 1 3.6675482217047 2 1 question 2 3.74327628361858 3 1 question 3 & gt; NA & gt; 4 1 question 4 & gt; NA & gt; 5 1 question 5> NA & gt; 6 1 question 6> NA & gt; 7 1 Question 7 0.352078239608802 8 1 Questions 8 3.04180471049169 9 1 Questions 9 3. 9 5590 9 99 99 10 10 1 Question 10 & gt; NA & gt; 11 1 Questions 1 1 12 1 Question 12 4.265 9 12 9 6778731 13 1 Questions 13 3.95256943635 996 14 1 Questions 14 0.46568627450 9 804 15 1 Questions 15 2.61764705882353 16 1 Questions 16 1.83333333333333 17 1 Question 17 & gt; NA & gt; 18 1 Question 18 0.225490196078431192 Question 1 3.85714285714286 20 2 Questions2 4 & gt; Ggplot (mydf, aes (question, firm, fill = value)) + geom_tile () + theme (axis.text.x = element_text (angle = 330, hjust = 0))
Link to the picture of my current plot.
No comments:
Post a Comment