From Data to Viz  is a fantastic website to help you find the code you need to generate the chart you need
It classifies chart types based on input data format, working through a form of a decision tree, leading to a set of potentially appropriate visualizations to represent the dataset.
The project is built on two underlying philosophies. First, that most data analysis can be summarized in about twenty different dataset formats. Second, that both data and context determine the appropriate chart.
Thus, our suggested method consists in identifying and trying all feasible chart types to find out which suits your data and idea best.
Once this set of graphics is identified, data-to-viz.com  aims to guide you toward the best decision. It also provides a list of common caveats to avoid and always provides a reproducible code snippet in the R programming language .
Dataviz is a world with endless possibilities and this project does not claim to be exhaustive. However, it should provide you with a good starting point.
From Data to Viz leads you to the most appropriate graph for your data. It links to the code to build it and lists common caveats you should avoidTake a Look 
Find more essential tools on our website, covering everything from datasets to study tools – https://www.dementiaresearcher.nihr.ac.uk/essential-tools/