STHDA forum

Plotting, data visualizations » heatmap rotate

Slingshot booster

rank_0.png

Avatar

Signed up since: 14/12/2018

Messages: 1

On 12/14/2018 at 10h43
Hi everybody

I have been using this plot to create a heatmap with abundances in different stations and depths.
I need to rotate my graf 90 degrees. so that I can have on the x-axes the species and on the y-axes the station-depth. Do you have any idea how to do it? I am new in R..and I have some difficulties.. I have tried a few ways but none of them worked (clockwise90, scale_reverse etc)

# Plot abundance
heatmap_dominant.heatmap <- ggplot(data = heatmap_dominant.long, mapping = aes(x = Station,
y = Species,
fill = Abundance)) +
geom_tile() +
xlab(label = "Depth (m)") +
facet_grid(~ Depth)+
facet_grid(~ Depth, switch = "x", scales = "free_x", space = "free_x") +
scale_fill_gradient2(name = "(%)",
low = "light yellow", mid="red", midpoint=22,
high = "blue") +
theme_bw() +

theme(strip.placement = "outside", # Move depth boxes to bottom of plot
plot.title = element_text(hjust = 0.5), # Center-justify plot title
axis.title.y = element_blank(), # Remove y-axis title
strip.background = element_rect(fill = "#FFFFFF", color = "#012345")) + # Faint "Depth" boxes
ggtitle(label = "Dominant Species") +
scale_y_discrete(limits = rev(levels(as.factor(heatmap_dominant.long$Species)))) # Reverse order of y-axis

heatmap_dominant.heatmap
   

Slingshot booster

rank_0.png

Avatar

Signed up since: 07/10/2019

Messages: 4

On 10/17/2019 at 10h26
Try to search same threads at Quora or Reddit



Edit by daylelong On 10/17/2019 at 16h08
   

Slingshot booster

rank_0.png

Avatar

Signed up since: 17/10/2019

Messages: 2

On 10/17/2019 at 16h08
If you are a student and want to have good grades, but do not want to spend a lot of time studying, I advise you https://businessays.net/5-1-10-practice-test-chapter-6-6-7-3-practice-exam-6-6-10-practice-exam-6-5-9-practice-exam-6-4-7-practice-exam-6-3-8-practice-exam-6-2-5-practice-exam-6-1-10-practice-exam-6-7-testout-6-7-3/ this area where you can find a lot of useful information.
   
Answer
You aren't allowed to write in this category
1 User online : 0 Administrator, 0 Moderator, 0 Member and 1 Visitor
User online : No member online