0

I have some panel data that includes 15 similar companies with 7 different variables that are used to explain the companies' profitability. The data is yearly from 2006-2018. I am currently looking at one variable in particular and I have plotted it. What I need to do is highlight 3 specific companies' lines, and I was thinking the best way to do this would be to just increase the thickness of the lines, but after several attempts I have not been able to increase the three companies. My code:

ggplot(data = FE, mapping = aes(x=Year,y=X2, group=Bank, color=Bank))
 +geom_line(aes(size = Company)) +scale_x_discrete(breaks = c(2006,2008,2010,2012,2014,2016,2018))
 +theme(axis.text.x =element_text(angle = 90,hjust = 1))
 +theme(legend.title = element_blank())+theme(legend.position="none")

I could just use Facets, but I want all lines on one graph.

Thanks

a_js12
  • 329
  • 1
  • 8
  • 3
    Have a look [How to make a great R reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) and post some data. A solution will be quicker if you share sample data. – deepseefan Sep 21 '19 at 15:58
  • 2
    You can create an additional object (by filtering) from **FE** with only the three companies you want. Then you can create an additional **geom_line()** with a bigger size on top your current plot. You should consider moving the **data** argument from **ggplot** to the **geom_line()**. Though a reproducible example would be useful to helpyou. – Orlando Sabogal Sep 21 '19 at 16:07
  • 1
    Try `+geom_line(aes(size = (Company %in% specificCos)))` where `specificCos` is a vector containing the names of the three companies you want to highlight. – Andrew Gustar Sep 21 '19 at 16:08
  • Or highlight by coloring part of the chart https://stackoverflow.com/questions/21858394/partially-color-histogram-in-r – novica Sep 21 '19 at 18:30

0 Answers0