project <-read_csv("JHU_HighGroStocks_v15_2021_02_28.csv")
####Select data for figure and pivot to long
stock_score <-
project %>%
select(c(Stock,SA_Authors_Score,WallSt_Score,Quant_Score,Value_Grade,Growth,Profitability,Momentum))
stock_score <- pivot_longer(stock_score,-Stock,names_to="stat",values_to = "value")
#####NOTE: I did not standardize/normalize the data, I think you may have?
###Pipe data and make figure
stock_score %>%
#####Select just a few stocks so the heat map isn't huge
filter(Stock %in% c("ZM","SQ","SHOP","DT","CRWD","BILI")) %>%
#####Here is the key function for releveling the factor
mutate(stat=fct_relevel(stat,c("Value_Grade","Profitability","Quant_Score","SA_Authors_Score","WallSt_Score","Momentum","Growth"))) %>%
#####Make the figure - this is all your code
ggplot(aes(x=stat,y=Stock,fill=value)) +
labs(x="Seeking Alpha Rating Type",y="High Growth Stock",
title = "Top Growth Stocks and Ratings ",
subtitle="Source Seeking Alpha data 2_28_21") +
labs(fill = "Rating")+
scale_fill_viridis(discrete=FALSE) +
geom_tile(color = "white")+
theme(axis.text.x=element_text(angle=90,vjust=.5))